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