Next you will need to have the following in your MySQL user table:
$query = 'CREATE TABLE IF NOT EXISTS users
(
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
last_login INTEGER UNSIGNED DEFAULT 0,
PRIMARY KEY (id)
)
ENGINE = MyISAM';
mysql_query($query, $db) or die(mysql_error($db));
Now you will need to check the mysql table to see when they logged on to your site, and see if it is beyond the time constraints.
$query = 'SELECT
id, last_login
FROM
users
WHERE
id = "' . $id . '"';
$result = mysql_query($query, $db) or die(mysql_error($db));
if($row = mysql_fetch_array($result))
{
$lastlog = $row[‘last_login’];
}
//Compare the integers.
$timenow = time();
$timenow = $timenow - 300;
if ($timenow > $lastlog)
{
header('Location: *.php');
}
*.php should be interpreted as some site that has different permissions, or some page that says:
“You’ve worn out your welcome. Please leave.”
well theres the code lines i would use. evidently the explainations that i typed up to explain how the code works is, unfortunately, a violation of some movie rights or something.