Web EndMemo


PHP Sessions


PHP session stores informations and delete them after the user left the website. PHP session must be started before any page output.
<?PHP
session_start();
?>
<html>
....
</html>


Create and use PHP sessions:
<?PHP
$ip = getenv("REMOTE_ADDR");
$_SESSION['ip']= $ip;
$_SESSION['file']=_FILE;

echo "$_SESSION['ip]\n";
?>


Destroy PHP sessions:
<?PHP
session_destroy(); //destroy all sessions
if (isset($_SESSION['ip']))
   unset($_SESSION['ip']); //destroy session ip 
?>