Fixed problem where $username was being overwritten with the cookie's value
[squirrelmail.git] / src / login.php
CommitLineData
59177427 1<?php
21c3249f 2 /**
c6d6fe73 3 ** login.php -- simple login screen
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
21c3249f 7 **
c6d6fe73 8 ** This a simple login screen. Some housekeeping is done to clean
9 ** cookies and find language.
21c3249f 10 **
11 **/
12
d068c0ec 13 if (!isset($config_php))
14 include("../config/config.php");
15 if (!isset($strings_php))
16 include("../functions/strings.php");
d10eeaf8 17 if (!isset($i18n_php))
18 include("../functions/i18n.php");
d7d3c4d4 19 if (!isset($plugin_php))
20 include("../functions/plugin.php");
21c3249f 21
441f2d33 22 // $squirrelmail_language is set by a cookie when the user selects
23 // language and logs out
24 set_up_language($squirrelmail_language, true);
288491a4 25
c6d6fe73 26 // Need the base URI to set the cookies. (Same code as in webmail.php)
27 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
28 $base_uri = $regs[1];
29
09bb89f7 30 setcookie("username", '', 0, $base_uri);
31 setcookie("key", '', 0, $base_uri);
c6d6fe73 32 setcookie("logged_in", 0, 0, $base_uri);
33
34 // In case the last session was not terminated properly, make sure
35 // we get a new one.
23a8095f 36 $cookie_params = session_get_cookie_params();
37 setcookie(session_name(),"",0,$cookie_params["domain"].$cookie_params["path"]);
c6d6fe73 38
288491a4 39 echo "<HTML>";
40 echo "<HEAD><TITLE>";
0e743004 41 echo $org_name . " - " . _("Login");
288491a4 42 echo "</TITLE></HEAD>\n";
175e7218 43 echo "<BODY TEXT=000000 BGCOLOR=#FFFFFF LINK=0000CC VLINK=0000CC ALINK=0000CC>\n";
f644ad10 44 echo "<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n";
1899535f 45
09bb89f7 46 $username_form_name = 'login_username';
1899535f 47 $password_form_name = 'secretkey';
48 do_hook('login_top');
49
21c3249f 50 echo "<CENTER><IMG SRC=\"$org_logo\"</CENTER>\n";
aae41ae9 51 echo "<CENTER><SMALL>";
d10eeaf8 52 printf (_("SquirrelMail version %s"), $version);
53 echo "<BR>\n";
54 echo _("By the SquirrelMail Development Team");
aae41ae9 55 echo "<BR></SMALL><CENTER>\n";
21c3249f 56 echo "<TABLE COLS=1 WIDTH=350>\n";
57 echo " <TR>\n";
175e7218 58 echo " <TD BGCOLOR=#DCDCDC>\n";
d10eeaf8 59 echo " <B><CENTER>";
60 printf (_("%s Login"), $org_name);
61 echo "</CENTER></B>\n";
21c3249f 62 echo " </TD>\n";
63 echo " </TR><TR>\n";
175e7218 64 echo " <TD BGCOLOR=#FFFFFF>\n";
21c3249f 65 echo " <TABLE COLS=2 WIDTH=100%>\n";
66 echo " <TR>\n";
67 echo " <TD WIDTH=30% ALIGN=right>\n";
67c62ef9 68 echo _("Name:");
21c3249f 69 echo " </TD><TD WIDTH=* ALIGN=left>\n";
1899535f 70 echo " <INPUT TYPE=TEXT NAME=\"$username_form_name\">\n";
21c3249f 71 echo " </TD>\n";
72 echo " </TR><TR>\n";
73 echo " <TD WIDTH=30% ALIGN=right>\n";
67c62ef9 74 echo _("Password:");
21c3249f 75 echo " </TD><TD WIDTH=* ALIGN=left>\n";
1899535f 76 echo " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n";
21c3249f 77 echo " </TD>\n";
78 echo " </TABLE>\n";
79 echo " </TD>\n";
80 echo " </TR><TR>\n";
81 echo " <TD>\n";
67c62ef9 82 echo " <CENTER><INPUT TYPE=SUBMIT VALUE=\"";
83 echo _("Login");
9ee3e401 84 echo "\"></CENTER>\n";
21c3249f 85 echo " </TD>\n";
86 echo " </TR>\n";
87 echo "</TABLE>\n";
a37f3771 88 echo "<input type=hidden name=just_logged_in value=1>\n";
21c3249f 89 echo "</FORM>\n";
06ad27a2 90 do_hook("login_bottom");
21c3249f 91?>
21c3249f 92</BODY>
93</HTML>
94