function getDBConnection() { global $dbHostName, $dbUserName, $dbPassword, $dbName;

function getDBConnection() { global $dbHostName, $dbUserName, $dbPassword, $dbName; // Get a persistent database connection if (!($link = mysql_pconnect($dbHostName, $dbUserName, $dbPassword))) { return new Function_Result( “Internal Error: Could not open database connection”, null); } // select mysql database if (!mysql_select_db($dbName, $link)) { return new Function_Result( “Internal Error: Could not selectdatabase “, null); } return new Function_Result(null, $link); } The functions open(), close(), read(), write(), destroy(), and gc() are the session handler functions which store the session data in the back-end database. One of the important requirements for the application was to store the session data in a MySQL table, so that it can be used by the instances of PHP running on different servers. The function open() is called for initializing the session storage. The function doesn’t do anything because the database table session is already created: function open($save_path, $session_name) { return true; } The function close() is the close handler of session storage. The function too doesn’t do anything: function close() { return true; } The function read() returns the session data of session with $id as its session identifier: function read($id) { global $dbHostName, $dbUserName, $dbPassword, $dbName; Open a persistent database connection: Page 557

Hint: This post is supported by Gama web hosting php services

Comments are closed.