My html of iframe page:
Code: Select all
<!DOCTYPE html>
<html>
<head>
<style>
html, body, iframe { height: 100%; }
html { overflow: hidden; }
body { margin: 0px;}
</style>
<base target="_parent">
</head>
<body>
<iframe src="http://192.168.1.10/index.php" width="100%" scrolling="yes" style="border:none;"</iframe>
</body>
</html>
Code: Select all
<?php
session_start();
$_SESSION['valid'] = true;
$_SESSION['timeout'] = time();
header('location:catalogue.php');
?>
My session check code:
Code: Select all
<?php
session_start();
if (isset($_SERVER['HTTP_REFERER'])) {
if ($_SERVER['HTTP_REFERER'] == "") {
unset($_SESSION['valid']);
unset($_SESSION['timeout']);
header('location:index.php');
}
} else {
unset($_SESSION['valid']);
unset($_SESSION['timeout']);
header('location:index.php');
}
if (isset($_SESSION['valid'])) {
$timeout = $_SESSION['timeout'];
$time = time();
$t = $time - $timeout;
if ($t > 9000) { //15*60 = 900 Second, timeout to logout
unset($_SESSION['valid']);
unset($_SESSION['timeout']);
header('location:index.php');
} else {
$_SESSION['timeout'] = time();
}
} else {
header('location:index.php');
}
?>
It seems that the main page is not getting the session start.
If i load the two pages without the use of iframe it is working fine.
My page with the iFrame is on server A which is online host.
My pages index.php and catalogue.php are on server B which are localhost.