i have a serious problem over here. I created a user system with sessions. The problem is that there is content you only see when you are logged in. For example in the navigation bar the sign in button is replaced with a account button.
Now to my problem: Every page php-includes the navbar.php. For example in the index.php is written:
<body>
<?php include("navbar.php")?>
</body>
The login.php redirects to the index.php:
header("Location: index.php");
But the index.php does not refresh. After a hard refresh with "F5" every thing is fine.
I also tried meta tags to prevent loading the page in the cache.
Any Ideas?
index.php:
<html lang="en">
<head>
...
</head>
<body >
<?php include("navbar.php")?>
<div id="wrap">
...
</div>
</body>
</html>
navbar.php
<div class="navbar">
<?php
session_start();
if (!isset($_SESSION['logged']) || !$_SESSION['logged'])
{?>
...Sign in etc...
<?php
}
else
{?>
...Accounting...
<?php
}?>
</div>
login.php:
<html>
<head>
</head>
<body>
<?php include("navbar.php"); ?>
<div class="container">
<form class="form-signin" action="logon.php" method="post" >
...
<button type="submit">Login</button>
</form>
</div>
</body>
</html>
logon.php:
<?php
if login successfull //pseudo code
header("Location: http://www.***.com/index.php");
}
else
{
header("Location: http://www.google.de");
}
exit;
?>