<?php
//Sample file - Demonstrates the use of the Session class
require ("session.php3");
//Open connection to db
connect2db();
//Start session
s_start();
//Delete old sessions
s_gc(1440);
//Initialize the vars
$name = "Christoph";
$mail = "php@chkassen.de";
//Register the variables
s_register("name");
s_register("mail");
echo "After session_register() : \n<br><ul>" ;
echo "<li> \$name = " . $name . "\n<br></ul>";
echo "<li> \$mail = " . $mail . "\n<br></ul>";
//Testing the unregister function
// s_unregister("mail");
//Testing the isregistered function
if(s_isregistered("name") == 1)
{
print "Name is registered\n<br>";
}
echo "After session_unregister() : \n<br><ul>" ;
echo "<li> \$name = " . $name . "\n<br></ul>";
echo "<li> \$mail = " . $mail . "\n<br></ul>";
//Saving session data to database
s_save();
?>
|