/*
PLEASE NOTE THAT THIS DEMO IS OUTDATED. I WILL POST AN UPDATE SHORTLY. IT SHOULD DEMONSTRATE THE BASIC FUNCTIONALITY BUT LOGIN FUNCTIONALITY HAS NOT BEEN ADDED TO THIS FILE.
*/
<?
// Create session handler
require("sessMan.inc.php");
$sessionVariable = new sessMan();
if (isset($lo)) {
//logout
$sessionVariable->logout(0, $demo_session_id);
}
if (!isset($demo_session_id)) {
// Create session
$sessionVariable->create(9374);
print "Session created:<br><BR>\n";
print "Session ID: ".$sessionVariable->getSessionID()."<br>\n";
print "User ID: ".$sessionVariable->mid()."<br>\n";
print "Session expires at: ".$sessionVariable->expireDate()."<br><br>\n";
?>
<form name="setVarsForm" action="<? print $PHP_SELF; ?>" method="get">
<input type="hidden" name="demo_session_id" value="<? print $sessionVariable->getSessionID(); ?>">
Variable 1: <input type="text" name="var1"><br>
Variable 2: <input type="text" name="var2"><br>
Variable 3: <input type="text" name="var3"><br>
Variable 4: <input type="text" name="var4"><br>
Variable 5: <input type="text" name="var5"><br>
Variable 6: <input type="text" name="var6"><br>
Variable 7: <input type="text" name="var7"><br>
Variable 8: <input type="text" name="var8"><br>
Variable 9: <input type="text" name="var9"><br>
Variable 10: <input type="text" name="var10"><br>
<input type="submit" value="Save variables">
</form>
<?
} else {
// Validates session
$sessionVariable->validate($demo_session_id);
$sessionVariable->setVar1($var1);
$sessionVariable->setVar2($var2);
$sessionVariable->setVar3($var3);
$sessionVariable->setVar4($var4);
$sessionVariable->setVar5($var5);
$sessionVariable->setVar6($var6);
$sessionVariable->setVar7($var7);
$sessionVariable->setVar8($var8);
$sessionVariable->setVar9($var9);
$sessionVariable->setVar10($var10);
print "Session validated:<br><br>\n";
print "Session ID: ".$sessionVariable->getSessionID()."<br>\n";
print "User ID: ".$sessionVariable->mid()."<br>\n";
print "Session expires at: ".$sessionVariable->expireDate()."<br><br>\n";
print "Variable 1: ".$sessionVariable->getVar1()."<br>\n";
print "Variable 2: ".$sessionVariable->getVar2()."<br>\n";
print "Variable 3: ".$sessionVariable->getVar3()."<br>\n";
print "Variable 4: ".$sessionVariable->getVar4()."<br>\n";
print "Variable 5: ".$sessionVariable->getVar5()."<br>\n";
print "Variable 6: ".$sessionVariable->getVar6()."<br>\n";
print "Variable 7: ".$sessionVariable->getVar7()."<br>\n";
print "Variable 8: ".$sessionVariable->getVar8()."<br>\n";
print "Variable 9: ".$sessionVariable->getVar9()."<br>\n";
print "Variable 10: ".$sessionVariable->getVar10()."<br>\n";
?>
<form name="setVarsForm" action="<? print $PHP_SELF; ?>" method="get">
<input type="hidden" name="demo_session_id" value="<? print $sessionVariable->getSessionID(); ?>">
Variable 1: <input type="text" name="var1"><br>
Variable 2: <input type="text" name="var2"><br>
Variable 3: <input type="text" name="var3"><br>
Variable 4: <input type="text" name="var4"><br>
Variable 5: <input type="text" name="var5"><br>
Variable 6: <input type="text" name="var6"><br>
Variable 7: <input type="text" name="var7"><br>
Variable 8: <input type="text" name="var8"><br>
Variable 9: <input type="text" name="var9"><br>
Variable 10: <input type="text" name="var10"><br>
<input type="submit" value="Change variables">
</form>
<form name="logoutForm" action="<? print $PHP_SELF; ?>" method="get">
<input type="hidden" name="demo_session_id" value="<? print $sessionVariable->getSessionID(); ?>">
<input type="hidden" name="lo" value="1">
<input type="submit" value="Close session">
</form>
<?
}
?>
|