<?
// Need the class definition
require "_class.session.php";
// Instantiate a session
$my_session=new session_class("znet_shop");
// Remove old session from db (300 sec.)
$my_session->RemoveExpired(300);
// Start session or get previous data
$my_session->Initiate();
// All the session data should now be in your variable names
// $var1, $var2, & $var3 are all assigned now, but we need to
// get our arrays back.
$array1=unserialize($arr1);
$array2=unserialize($arr2);
// Let's print out these arrays separately to show that it worked.
for($i=0;$i<5;$i++)
echo "array1[$i] == ".$array1[$i]."<br>";
echo "array2[\"first\"] == ".$array2["first"]."<br>";
echo "array2[\"second\"] == ".$array2["second"]."<br>";
echo "array2[\"third\"] == ".$array2["third"]."<br>";
echo "array2[\"fourth\"] == ".$array2["fourth"]."<br>";
$my_sid=$my_session->GetID();
?>
<html><body>
<h1>Session Test</h1>
The following values were in your session database:<br>
Session: <? echo $my_sid?><br>
<table border=3>
<tr><td>$var1</td><td><? echo $var1 ?></td></tr>
<tr><td>$var2</td><td><? echo $var2 ?></td></tr>
<tr><td>$var3</td><td><? echo $var3 ?></td></tr>
<tr><td>$arr1</td><td><? echo $arr1 ?></td></tr>
<tr><td>$arr2</td><td><? echo $arr2 ?></td></tr>
</table>
</body></html>
|