There is more to this problem then you show us. This code looks fine by itself and can be no reason to re-direct you to a wrong page. So show the relevant other code.
Ronald :cool:
hi Ronald : this the complete code of admin cp index page
-
<?php
-
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
-
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
-
header("Pragma: no-cache");
-
session_start();
-
if (!isset($_SESSION['username']) && !isset($_SESSION['password'])) {
-
header ("location: login.php");
-
exit;
-
}
-
include 'header.php';
-
require '../dbconnect.php';
-
$content="pages/$action.php";
-
if (strlen($action)==0)
-
{
-
include("pages/index.php");
-
}
-
else
-
{if (file_exists($content)) {
-
include("pages/$action.php");
-
}
-
else
-
{
-
echo "page not found";}
-
}
-
mysql_close();
-
include 'footer.php';
-
?>
-
</body>
-
</html>
i also tried by adding messege under if statment instead .and that was it
if (!isset($_SESSION['username']) && !isset($_SESSION['password'])) {
echo "your not loged in";
exit;
if seesions are not set i see this msg
You are not loged in
it means that if statment is working fine and this is not cache problem .the cach problem has been solved since i added other header function at starts of the page ... the problem is with header redirection ...