-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogout.php
53 lines (43 loc) · 1.04 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
44
45
46
47
48
49
50
51
52
53
<!--
File Name: logout.php
Author's Name: Sukhdeep Singh
Web Site Name: My Portfolio
File Description: This page logs the user out of the business contacts page and closes all connections
-->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Logging Out....</title>
<script src="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
</head>
<body>
<?php
//access current session
session_start();
//evaluate the user_id stored in the session that was set on validate.php
if (empty($_SESSION['user_id'])) {
?>
<script>
$.mobile.changePage("login.php#login", {
transition : "slidefade"
});
</script>
<?php
}
else{
//access the existing session object
session_start();
//remove all the variables from existing session
session_unset();
//get rid of current session
session_destroy();
?>
<!--redirect to the login page-->
<script>
$.mobile.changePage("login.php#login", {
transition : "slidefade"
});
</script>
<?php } ?>
</body>
</html>