PHP Sessions
Starting, and continuing a session
Start every session with session_start() on every php page you are using it.
However, if you are passing a session id and/or name, set those first, e.g.:
session_id($_GET['sid']) and/or session_name(...);
Registering session data
This is done by using the global $_SESSION array, like this:
$_SESSION['MyAge'] = '26';
Closing and terminating all session data - must follow a session_start()
$_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_destroy();
Additional info
All session data is stored server-side, with only a cookie on the client-side telling the server what session-id it should work with. If the client browser has high security and you are afraid that cookies might not be available, then you can add the constant SID to every hyperlink necessary in order to pass the session-id around. This constant will not have any value unless the cookie creation fails. An alternative way is to define your own POST/GET variable(s) and pass the session_id() and/or session_name().
A simple SID usage example
<a href="index.php?<?=SID?>">A link during a session that needs to have the session-id on the next page.</a>
If SID has a value, it would contain both the session name and the session-id value. E.g. PHPSESSID=somevalue.
Get more information about php sessions over at php.net