More rg=0
[squirrelmail.git] / src / signout.php
CommitLineData
59177427 1<?php
895905c0 2
35586184 3/**
4 * signout.php -- cleans up session and logs the user out
5 *
15e6162e 6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
35586184 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * Cleans up after the user. Resets cookies and terminates session.
10 *
11 * $Id$
12 */
8b522a59 13
86725763 14/* Path for SquirrelMail required files. */
15define('SM_PATH','../');
16
17/* SquirrelMail required files. */
08185f2a 18require_once(SM_PATH . 'include/validate.php');
86725763 19require_once(SM_PATH . 'functions/prefs.php');
20require_once(SM_PATH . 'functions/plugin.php');
21require_once(SM_PATH . 'functions/strings.php');
22require_once(SM_PATH . 'functions/html.php');
f740c049 23
32f4e318 24/* Erase any lingering attachments */
fb745cc7 25if (isset($attachments) && is_array($attachments)
26 && sizeof($attachments)){
27 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
28 foreach ($attachments as $info) {
29 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
30 if (file_exists($attached_file)) {
31 unlink($attached_file);
32 }
32f4e318 33 }
34}
288491a4 35
32f4e318 36if (!isset($frame_top)) {
fb745cc7 37 $frame_top = '_top';
32f4e318 38}
d03f3582 39
32f4e318 40/* If a user hits reload on the last page, $base_uri isn't set
41 * because it was deleted with the session. */
a32985a5 42if (!isset($_SESSION['base_uri'])) {
f3bc099d 43 if (!function_exists('sqm_baseuri')){
86725763 44 require_once(SM_PATH . 'functions/display_messages.php');
f3bc099d 45 }
46 $base_uri = sqm_baseuri();
a32985a5 47} else {
48 $base_uri = $_SESSION['base_uri'];
32f4e318 49}
ceac7a2f 50
32f4e318 51do_hook('logout');
52setcookie('username', '', 0, $base_uri);
53setcookie('key', '', 0, $base_uri);
54session_destroy();
f923b93d 55
32f4e318 56if ($signout_page) {
57 header('Status: 303 See Other');
58 header("Location: $signout_page");
59 exit; /* we send no content if we're redirecting. */
60}
21c3249f 61?>
fab3baa6 62<html>
63 <head>
59177427 64<?php
32f4e318 65 if ($theme_css != '') {
8c65f339 66?>
fab3baa6 67<link rel="stylesheet" type="text/css" href="<?php echo $theme_css ?>">
8c65f339 68<?php
32f4e318 69 }
21c3249f 70?>
fab3baa6 71<title><?php echo $org_title ?> - Signout</title>
72</head>
73<body text="<?php echo $color[8] ?>" bgcolor="<?php echo $color[4] ?>"
74link="<?php echo $color[7] ?>" vlink="<?php echo $color[7] ?>"
75alink="<?php echo $color[7] ?>">
76<br><br>
77<?
78do_hook('logout_above_text');
79echo
80html_tag( 'table',
81 html_tag( 'tr',
ca52e31b 82 html_tag( 'th', _("Sign Out"), 'center' ) ,
fab3baa6 83 '', $color[0], 'width="100%"' ) .
84 html_tag( 'tr',
85 html_tag( 'td', _("You have been successfully signed out.") .
4a6bbb49 86 '<br><a href="login.php" target="' . $frame_top . '">' .
ca52e31b 87 _("Click here to log back in.") . '</a><br>' ,
fab3baa6 88 'center' ) ,
89 '', $color[4], 'width="100%"' ) .
90 html_tag( 'tr',
91 html_tag( 'td', '<br>', 'center' ) ,
92 '', $color[0], 'width="100%"' ) ,
93'center', $color[4], 'width="50%" cols="1" cellpadding="2" cellspacing="0" border="0"' )
94?>
95</body>
86725763 96</html>