hi,
my problem is about session handling func.
i have a project that members are seem online and offline.
i want to do it automatically. when a session starts ,the member seems online and when the member logout or closed his/her browser window he/she seems offline.
i used the ying's example where in the session handling articles.
i added some more code to gc func. but it didnot work. what do i have to do???
i use MySql db on linux. i use str func. 'cos the data in db is serialized. the code is :
function sess_gc($maxlifetime) {
global $sess_link;
/***********
the code below is added code by me.
********/
$q="select value from sessions";
$q_s=mysql_query($q, $sess_link);
while($r=mysql_fetch_object($q_s)){
$strpos1=strpos($r->value,"\"");
$strpos2=strpos($r->value,"\"",$strpos1+1);
$sub=substr($r->value,$strpos1+1,$strpos2-($strpos1+1));
$que="update user set online='OFF', last_offline=NOW() where nick='$sub' and expiry < ".time();
$que_send=mysql_query($que, $sess_link);
}
/**********
my code ended
*************/
$query = "DELETE FROM sessions WHERE expiry < " . time();
$q_send = mysql_query($query, $sess_link);
return mysql_affected_rows($sess_link);
}
in this func. my code,select and update query, did not work but the "delete query" working. and i want to ask that anybody help me about debugging.