you could change this if statement:
if($timenow_ts-$sessiondate_ts<=5*3600) {
print "<SCRIPT> document.location.href='login.php'; </SCRIPT>\n";
}
to:
if($timenow_ts-$sessiondate_ts<=5*3600) {
print "<SCRIPT> document.location.href='login.php'; </SCRIPT>\n";
mysql_free_result($checkuser);
exit();
}
what this will do is print the script part, release your db conn and then exit the script.
to be proper, however. You should use the following:
if($timenow_ts-$sessiondate_ts<=5*3600) {
header("Location: login.php");
mysql_free_result($checkuser);
exit();
}