-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogout.php
More file actions
32 lines (25 loc) · 1017 Bytes
/
logout.php
File metadata and controls
32 lines (25 loc) · 1017 Bytes
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
<?php
include('./classes/DB.php');
include('./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"> Logout of all devices?<br />
<input type="submit" name="confirm" value="Confirm">
</form>
<a href="http://localhost/RisingYouthFoundationTask/login.php">LOGIN AGAIN!!</a>