I have a problem with my system, not sure how I can fix this one. A user has
a log in page and takes them to different pages, now each of these pages has
a check to make sure they are logged in with the following code:
session_start();
if (!(isset($_SESSION['username']) $_SESSION['username'] !=
On 14 May 2010 18:47, Barry Zimmerman barryzi...@googlemail.com wrote:
I have a problem with my system, not sure how I can fix this one. A user has
a log in page and takes them to different pages, now each of these pages has
a check to make sure they are logged in with the following code:
Barry,
Did you try to use setcookie with expiry date in the past? You could
use
setcookie before header function of the following manner.
session_start();
if (!(isset($_SESSION['username']) $_SESSION['username'] != '')) {
setcookie(session,session id, 1);
header (Location: login.html);
}
Best
id also suggest to revisit the entire login script that you have attached,
its a bit overly complicated. Keep amount of if statements to the minimum
and you will not get lost. Try to keep it simple.
Session is not a problem for you, just make a very simple set of rules when
user is logging in,
Barry,
session_start(); will not wipe clean the user's session so there is
something else going on.
Does the login.html authentication script correctly set
$_SESSION['username'] ?
Also, it has been my experience that code like
isset($_SESSION['username']) is better if you replace