File: logout.php

package info (click to toggle)
opendb 0.62p9-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,544 kB
  • ctags: 3,560
  • sloc: php: 26,575; sql: 1,982; sh: 250; makefile: 54
file content (84 lines) | stat: -rw-r--r-- 2,677 bytes parent folder | download
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/* 	OpenDb - Open Lending Database Project
	Copyright (C) 2001,2002 by Jason Pell

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

// This must be first - includes config.php
require_once("./include/begin.inc.php");

include_once("./functions/widgets.php");
include_once("./functions/function.php");
include_once("./functions/http.php");

session_start();

opendb_log("User logged out (user_id=".$HTTP_SESSION_VARS['user_id'].")");

if(is_register_globals_enabled())
{
	// PHP manual suggests unregistering globals
	session_unregister("user_id");
	session_unregister("user_type");
	session_unregister("user_theme");
	session_unregister("user_language");
	session_unregister("hash_check");
	session_unregister("login_time");
	session_unregister("last_access_time");
}

// Explicitly set to null!
$HTTP_SESSION_VARS['user_id'] = NULL;
$HTTP_SESSION_VARS['user_theme'] = NULL;
$HTTP_SESSION_VARS['user_language'] = NULL;
$HTTP_SESSION_VARS['user_type'] = NULL;
$HTTP_SESSION_VARS['hash_check'] = NULL;
$HTTP_SESSION_VARS['login_time'] = NULL;
$HTTP_SESSION_VARS['last_access_time'] = NULL;

// close session
session_destroy();

include_once("./include/language.php");
include_once("./include/theme.php");

// No session variables available once logged out!!!
echo _theme_header($LANG_VARS['logout']);

echo("<h2>".$LANG_VARS['logout']."</h2>");

// In some cases this will cause menu frame to be refreshed.
echo _theme_refresh_menu();

echo("<div class=\"colortext\">");
$myid = session_id();// double check for any errors
if( $myid=="")
	echo("<p>".replace_lang_var("site", $CONFIG_VARS['site.title']." ".$CONFIG_VARS['site.version'], $LANG_VARS['thanks_for_using'])."</p>\n");
else									
	echo("<p>".$LANG_VARS['unable_to_logout']."</p>\n");

echo("<br>");

echo format_footer_links(array(array(url=>"login.php",text=>$LANG_VARS['return_to_login_page'])));
echo("</div>");

// No session variables available once logged out!!!
echo _theme_footer();

// Cleanup after begin.inc.php
require_once("./include/end.inc.php");
?>