// Execute the query if (!($result = mysql_query($deleteStmt,

// Execute the query if (!($result = mysql_query($deleteStmt, $link))) { return false; } return mysql_affected_rows($link); } The function gc() deletes the rows corresponding to the sessions which have not been accessed for the last $maxlifetime seconds: function gc($maxlifetime) { global $dbHostName, $dbUserName, $dbPassword, $dbName; // Get a persistent Connection if (!($link = mysql_pconnect($dbHostName, $dbUserName, $dbPassword))) { return false; } // select mysql database if (!mysql_select_db($dbName)) { return false; } Prepare the statement for deleting all the rows for which the value of lastAccessed column of the Session table plus $maxlifetime is greater than the current time. Whenever a row is accessed through a SELECT, UPDATE, or REPLACE SQL statement, the value of lastAccessed column is set to the current time: // DELETE Statement $deleteStmt = “DELETE FROM Session WHERE CURRENT_TIMESTAMP < (lastAccessed + ". $maxlifetime . ")"; // Execute the query if (!($result = mysql_query($deleteStmt, $link))) { return false; } return mysql_affected_rows($link); } The function setSessionHandlers(), sets the session handlers: function setSessionHandlers() { session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); Page 560

Hint: If you are looking for high quality and reliable webspace provider to host and run your jsp hosting application check Sandzak jsp web hosting provider

Comments are closed.