* Moved load_prefs.php and display_page.php (or whatever it is called) into
[squirrelmail.git] / src / signout.php
1 <?php
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 **
11 ** $Id$
12 **/
13
14 include('../src/validate.php');
15 include ('../functions/prefs.php');
16 include ('../functions/plugin.php');
17
18 // Erase any lingering attachments
19 if (! isset($attachments)) {
20 $attachments = array();
21 }
22 foreach ($attachments as $info) {
23 if (file_exists($attachment_dir . $info['localfilename'])) {
24 unlink($attachment_dir . $info['localfilename']);
25 }
26 }
27
28 // If a user hits reload on the last page, $base_uri isn't set
29 // because it was deleted with the session.
30 if (! isset($base_uri)) {
31 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
32 $base_uri = $regs[1];
33 }
34
35 do_hook('logout');
36 setcookie('username', '', 0, $base_uri);
37 setcookie('key', '', 0, $base_uri);
38 setcookie('logged_in', '', 0, $base_uri);
39 session_destroy();
40
41 if ($signout_page) {
42 header("Status: 303 See Other");
43 header("Location: $signout_page");
44 exit; /* we send no content if we're redirecting. */
45 }
46 ?>
47 <HTML>
48 <HEAD>
49 <?php
50 if ($theme_css != '') {
51 ?>
52 <LINK REL="stylesheet" TYPE="text/css" HREF="<?php echo $theme_css ?>">
53 <?php
54 }
55 ?>
56 <TITLE><?php echo $org_title ?> - Signout</TITLE>
57 </HEAD>
58 <BODY TEXT="<?php echo $color[8] ?>" BGCOLOR="<?php echo $color[4] ?>"
59 LINK="<?php echo $color[7] ?>" VLINK="<?php echo $color[7] ?>" A
60 LINK="<?php echo $color[7] ?>">
61 <BR><BR>
62 <TABLE BGCOLOR="FFFFFF" BORDER="0" COLS="1" WIDTH="50%" CELLSPACING="0"
63 CELLPADDING="2" ALIGN="CENTER">
64 <TR BGCOLOR="<?php echo $color[0] ?>" WIDTH=100%>
65 <TD ALIGN="CENTER">
66 <B><?php echo _("Sign Out") ?></B>
67 </TD>
68 </TR>
69 <TR BGCOLOR="<?php echo $color[4] ?>" WIDTH=100%>
70 <TD ALIGN="CENTER">
71 <?php echo _("You have been successfully signed out.") ?><BR>
72 <A HREF="login.php" TARGET="_top">
73 <?php echo _("Click here to log back in.") ?>
74 </A><BR><BR>
75 </TD>
76 </TR>
77 <TR BGCOLOR="<?php echo $color[0] ?>" WIDTH=100%>
78 <TD ALIGN="CENTER">
79 <BR>
80 </TD>
81 </TR>
82 </TABLE>
83 </BODY>
84 </HTML>