Peace, I wrote a PHP File Contains a login form, If the user logs in a field will be inserted into the MySQL DataBase, So I want to make an automatic logout after 20 minutes idle.
I wrote:
<?php
session_start();
require("Connecting_Config.php");
$unm=$_SESSION['user_name'];
$current_date=date("i"); //Only Minutes
$gt_lastactivity="select * from logs where Name='$unm'";
$do_gt_lastactivity=mysql_query($gt_lastactivity,$connect);
$arr=mysql_fetch_array($do_gt_lastactivity);
$last_activity_date=$arr['Last_Activity'];
$yyy=$current_date-$last_activity;
if ($yyy>20)
{
Logout();
}
?>
I tried that and I encountered an error which does a logout to the user if he starts another hour.. Ex: Last_Activity= 59th Minute If he does a refresh in the 1st minute in the next hour it will logout, Who knows how to do that?