Hello,
May be this is already discussed here. but i didn't get anything related to it though(solved one). so sorry if this would become repetitive thread.
I want to show user's status online or offline. so i have created one status column into my database. if user is login change the status to 1. till here i am done. but how can i update that 1 to 0 while i ll logged out.
because in my logout.php, only following code is there
if we are able to do this. then there is one more issue will be remaining.PHP Code:$retval = retpath();
session_start();
$userid = $_SESSION['userid'];
$login_date = date('Y-m-d');
$_SESSION['lastpath']=$_SESSION['lastpath']."\n".$_SERVER['HTTP_REFERER']."\n".$_SERVER['PHP_SELF'];
$user_filename = "log_files/user-".$userid.".log";
$user_file=fopen($user_filename,"a+");
unset($_COOKIE['userid']);
//this is something i want to do
$update = $op->runsql("UPDATE ".tbl_author." SET status = 0 WHERE id = '$userid'");
unset($_COOKIE['lastpath']);
unset($_COOKIE['lasturi']);
session_destroy();
what if user wont do log out and just close the browser as it is then how come my status column would be updated?
please suggest me something.
thanks in advance.









Bookmarks