-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcheckpoint.php
26 lines (21 loc) · 962 Bytes
/
checkpoint.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
session_start();
$minutes = 2;//change to your likings.
$convert_minutes = $minutes * 60;
ini_set('session.gc_maxlifetime', $convert_minutes); // set the session max lifetime to 2 minutes
if (isset($_SESSION['reached']) && isset($_SESSION["authorized"]) && (time() - $_SESSION['reached'] > $convert_minutes) && (time() - $_SESSION['authorized'] > $convert_minutes)) {
// last request was more than 2 minutes ago
session_unset(); // unset $_SESSION variable for this page
session_destroy(); // destroy session data
}
if (isset($_SESSION["reached"]) && isset($_SESSION["authorized"])) {
echo "authorized => You can now continue! <br>";
echo "<button>Continue here</button>";
$_SESSION['reached'] = time(); // Update session
$_SESSION['authorized'] = time(); // Update session
exit();
} else {
echo "stop bypassing man... go through <a href='#'>this</a> link first:";
exit();
}
?>