Hi..
I'm newbie here..
I have a problem with my login and logout script..
Here is the login script:
<?php
$q = "SELECT * FROM members WHERE username='%s' AND password='%s'";
$q = sprintf($q, $username, $password);
$q = mysql_query($q);
if (mysql_num_rows($q) > 0) {
$_SESSION['id'] = $q[0]['id'];
$IS_LOGGED_IN = true;
}
?>
here is the logout script:
<?php
session_start();
unset($_SESSION['userid']);
session_destroy();
$_SESSION = array();
header('Location: index.php');
?>
and I have a variable which is called in every page that define some one logged in: $IS_LOGGED_IN = (isset($_SESSION['userid'] && $_SESSION['userid'] !== '');
With that code, users have to login twice before he is in real login state. It happens to with logout.
Why?
Thank's for helping me..