-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.php
27 lines (23 loc) · 909 Bytes
/
config.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
27
<?php
$servername = "";
$username = "";
$password = "";
$databasename = "";
session_start();
$time = $_SERVER['REQUEST_TIME']; // same time()
// For a 30 minute timeout (hết giờ, chờ), specified (chỉ định) in seconds
$timeout_duration = 1800;
/*
- Here we look for the user's LAST_ACTIVITY timestamp (dấu thời gian).
- If it's set (đặt) and indicates (cho biết) our $timeout_duration has passed, blow away (xóa) any previous $_SESSION data and start a new one.
*/
if (isset($_SESSION['LAST_ACTIVITY']) && ($time - $_SESSION['LAST_ACTIVITY']) > $timeout_duration) {
session_unset();
session_destroy();
session_start();
}
/*
- Finally, update LAST_ACTIVITY so that our timeout is based on it and not the user's login time.
*/
$_SESSION['LAST_ACTIVITY'] = $time;
?>