- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
$sql = 'SELECT * FROM `user` WHERE `id`=' . $_SESSION['userId'];
$result = $this->db->query($sql);
$data = $result->fetch_assoc();
$sessionId = $data['sessionID'];
$session_id_to_destroy = $sessionId;
$login = 'Login';
if ($_GET['SID'] != $sessionId) {
if (file_exists(ROOT . DS . 'app' . DS . 'sessions' . DS . 'sess_' . $sessionId)) {
unlink((ROOT . DS . 'app' . DS . 'sessions' . DS . 'sess_' . $sessionId));
}
session_id($sessionId);
session_start();
session_destroy();
session_start();
session_regenerate_id($sessionId);
$login = 'Check';
}
$sql = 'UPDATE `user` SET `sessionID`="' . session_id() . '", `lastLogin`=' . time() . ', `everyDayUse`=' . $everyDayUse . ', `lastDayUse`=' . $lastDayUse . ' WHERE `id`=' . $_SESSION['userId'];
$_SESSION['userInfo']['sessionID'] = session_id();
$this->db->query($sql);