Can you please explain how to take md5 of a file using php
Asked
Active
Viewed 236 times
2 Answers
1
Hey mate looks like quick search will find heaps about this check this out
first, store the last time the user made a request
<?php
$_SESSION['timeout'] = time();
?>
in subsequent request, check how long ago they made their previous request (10 minutes in this example)
<?php
if ($_SESSION['timeout'] + 10 * 60 < time()) {
// session timed out
} else {
// session ok
}
?>
-
It works, but I think it wont meet my requirement. My requirement is, if a user puts his php page as ideal for 2 mins then I need to destroy a session variable. – Arjun Pokkattu Jan 18 '14 at 09:53
0
I already answered a similar question. This here is after 15 minutes, i suppose you can rewrite it yourself:
if(time() - $_SESSION['timestamp'] > 900) { //subtract new timestamp from the old one
alert("15 Minutes over!");
unset($_SESSION['username'], $_SESSION['password'], $_SESSION['timestamp']);
$_SESSION['logged_in'] = false;
header("Location: " . index.php); //redirect to index.php
exit;
} else {
$_SESSION['timestamp'] = time(); //set new timestamp
}

Realitätsverlust
- 3,941
- 2
- 22
- 46