-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogout.php
39 lines (25 loc) · 864 Bytes
/
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("/Users/Donovan/Sites/sn/classes/DB.php");
include("/Users/Donovan/Sites/sn/classes/Login.php");
if(!Login::isLoggedIn()){
die("Not logged in");
}
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);
}
}
?>
<h1>Logout of your Account?</h1>
<p>Are you sure you'd like to logout?</p>
<form action = "logout.php" method = "post">
<input type = "checkbox" name = "alldevices" value="alldevices"> Log out of all devices?<br />
<input type = "submit" name = "confirm" value = "Confirm">
</form>