* To reduce on errors, I moved the includes for config.php and strings.php
[squirrelmail.git] / src / signout.php
CommitLineData
59177427 1<?php
c6d6fe73 2 /**
3 ** signout.php -- cleans up session and logs the user out
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** Cleans up after the user. Resets cookies and terminates
9 ** session.
10 **
245a6892 11 ** $Id$
c6d6fe73 12 **/
8b522a59 13
f740c049 14 include('../src/validate.php');
91dc6e4e 15 include ('../src/load_prefs.php');
f740c049 16 include ('../functions/prefs.php');
17 include ('../functions/plugin.php');
18
f740c049 19 // Erase any lingering attachments
cf6c6275 20 if (! isset($attachments)) {
5c263f27 21 $attachments = array();
cf6c6275 22 }
23 foreach ($attachments as $info) {
24 if (file_exists($attachment_dir . $info['localfilename'])) {
f740c049 25 unlink($attachment_dir . $info['localfilename']);
26 }
27 }
91dc6e4e 28 set_up_language(getPref($data_dir, $username, 'language'));
288491a4 29
ceac7a2f 30 // If a user hits reload on the last page, $base_uri isn't set
31 // because it was deleted with the session.
cf6c6275 32 if (! isset($base_uri)) {
ceac7a2f 33 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
34 $base_uri = $regs[1];
35 }
36
91dc6e4e 37 do_hook('logout');
38 setcookie('username', '', 0, $base_uri);
39 setcookie('key', '', 0, $base_uri);
40 setcookie('logged_in', '', 0, $base_uri);
9f2215a1 41 session_destroy();
f923b93d 42
43 if ($signout_page) {
44 header("Status: 303 See Other");
45 header("Location: $signout_page");
46 exit; /* we send no content if we're redirecting. */
47 }
21c3249f 48?>
49<HTML>
e90872be 50 <HEAD>
59177427 51<?php
91dc6e4e 52 if ($theme_css != '') {
8c65f339 53?>
cab59568 54<LINK REL="stylesheet" TYPE="text/css" HREF="<?php echo $theme_css ?>">
8c65f339 55<?php
e90872be 56 }
21c3249f 57?>
8437bc78 58<TITLE><?php echo $org_title ?> - Signout</TITLE>
8c65f339 59</HEAD>
8437bc78 60<BODY TEXT="<?php echo $color[8] ?>" BGCOLOR="<?php echo $color[4] ?>"
61LINK="<?php echo $color[7] ?>" VLINK="<?php echo $color[7] ?>" A
62LINK="<?php echo $color[7] ?>">
8c65f339 63<BR><BR>
64<TABLE BGCOLOR="FFFFFF" BORDER="0" COLS="1" WIDTH="50%" CELLSPACING="0"
65CELLPADDING="2" ALIGN="CENTER">
8437bc78 66 <TR BGCOLOR="<?php echo $color[0] ?>" WIDTH=100%>
8c65f339 67 <TD ALIGN="CENTER">
8437bc78 68 <B><?php echo _("Sign Out") ?></B>
8c65f339 69 </TD>
70 </TR>
8437bc78 71 <TR BGCOLOR="<?php echo $color[4] ?>" WIDTH=100%>
8c65f339 72 <TD ALIGN="CENTER">
8437bc78 73 <?php echo _("You have been successfully signed out.") ?><BR>
74 <A HREF="login.php" TARGET="_top">
75 <?php echo _("Click here to log back in.") ?>
8c65f339 76 </A><BR><BR>
77 </TD>
78 </TR>
8437bc78 79 <TR BGCOLOR="<?php echo $color[0] ?>" WIDTH=100%>
8c65f339 80 <TD ALIGN="CENTER">
81 <BR>
82 </TD>
83 </TR>
84</TABLE>
21c3249f 85</BODY>
86</HTML>