-
Notifications
You must be signed in to change notification settings - Fork 2
/
logout.php
39 lines (36 loc) · 1.22 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
<?php
include ('classes/DB.php');
include ('classes/Login.php');
if (!Login::isLoggedIn()) {
header("Location: /SushiNetwork/");
}
if (isset($_POST['confirm'])) {
if (isset($_POST['alldevices'])) {
DB::query('DELETE FROM login_tokens WHERE user_id=:userid', array(':userid' => Login::isLoggedIn()));
} else {
if (isset($_COOKIE['SNID'])) {
DB::query('DELETE FROM login_tokens WHERE token=:token', array(':token' => sha1($_COOKIE['SNID'])));
}
setcookie('SNID', '1', time() - 3600);
setcookie('SNID_', '1', time() - 3600);
}
header("Location: /SushiNetwork/"); // go back to timeline
}
?>
<html>
<head>
<title>SSN:Logout from Account</title>
<link rel="stylesheet" href="CSS/style.css">
<meta charset="utf-8">
</head>
<body>
<div class="logForm">
<h1>Are you sure you wanna logout?!</h1>
<form action="logout.php" method="post">
<label>Check Box to logout from all devices!</label>
<input type="checkbox" name="alldevices" value="alldevices">
<input type="submit" name="confirm" value="Confirm">
</form>
</div>
</body>
</html>