-
Notifications
You must be signed in to change notification settings - Fork 0
/
logout.php
30 lines (27 loc) · 871 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
<?php $pageTitle = 'logout'?>
<?php
session_start();
//ONE DOES NOT SIMPLY DESTROY SESSION
// session_destroy();
// header('location: index.php');
// a token was created if the real person wanted to do this - does it match what we got?
if(!isset($_SESSION['logout_token']) || !isset($_POST['activityToken'])){
//echo 'The token is not set';
header('location: ups.php');
exit;
}else{
// if there is a token, compare it to the one we got from the form
if ($_SESSION['logout_token'] != $_POST['activityToken']){
// redirect to UPS THIS WASN'T SUPPOSED TO HAPPEN page
// echo 'The tokens dont match';
header('location: ups.php');
exit;
}else{
// if it matches - logout
// echo 'Everything matches - logout';
session_destroy();
header('location: index.php');
exit;
}
}
?>