-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogout.php
43 lines (33 loc) · 1.17 KB
/
logout.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
session_start();
include 'db.inc.php';
?>
<!DOCTYPE html>
<html>
<body>
<?php
if ($_SESSION['lockedOut']) {
echo "time out ";
echo $_SESSION['lockedOutTime'];
header("location: cantReach.php");
} else {
############ for the cookies and the session work #####
$timestamp = date('Y-m-d H:i:s');
$sqlStart = "INSERT INTO `logs` (`userName`, `ipAdderss`, `sessionToken`, `attepmts`, `loginStatus`,`describeLog`, `time`)
VALUES ('$_SESSION[userName]', '$_SESSION[ip]', '$_SESSION[token]', '-/1', '0', 'LogOut' , '$timestamp')";
echo $sqlStart;
if (!mysqli_query($con, $sqlStart)) {
echo "Error in selecting username & password (loginScreen.html.php)" . mysqli_error($con);
}
####### end for the cookies and the session work
// remove all session variables
session_unset();
// destroy the session
session_destroy();
echo "All session variables are now removed, and the session is destroyed.";
setcookie('token', "", time() - 3600);
header("Location: loginScreen.html.php");
}
?>
</body>
</html>