-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogout.php
41 lines (35 loc) · 1.24 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
<?php
/**
* Log the user out and optionally redirect to a page afterwards.
*
* LICENSE:
*
* This source file is subject to the licensing terms that
* is available through the world-wide-web at the following URI:
* http://codecanyon.net/wiki/support/legal-terms/licensing-terms/.
*
* @author Jigowatt <[email protected]>
* @author Matt Gates <[email protected]>
* @copyright Copyright © 2009-2012 Jigowatt Ltd.
* @license http://codecanyon.net/wiki/support/legal-terms/licensing-terms/
* @link http://codecanyon.net/item/php-login-user-management/49008
*/
include_once('classes/generic.class.php');
/** Check if the browser set a referrer. */
$redirect = getenv('HTTP_REFERER') ? getenv('HTTP_REFERER') : 'home.php';
/** See if the admin wants to redirect to a specific page or not. */
$redirect = $generic->getOption('signout-redirect-referrer-enable')
? $redirect
: $generic->getOption('signout-redirect-url');
/**
* Begin removing their existence.
*
* Good bye friend :(. Promise you'll come back?!
*/
if (isset($_SESSION['jigowatt']['username'])) :
session_unset();
session_destroy();
endif;
/** Voila! Here we shall gently nudge them somewhere else. */
header('Location: ' . $redirect);
exit();