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