Andy Frédéric ANDRIANIAINA - 2012-11-27 10:30:16
Hi Mister,
I downloaded your session package, and I configured some variables in the mySession.conf.php file to reflect my configurations such as database name, username, etc... : for example I set $_MYSESSION_CONF['DURATION'] = 60; $_MYSESSION_CONF['MAX_DURATION'] = 60;. I didn't change the variable $_MYSESSION_CONF['OVERWRITE_PHP_FUNCTION']. I also made changes in the mySession.class.php : private $session_duration = 60; private $session_max_duration = 60;
I created a login page which posts the login input field data, then I redirect to a welcome page :
<body>
<form id="frm" name="frm" method="post" action="postlogin.php">
<div align="center">
login : <input type="text" id="nom" name="nom" />
<br />
<input type="submit" value="ok" />
</div>
</form>
</body>
Code of postlogin.php :
<?php
include("mySession.class.php");
include("mySession.conf.php");
$session = mySession::getInstance($_MYSESSION_CONF);
$session->save("login",$_POST['nom']);
?>
<script type="text/javascript">
document.location = "accueil.php";
</script>
Code of accueil.php :
<?php
include("mySession.class.php");
include("mySession.conf.php");
$session = mySession::getInstance($_MYSESSION_CONF);
$log_in = $session->getVar("login");
$sess = $session->getSessionId();
echo 'session : '.$sess."<br>";
if (!isset($log_in))
{
?>
<script type="text/javascript">
document.location = "login.php";
</script>
<?php
}
else
{
$zao = date("H:i:s");
echo "il est ".$zao." , Bonjour ".$log_in;
}
?>
Then I do nothing to wait for the session to expire. When the session expires then the session data in the database is still present ! So why aren't the session database data not deleted after session has expired ?