<?php
 
// make the require to the classe "session"
 
require_once("class_session.php");
 
// starts  session object
 
$Sess = new session();
 
 
// connection to mysql DB
 
$conn = mysql_connect("localhost","root","");
 
mysql_select_db("session",$conn);
 
$rs = mysql_query("SELECT * FROM sess_users");
 
$num = mysql_num_rows($rs);
 
 
//read some values from database
 
while($line = mysql_fetch_array($rs)){
 
$login[] = $line["login"];
 
$pass[] = $line["password"];
 
// stores it in an array
 
$arrSess = array_combine($login,$pass);
 
}
 
// registering values
 
$Sess->register_session($arrSess);
 
 
 
 
 
 
/**
 
Checking if session was started
 
**/
 
if($_SESSION["guto"]){  // test it with an value on line login from mysql table
 
echo "Session were correctly started <br>";}
 
 
// generates the xml file
 
$Sess->LogSess2Xml();
 
// reads sessions from xml file
 
$arr = $Sess->LoadSessfromXml();
 
// counts number of open sessions
 
// you can use it as a users counter on your web site
 
echo "There are currently " .(count($arr))." sessions open";
 
 
echo "<pre>";   // printign all session information  on xml file
 
echo"  Session ---- Session variable <br/>";
 
print_r($arr);
 
echo "</pre>";
 
 
 
 
 
 
?>
 
 |