04ee698a4f77bf87fd524367bd6398542f4aefd7
[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 ** $Id$
12 **/
13
14 include("../functions/strings.php");
15 include("../config/config.php");
16 include('../functions/i18n.php');
17 include("../functions/plugin.php");
18
19 // $squirrelmail_language is set by a cookie when the user selects
20 // language and logs out
21 set_up_language($squirrelmail_language, true);
22
23 // Need the base URI to set the cookies. (Same code as in webmail.php)
24 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
25 $base_uri = $regs[1];
26
27 setcookie("username", '', 0, $base_uri);
28 setcookie("key", '', 0, $base_uri);
29 setcookie("logged_in", 0, 0, $base_uri);
30 header ("Pragma: no-cache");
31
32 // In case the last session was not terminated properly, make sure
33 // we get a new one.
34 $cookie_params = session_get_cookie_params();
35 setcookie(session_name(),"",0,$cookie_params["domain"].$cookie_params["path"]);
36
37 do_hook('login_cookie');
38 echo "<HTML>";
39 echo "<HEAD><TITLE>";
40 echo $org_name . " - " . _("Login");
41 echo "</TITLE></HEAD>\n";
42 echo "<BODY TEXT=000000 BGCOLOR=#FFFFFF LINK=0000CC VLINK=0000CC ALINK=0000CC>\n";
43 echo "<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n";
44
45 $username_form_name = 'login_username';
46 $password_form_name = 'secretkey';
47 do_hook('login_top');
48
49 echo "<CENTER><IMG SRC=\"$org_logo\"></CENTER>\n";
50 echo "<CENTER><SMALL>";
51 printf (_("SquirrelMail version %s"), $version);
52 echo "<BR>\n";
53 echo _("By the SquirrelMail Development Team");
54 echo "<BR></SMALL><CENTER>\n";
55 echo "<TABLE COLS=1 WIDTH=350>\n";
56 echo " <TR>\n";
57 echo " <TD BGCOLOR=#DCDCDC>\n";
58 echo " <B><CENTER>";
59 printf (_("%s Login"), $org_name);
60 echo "</CENTER></B>\n";
61 echo " </TD>\n";
62 echo " </TR><TR>\n";
63 echo " <TD BGCOLOR=#FFFFFF>\n";
64 echo " <TABLE COLS=2 WIDTH=100%>\n";
65 echo " <TR>\n";
66 echo " <TD WIDTH=30% ALIGN=right>\n";
67 echo _("Name:");
68 echo " </TD><TD WIDTH=* ALIGN=left>\n";
69 echo " <INPUT TYPE=TEXT NAME=\"$username_form_name\"";
70 if (isset($loginname))
71 echo " value=\"" . htmlspecialchars($loginname) . "\"";
72 echo ">\n";
73 echo " </TD>\n";
74 echo " </TR><TR>\n";
75 echo " <TD WIDTH=30% ALIGN=right>\n";
76 echo _("Password:");
77 echo " </TD><TD WIDTH=* ALIGN=left>\n";
78 echo " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n";
79 echo " </TD>\n";
80 if (isset($emailaddress)) {
81 if (stristr($emailaddress,"mailto:"))
82 $rcptaddress = substr ($emailaddress, 7,strlen($emailaddress)-7);
83 else
84 $rcptaddress = $emailaddress;
85 echo " <INPUT TYPE=HIDDEN NAME=\"rcptemail\" VALUE=\"".htmlspecialchars($rcptaddress)."\">\n";
86 }
87 echo " </TABLE>\n";
88 echo " </TD>\n";
89 echo " </TR><TR>\n";
90 echo " <TD>\n";
91 echo " <CENTER><INPUT TYPE=SUBMIT VALUE=\"";
92 echo _("Login");
93 echo "\"></CENTER>\n";
94 echo " </TD>\n";
95 echo " </TR>\n";
96 echo "</TABLE>\n";
97 echo "<input type=hidden name=just_logged_in value=1>\n";
98 do_hook('login_form');
99 echo "</FORM>\n";
100 do_hook("login_bottom");
101 ?>
102 </BODY>
103 </HTML>
104