- Joined
- Dec 15, 2009
- Messages
- 1,387
- Reaction score
- 236
Basically, I did some research before I post this thread.
Well, I dun quite get what the guy is trying to explain...
This is the code provided by the guy who answered him/her.
I want the 10 seconds works like a countdown timer and should not be affected even the page is refreshed.
Do I have to paste the codes on every single page that requires Session?
How can I prevent the 10 seconds revert every time when the entire page is refreshed?
You must be registered to see links
Well, I dun quite get what the guy is trying to explain...
This is the code provided by the guy who answered him/her.
PHP:
if (!isset($_SESSION['CREATED'])) {
$_SESSION['CREATED'] = time();
} else if (time() - $_SESSION['CREATED'] > 10) {
// session started more than 30 minutes ago
session_regenerate_id(true); // change session ID for the current session an invalidate old session ID
$_SESSION['CREATED'] = time(); // update creation time
}
I want the 10 seconds works like a countdown timer and should not be affected even the page is refreshed.
Do I have to paste the codes on every single page that requires Session?
How can I prevent the 10 seconds revert every time when the entire page is refreshed?