Fixed ary_sort problem.
[squirrelmail.git] / src / login.php
1 <?php
2 /**
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.
7 **
8 ** This a simple login screen. Some housekeeping is done to clean
9 ** cookies and find language.
10 **
11 **/
12
13 if (!isset($config_php))
14 include("../config/config.php");
15 if (!isset($strings_php))
16 include("../functions/strings.php");
17 if (!isset($i18n_php))
18 include("../functions/i18n.php");
19 if (!isset($plugin_php))
20 include("../functions/plugin.php");
21
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
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
36 if (isset($squirrelmail_language)) {
37 if ($squirrelmail_language != "en" && $squirrelmail_language != "") {
38 putenv("LC_ALL=".$squirrelmail_language);
39 bindtextdomain("squirrelmail", "../locale/");
40 textdomain("squirrelmail");
41 header ("Content-Type: text/html; charset=".$languages[$squirrelmail_language]["CHARSET"]);
42 }
43 }
44 }
45
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
58 echo "<HTML>";
59 echo "<HEAD><TITLE>";
60 echo $org_name . " - " . _("Login");
61 echo "</TITLE></HEAD>\n";
62 echo "<BODY TEXT=000000 BGCOLOR=#FFFFFF LINK=0000CC VLINK=0000CC ALINK=0000CC>\n";
63 echo "<FORM ACTION=\"webmail.php\" METHOD=\"POST\" NAME=f>\n";
64
65 $username_form_name = 'username';
66 $password_form_name = 'secretkey';
67 do_hook('login_top');
68
69 echo "<CENTER><IMG SRC=\"$org_logo\"</CENTER>\n";
70 echo "<CENTER><SMALL>";
71 printf (_("SquirrelMail version %s"), $version);
72 echo "<BR>\n";
73 echo _("By the SquirrelMail Development Team");
74 echo "<BR></SMALL><CENTER>\n";
75 echo "<TABLE COLS=1 WIDTH=350>\n";
76 echo " <TR>\n";
77 echo " <TD BGCOLOR=#DCDCDC>\n";
78 echo " <B><CENTER>";
79 printf (_("%s Login"), $org_name);
80 echo "</CENTER></B>\n";
81 echo " </TD>\n";
82 echo " </TR><TR>\n";
83 echo " <TD BGCOLOR=#FFFFFF>\n";
84 echo " <TABLE COLS=2 WIDTH=100%>\n";
85 echo " <TR>\n";
86 echo " <TD WIDTH=30% ALIGN=right>\n";
87 echo _("Name:");
88 echo " </TD><TD WIDTH=* ALIGN=left>\n";
89 echo " <INPUT TYPE=TEXT NAME=\"$username_form_name\">\n";
90 echo " </TD>\n";
91 echo " </TR><TR>\n";
92 echo " <TD WIDTH=30% ALIGN=right>\n";
93 echo _("Password:");
94 echo " </TD><TD WIDTH=* ALIGN=left>\n";
95 echo " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n";
96 echo " </TD>\n";
97 echo " </TABLE>\n";
98 echo " </TD>\n";
99 echo " </TR><TR>\n";
100 echo " <TD>\n";
101 echo " <CENTER><INPUT TYPE=SUBMIT VALUE=\"";
102 echo _("Login");
103 echo "\"></CENTER>\n";
104 echo " </TD>\n";
105 echo " </TR>\n";
106 echo "</TABLE>\n";
107 echo "<input type=hidden name=just_logged_in value=1>\n";
108 echo "</FORM>\n";
109 do_hook("login_bottom");
110 ?>
111 </BODY>
112 </HTML>
113