From: Kerry D. <ker...@ho...> - 2007-10-26 23:36:38
|
Neil, FWIW, in function sess_touch(), remove one 's' from "UPDATE sesssions" Also, in session_set_save_handler(), you've got function sess_touch listed twice. I'm not sure if that contributes to the problem. -----Original Message----- From: chi...@li... [mailto:chi...@li...] On Behalf Of Nei...@rc... Sent: Thursday, October 25, 2007 9:30 AM To: chi...@li... Subject: [chiPHPug-discuss] sessions I am trying to put in a simple session tracker. I thought I had followed the instructions for overloading the session routines, but I'm getting nothing . . . Please suggest things to try, or point out what I haven't noticed! Here's how my files now begin: <?php session_start(); include_once('exe/includes/session_auth.php'); . . . and here's "session_auth.php": <?php // require_once('../../Connections/mysqlconnect.php'); // required in calling routines function sess_touch($sess_path, $sess_name) { $GLOBAL['sessid'] = session_id(); $now = time(); $sqlUPDATE = "UPDATE sesssions SET touch = " . $now . " WHERE sessid = '" $GLOBAL['sessid'] . "'"; $sqlINSERT = "INSERT sessions (sessid, login, touch) VALUES ('" . $GLOBAL['sessid'] . "', " . $now . ", " . $now . ")"; if( (!mysql_query($sqlUPDATE)) & (!mysql_query($sqlINSERT)) ) { // fail } return 1; } function sess_close() { $now = time(); mysql_query("UPDATE sessions SET logout = $now WHERE sessid = '" . $GLOBAL['sessid'] . "'"); return 1; } function sess_write($sess_id, $data) { $now = time(); mysql_query("UPDATE sessions SET touch = $now WHERE sessid = '" . $GLOBAL['sessid'] . "'"); return 1; } function sess_destroy($sess_id) { $now = time(); mysql_query("UPDATE sessions SET logout = $now WHERE sessid = '" . $GLOBAL['sessid'] . "'"); return 1; } function sess_gc($sess_maxlifetime) { $now = time(); mysql_query("UPDATE sessions SET garbagecollection = $now WHERE touch + $sess_maxlifetime < $now"); return 1; } session_set_save_handler("sess_touch", // same for _open and _read "sess_close", "sess_touch", "sess_write", "sess_destroy", "sess_gc"); ?> Neil Rest -- Nei...@rc... http://users.rcn.com/neilrest/resume/ http://users.rcn.com/neilrest/resume/NeilRest.doc (Word format) ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ chiPHPug-discuss mailing list chi...@li... https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss |