dear friends...
Can we set time for the session to expire..?
If anybody know...plz send me the code...
here is link where you can find lots of examples. php.net
but i recommend to use cookies and set expiration time read this
or if you need high security and realibility, use your own 'expiration time', i.e. create cookie with value and its expirity date and compare it with datebase.
something like that
login.php ->
[code=php]
<?php
$uID = uniqid("");
$IPaddress = $_SERVER["REMOTE_ADD R"];
mysql_query("UP DATE user SET uID='$uID',IPad dress='$IPaddre ss',date='".dat e("U")."' WHERE username='$user name'");
$vaxkakoi = MYSQL_QUERY("SE LECT * FROM user WHERE username='$usi' AND uID='$ida' AND activ='Y'");
$chachacha = mysql_fetch_arr ay($vaxkakoi);
if(!$chachacha) {
setcookie("user name");
setcookie("uID" );
return false;
}else{
$IPserver = $chachacha['IPaddress'];
$diff = $chachacha['date']+constant("time Lim")-date("U");
$IPrecent = $_SERVER["REMOTE_ADD R"];
if(($IPserver != $IPrecent)||($d iff<0)){
setcookie("user name");
setcookie("uID" );
return false;
}else{
$datu = date("U");
mysql_query("UP DATE user SET date='$datu' WHERE username='$usi' ");
return true;
}
}
}else{
setcookie("user name");
setcookie("uID" );
return false;
}
?>
[/code]
you can use this function to check authorisation of user, and set his login validity period manualy, and it works better... i
of course u need databe where you can store users password, uID (userid) and date (time of login). good luck.
Comment