function open ($save_path, $session_name) { global $db,$REMOTE_ADDR; $db->query("delete from Sessions where SessionLast1 hour)"); if($db->query("select * from Sessions where SessionID='".session_id()."'") && $arry=$db->fetch_array()) $db->query("update Sessions set SessionLast=NOW() where SessionID='".session_id()."'"); else $db->query("insert into Sessions set SessionID='".session_id()."',SessionName='$REMOTE_ADDR',SessionLast='NOW()'" ); return(true); }
function close()
return true; }
function read ($id) { global $db; if(!$db->query("select SessionID from Sessions where SessionID='$id'") || $db->num_rows()<=0)return false; $SQL="select SessionData from Sessions where SessionID='$id'"; $db->query($SQL); list($sess_data)=$db->fetch_row(); return($sess_data); }
function write ($id, $sess_data) { global $db; if(!$db->query("select SessionID from Sessions where SessionID='$id'") || $db->num_rows()<=0)return false; if($db->query("update Sessions set SessionData='$sess_data',SessionLast=NOW() where SessionID='$id'")) return true; else return false; }
function destroy ($id) { global $db; $db->query("delete from Sessions where SessionID='$id'"); }