"Kent B. Hansen" <kent@tpv.dk> & r2l by Yoav
[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
35586184 14require_once('../src/validate.php');
15require_once('../functions/prefs.php');
16require_once('../functions/plugin.php');
46d38f78 17require_once('../functions/strings.php');
f740c049 18
32f4e318 19/* Erase any lingering attachments */
fb745cc7 20if (isset($attachments) && is_array($attachments)
21 && sizeof($attachments)){
22 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
23 foreach ($attachments as $info) {
24 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
25 if (file_exists($attached_file)) {
26 unlink($attached_file);
27 }
32f4e318 28 }
29}
288491a4 30
32f4e318 31if (!isset($frame_top)) {
fb745cc7 32 $frame_top = '_top';
32f4e318 33}
d03f3582 34
32f4e318 35/* If a user hits reload on the last page, $base_uri isn't set
36 * because it was deleted with the session. */
85b454a0 37if (!isset($base_uri)) {
f3bc099d 38 if (!function_exists('sqm_baseuri')){
39 require_once('../functions/display_messages.php');
40 }
41 $base_uri = sqm_baseuri();
32f4e318 42}
ceac7a2f 43
32f4e318 44do_hook('logout');
45setcookie('username', '', 0, $base_uri);
46setcookie('key', '', 0, $base_uri);
47session_destroy();
f923b93d 48
32f4e318 49if ($signout_page) {
50 header('Status: 303 See Other');
51 header("Location: $signout_page");
52 exit; /* we send no content if we're redirecting. */
53}
21c3249f 54?>
55<HTML>
e90872be 56 <HEAD>
59177427 57<?php
32f4e318 58 if ($theme_css != '') {
8c65f339 59?>
cab59568 60<LINK REL="stylesheet" TYPE="text/css" HREF="<?php echo $theme_css ?>">
8c65f339 61<?php
32f4e318 62 }
21c3249f 63?>
8437bc78 64<TITLE><?php echo $org_title ?> - Signout</TITLE>
8c65f339 65</HEAD>
8437bc78 66<BODY TEXT="<?php echo $color[8] ?>" BGCOLOR="<?php echo $color[4] ?>"
cf6df86f 67LINK="<?php echo $color[7] ?>" VLINK="<?php echo $color[7] ?>"
68ALINK="<?php echo $color[7] ?>">
8c65f339 69<BR><BR>
26f277a6 70<TABLE BGCOLOR="<?php echo $color[4]; ?>" BORDER="0" COLS="1" WIDTH="50%" CELLSPACING="0"
8c65f339 71CELLPADDING="2" ALIGN="CENTER">
bd9bbfef 72 <TR BGCOLOR="<?php echo $color[0] ?>" WIDTH="100%">
8c65f339 73 <TD ALIGN="CENTER">
8437bc78 74 <B><?php echo _("Sign Out") ?></B>
8c65f339 75 </TD>
76 </TR>
bd9bbfef 77 <TR BGCOLOR="<?php echo $color[4] ?>" WIDTH="100%">
8c65f339 78 <TD ALIGN="CENTER">
cf6df86f 79 <?php do_hook('logout_above_text'); ?>
8437bc78 80 <?php echo _("You have been successfully signed out.") ?><BR>
e27195f7 81 <A HREF="login.php" TARGET="<?php echo $frame_top ?>">
8437bc78 82 <?php echo _("Click here to log back in.") ?>
8c65f339 83 </A><BR><BR>
84 </TD>
85 </TR>
bd9bbfef 86 <TR BGCOLOR="<?php echo $color[0] ?>" WIDTH="100%">
8c65f339 87 <TD ALIGN="CENTER">
88 <BR>
89 </TD>
90 </TR>
91</TABLE>
21c3249f 92</BODY>
32f4e318 93</HTML>