It's recommended to point a browser at http://php.net/sessions during this presentation
$_SESSION array.$_GET or via form posts using $_POST)session.trans_sid). The class described here uses the cookie method.When using cookies, the PHP session management library* stores session data remotely. This data is accessible via a named cookie that contains a unique session id. $_COOKIE['mycookie'] = "hv1ku07kqucvs1vvdd64fhi237"
The unique session id is initially sent from PHP to the browser. On subsequent requests the browser sends this data back to the server.
* You can still store data locally in a cookie using setcookie but this would then be insecure. You would not want to store a credit card number in a local cookie!
Any system that PHP can communicate with:
No! - storing session data in a database is very simple using PHP's built in session handling functions. Additionally there are enormous benefits:
ini_set()Manual reference : C. Session Handling Functions
session_set_save_handler()
bool session_set_save_handler ( string open, string close, string read, string write, string destroy, string gc), executed in the following order:
open : open a session storage connectionread : get session data from storagedestroy : delete session data (invoked by developer)gc : garbage cleanup of stale session datawrite : send session data to storageclose : close the session storage connectionThe above handlers, apart from destroy(), are auto-invoked by PHP. You do not need to call them.
Objective : drop in to your code for instant session handling
require_once('Session.php');//contains a class called Session
$session = new Session();
Defines the session handling properties and database information.
Implement various session related activities such as setting session handlers, starting sessions, checking session data
Looking under the hood : the class library
Date: Wed, 01 Feb 2006 12:14:11 GMT Server: Apache/2.0.54 (Fedora) X-Powered-By: PHP/5.1.1 Set-Cookie: default=as4a73vea425oh0l506b81l4235chbsq; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Length: 1858 Connection: close Content-Type: text/html; charset=UTF-8 200 OK