e3ebf8022026e8cf7eeb650cd01cf7391471aea0
4 ** redirect.php -- derived from webmail.php by Ralf Kraudelt
5 ** kraude@wiwi.uni-rostock.de
7 ** Copyright (c) 1999-2000 ...
8 ** Licensed under the GNU GPL. For full terms see the file COPYING.
10 ** prevents users from reposting their form data after a
16 include('../functions/i18n.php');
17 include ('../functions/strings.php');
18 include('../config/config.php');
20 // Before starting the session, the base URI must be known.
21 // Assuming that this file is in the src/ subdirectory (or
23 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
26 header('Pragma: no-cache');
27 $location = get_location();
29 session_set_cookie_params (0, $base_uri);
32 session_unregister ('user_is_logged_in');
33 session_register ('base_uri');
35 if(!isset($login_username)) {
36 echo "<html><body bgcolor=\"ffffff\">\n";
39 echo "<b>"._("You must be logged in to access this page.")."</b><br>";
40 echo "<a href=\"../src/login.php\">"._("Go to the login page")."</a>\n";
42 echo "</body></html>\n";
46 // Refresh the language cookie.
47 if (isset($squirrelmail_language)) {
48 setcookie('squirrelmail_language', $squirrelmail_language, time()+
2592000);
52 include ('../functions/prefs.php');
53 include ('../functions/imap.php');
54 include ('../functions/plugin.php');
56 if (!session_is_registered('user_is_logged_in') ||
$logged_in != 1) {
57 do_hook ('login_before');
59 $onetimepad = OneTimePadCreate(strlen($secretkey));
60 $key = OneTimePadEncrypt($secretkey, $onetimepad);
61 session_register('onetimepad');
62 // verify that username and password are correct
63 if ($force_username_lowercase)
64 $login_username = strtolower($login_username);
65 $imapConnection = sqimap_login($login_username, $key, $imapServerAddress, $imapPort, 0);
66 if (!$imapConnection) {
67 echo "<html><body bgcolor=\"ffffff\">\n";
70 echo "<b>"._("There was an error contacting the mail server.")."</b><br>";
71 echo _("Contact your administrator for help.")."\n";
73 echo "</body></html>\n";
76 sqimap_logout($imapConnection);
78 setcookie('username', $login_username, 0, $base_uri);
79 setcookie('key', $key, 0, $base_uri);
80 setcookie('logged_in', 1, 0, $base_uri);
81 do_hook ('login_verified');
84 $user_is_logged_in = true;
85 session_register ('user_is_logged_in');
88 header("Location: webmail.php?right_frame=compose.php&rcptaddress=$rcptemail");
90 header("Location: webmail.php");