-fix for Bug 112604
[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
03ff39b2 22 // let's check to see if they compiled with gettext support
23 if (!function_exists("_")) {
24 function _($string) {
25 return $string;
26 }
27 } else {
28 // $squirrelmail_language is set by a cookie when the user selects
d10eeaf8 29 // language and logs out
30
31 // Use HTTP content language negotiation if cookie not set
32 if (!isset($squirrelmail_language) && isset($HTTP_ACCEPT_LANGUAGE)) {
33 $squirrelmail_language = substr($HTTP_ACCEPT_LANGUAGE, 0, 2);
34 }
35
03ff39b2 36 if (isset($squirrelmail_language)) {
d10eeaf8 37 if ($squirrelmail_language != "en" && $squirrelmail_language != "") {
38 putenv("LC_ALL=".$squirrelmail_language);
03ff39b2 39 bindtextdomain("squirrelmail", "../locale/");
40 textdomain("squirrelmail");
d10eeaf8 41 header ("Content-Type: text/html; charset=".$languages[$squirrelmail_language]["CHARSET"]);
03ff39b2 42 }
288491a4 43 }
44 }
45
c6d6fe73 46 // Need the base URI to set the cookies. (Same code as in webmail.php)
47 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
48 $base_uri = $regs[1];
49
50 setcookie("username", "", 0, $base_uri);
51 setcookie("key", "", 0, $base_uri);
52 setcookie("logged_in", 0, 0, $base_uri);
53
54 // In case the last session was not terminated properly, make sure
55 // we get a new one.
56 setcookie("PHPSESSID", "", 0, $base_uri);
57
288491a4 58 echo "<HTML>";
59 echo "<HEAD><TITLE>";
0e743004 60 echo $org_name . " - " . _("Login");
288491a4 61 echo "</TITLE></HEAD>\n";
175e7218 62 echo "<BODY TEXT=000000 BGCOLOR=#FFFFFF LINK=0000CC VLINK=0000CC ALINK=0000CC>\n";
eb507349 63
2a32fc83 64 echo "<FORM ACTION=\"webmail.php\" METHOD=\"POST\" NAME=f>\n";
21c3249f 65 echo "<CENTER><IMG SRC=\"$org_logo\"</CENTER>\n";
aae41ae9 66 echo "<CENTER><SMALL>";
d10eeaf8 67 printf (_("SquirrelMail version %s"), $version);
68 echo "<BR>\n";
69 echo _("By the SquirrelMail Development Team");
aae41ae9 70 echo "<BR></SMALL><CENTER>\n";
21c3249f 71 echo "<TABLE COLS=1 WIDTH=350>\n";
72 echo " <TR>\n";
175e7218 73 echo " <TD BGCOLOR=#DCDCDC>\n";
d10eeaf8 74 echo " <B><CENTER>";
75 printf (_("%s Login"), $org_name);
76 echo "</CENTER></B>\n";
21c3249f 77 echo " </TD>\n";
78 echo " </TR><TR>\n";
175e7218 79 echo " <TD BGCOLOR=#FFFFFF>\n";
21c3249f 80 echo " <TABLE COLS=2 WIDTH=100%>\n";
81 echo " <TR>\n";
82 echo " <TD WIDTH=30% ALIGN=right>\n";
67c62ef9 83 echo _("Name:");
21c3249f 84 echo " </TD><TD WIDTH=* ALIGN=left>\n";
06e9d3da 85 echo " <INPUT TYPE=TEXT NAME=username>\n";
21c3249f 86 echo " </TD>\n";
87 echo " </TR><TR>\n";
88 echo " <TD WIDTH=30% ALIGN=right>\n";
67c62ef9 89 echo _("Password:");
21c3249f 90 echo " </TD><TD WIDTH=* ALIGN=left>\n";
52eefafc 91 echo " <INPUT TYPE=PASSWORD NAME=secretkey>\n";
21c3249f 92 echo " </TD>\n";
93 echo " </TABLE>\n";
94 echo " </TD>\n";
95 echo " </TR><TR>\n";
96 echo " <TD>\n";
67c62ef9 97 echo " <CENTER><INPUT TYPE=SUBMIT VALUE=\"";
98 echo _("Login");
9ee3e401 99 echo "\"></CENTER>\n";
21c3249f 100 echo " </TD>\n";
101 echo " </TR>\n";
102 echo "</TABLE>\n";
a37f3771 103 echo "<input type=hidden name=just_logged_in value=1>\n";
21c3249f 104 echo "</FORM>\n";
06ad27a2 105 do_hook("login_bottom");
21c3249f 106?>
21c3249f 107</BODY>
108</HTML>
109