Hi,
I'm currently having two table fields to record users' login and logout as follows:
Type: Both are Timestamp
My login is ok and the login field shows the exact time i login.
However, when i press logout, the script logs out but the logout field time is updated as same as the login time 😕
My logout code is:
if ($_SESSION['id']){
$update_logout=mysql_query("UPDATE admin_activity SET logout=NOW() WHERE id = '$_SESSION[id]' ",$link ) or die(mysql_error());
$_SESSION = array();
session_destroy();
mysql_close();
header("Location: stafflogin.php");
} else header("Location: unaccess.php");
Extra info: I use $_SESSION['id'] for checking unauthorised page access
Aby help will be appreciated. Thank you.