Hey every1, im using sessions on my admin control panel for my site, im having trouble killing the sessions, and I was wondering if any1 cud please help me?
Below: Sessions set after login check
session_start();
// Password check, other php code
$_SESSION['do_email']=$do_email;
$_SESSION['do_pass']=$do_pass;
$_SESSION['user_logged_in']=1;
session_write_close();
// re-direct to cp.php
Below: Code on password protected pages (cp.php)
session_start();
if ($_SESSION['user_logged_in']!=1)
require_once("login.error.php");
else
{
// procted html is printed here
}
Below: Code for logout.php
session_start();
if ($_SESSION['user_logged_in']!=1)
{
$_SESSION = array();
session_destroy();
}
else
{
require_once("login.error.php");
}
Now, i dont get an error with logout.php, I clicklogout, and it prints the login.error.php message, it therefor lookslike i've logged out. Only, if I go to a password protected page, the sessions are still alive and it hasnt been detroyed. I therefor have to "wait" until my session has expirerd in order to be officially "logged out". Can any1 help me with this error please? Thank you in advance!