* Uses a function to output the string
[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 **
2b40637c 11 ** $Id$
21c3249f 12 **/
13
f740c049 14 include("../functions/strings.php");
15 include("../config/config.php");
4f0780d0 16 include('../functions/i18n.php');
f740c049 17 include("../functions/plugin.php");
21c3249f 18
441f2d33 19 // $squirrelmail_language is set by a cookie when the user selects
20 // language and logs out
21 set_up_language($squirrelmail_language, true);
288491a4 22
c6d6fe73 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
09bb89f7 27 setcookie("username", '', 0, $base_uri);
28 setcookie("key", '', 0, $base_uri);
c6d6fe73 29 setcookie("logged_in", 0, 0, $base_uri);
f64a4dca 30 header ("Pragma: no-cache");
c6d6fe73 31
32 // In case the last session was not terminated properly, make sure
33 // we get a new one.
23a8095f 34 $cookie_params = session_get_cookie_params();
35 setcookie(session_name(),"",0,$cookie_params["domain"].$cookie_params["path"]);
c6d6fe73 36
901d125e 37 do_hook('login_cookie');
288491a4 38 echo "<HTML>";
39 echo "<HEAD><TITLE>";
0e743004 40 echo $org_name . " - " . _("Login");
288491a4 41 echo "</TITLE></HEAD>\n";
175e7218 42 echo "<BODY TEXT=000000 BGCOLOR=#FFFFFF LINK=0000CC VLINK=0000CC ALINK=0000CC>\n";
f644ad10 43 echo "<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n";
1899535f 44
09bb89f7 45 $username_form_name = 'login_username';
1899535f 46 $password_form_name = 'secretkey';
47 do_hook('login_top');
48
d61936fe 49 echo "<CENTER><IMG SRC=\"$org_logo\"></CENTER>\n";
aae41ae9 50 echo "<CENTER><SMALL>";
d10eeaf8 51 printf (_("SquirrelMail version %s"), $version);
52 echo "<BR>\n";
53 echo _("By the SquirrelMail Development Team");
aae41ae9 54 echo "<BR></SMALL><CENTER>\n";
21c3249f 55 echo "<TABLE COLS=1 WIDTH=350>\n";
56 echo " <TR>\n";
175e7218 57 echo " <TD BGCOLOR=#DCDCDC>\n";
d10eeaf8 58 echo " <B><CENTER>";
59 printf (_("%s Login"), $org_name);
60 echo "</CENTER></B>\n";
21c3249f 61 echo " </TD>\n";
62 echo " </TR><TR>\n";
175e7218 63 echo " <TD BGCOLOR=#FFFFFF>\n";
21c3249f 64 echo " <TABLE COLS=2 WIDTH=100%>\n";
65 echo " <TR>\n";
66 echo " <TD WIDTH=30% ALIGN=right>\n";
67c62ef9 67 echo _("Name:");
21c3249f 68 echo " </TD><TD WIDTH=* ALIGN=left>\n";
e1f548e8 69 echo " <INPUT TYPE=TEXT NAME=\"$username_form_name\"";
70 if (isset($loginname))
71 echo " value=\"" . htmlspecialchars($loginname) . "\"";
72 echo ">\n";
21c3249f 73 echo " </TD>\n";
74 echo " </TR><TR>\n";
75 echo " <TD WIDTH=30% ALIGN=right>\n";
67c62ef9 76 echo _("Password:");
21c3249f 77 echo " </TD><TD WIDTH=* ALIGN=left>\n";
1899535f 78 echo " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n";
6978d355 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 }
21c3249f 87 echo " </TABLE>\n";
88 echo " </TD>\n";
89 echo " </TR><TR>\n";
90 echo " <TD>\n";
67c62ef9 91 echo " <CENTER><INPUT TYPE=SUBMIT VALUE=\"";
92 echo _("Login");
9ee3e401 93 echo "\"></CENTER>\n";
21c3249f 94 echo " </TD>\n";
95 echo " </TR>\n";
96 echo "</TABLE>\n";
a37f3771 97 echo "<input type=hidden name=just_logged_in value=1>\n";
901d125e 98 do_hook('login_form');
21c3249f 99 echo "</FORM>\n";
06ad27a2 100 do_hook("login_bottom");
21c3249f 101?>
21c3249f 102</BODY>
103</HTML>
104