"Cosmetic" patch change in commented module information.
[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
d4e84069 14 $rcptaddress = '';
15 if (isset($emailaddress)) {
16 if (stristr($emailaddress, 'mailto:'))
17 $rcptaddress = substr($emailaddress, 7);
18 else
19 $rcptaddress = $emailaddress;
870fb6d3 20
21 if (($pos = strpos($rcptaddress, '?')) !== false)
22 {
23 $a = substr($rcptaddress, $pos + 1);
24 $rcptaddress = substr($rcptaddress, 0, $pos);
25 $a = explode('=', $a, 2);
26 if (isset($a[1])) {
27 $name = urldecode($a[0]);
28 $val = urldecode($a[1]);
29 global $$name;
30 $$name = $val;
31 }
32 }
33
34 // At this point, we have parsed a lot of the mailto stuff. Let's
35 // do the rest -- CC, BCC, Subject, Body
36 // Note: They can all be case insensitive
37 foreach ($GLOBALS as $k => $v)
38 {
39 $key = strtolower($k);
40 $value = urlencode($v);
41 if ($key == 'cc')
42 $rcptaddress .= '&send_to_cc=' . $value;
43 elseif ($key == 'bcc')
44 $rcptaddress .= '&send_to_bcc=' . $value;
45 elseif ($key == 'subject')
46 $rcptaddress .= '&subject=' . $value;
47 elseif ($key == 'body')
48 $rcptaddress .= '&body=' . $value;
49 }
50
51 // Double-encode in this fashion to get past redirect.php properly
52 $rcptaddress = urlencode($rcptaddress);
d4e84069 53 }
54
f740c049 55 include("../functions/strings.php");
56 include("../config/config.php");
4f0780d0 57 include('../functions/i18n.php');
f740c049 58 include("../functions/plugin.php");
21c3249f 59
441f2d33 60 // $squirrelmail_language is set by a cookie when the user selects
61 // language and logs out
62 set_up_language($squirrelmail_language, true);
288491a4 63
c6d6fe73 64 // Need the base URI to set the cookies. (Same code as in webmail.php)
65 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
66 $base_uri = $regs[1];
67
09bb89f7 68 setcookie("username", '', 0, $base_uri);
69 setcookie("key", '', 0, $base_uri);
f64a4dca 70 header ("Pragma: no-cache");
c6d6fe73 71
72 // In case the last session was not terminated properly, make sure
73 // we get a new one.
23a8095f 74 $cookie_params = session_get_cookie_params();
75 setcookie(session_name(),"",0,$cookie_params["domain"].$cookie_params["path"]);
c6d6fe73 76
901d125e 77 do_hook('login_cookie');
288491a4 78 echo "<HTML>";
79 echo "<HEAD><TITLE>";
0e743004 80 echo $org_name . " - " . _("Login");
288491a4 81 echo "</TITLE></HEAD>\n";
175e7218 82 echo "<BODY TEXT=000000 BGCOLOR=#FFFFFF LINK=0000CC VLINK=0000CC ALINK=0000CC>\n";
f644ad10 83 echo "<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n";
1899535f 84
09bb89f7 85 $username_form_name = 'login_username';
1899535f 86 $password_form_name = 'secretkey';
87 do_hook('login_top');
88
d61936fe 89 echo "<CENTER><IMG SRC=\"$org_logo\"></CENTER>\n";
aae41ae9 90 echo "<CENTER><SMALL>";
d10eeaf8 91 printf (_("SquirrelMail version %s"), $version);
92 echo "<BR>\n";
93 echo _("By the SquirrelMail Development Team");
aae41ae9 94 echo "<BR></SMALL><CENTER>\n";
21c3249f 95 echo "<TABLE COLS=1 WIDTH=350>\n";
96 echo " <TR>\n";
175e7218 97 echo " <TD BGCOLOR=#DCDCDC>\n";
d10eeaf8 98 echo " <B><CENTER>";
99 printf (_("%s Login"), $org_name);
100 echo "</CENTER></B>\n";
21c3249f 101 echo " </TD>\n";
102 echo " </TR><TR>\n";
175e7218 103 echo " <TD BGCOLOR=#FFFFFF>\n";
21c3249f 104 echo " <TABLE COLS=2 WIDTH=100%>\n";
105 echo " <TR>\n";
106 echo " <TD WIDTH=30% ALIGN=right>\n";
67c62ef9 107 echo _("Name:");
21c3249f 108 echo " </TD><TD WIDTH=* ALIGN=left>\n";
e1f548e8 109 echo " <INPUT TYPE=TEXT NAME=\"$username_form_name\"";
110 if (isset($loginname))
111 echo " value=\"" . htmlspecialchars($loginname) . "\"";
112 echo ">\n";
21c3249f 113 echo " </TD>\n";
114 echo " </TR><TR>\n";
115 echo " <TD WIDTH=30% ALIGN=right>\n";
67c62ef9 116 echo _("Password:");
21c3249f 117 echo " </TD><TD WIDTH=* ALIGN=left>\n";
1899535f 118 echo " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n";
6978d355 119 echo " </TD>\n";
d4e84069 120 if ($rcptaddress != '') {
6978d355 121 echo " <INPUT TYPE=HIDDEN NAME=\"rcptemail\" VALUE=\"".htmlspecialchars($rcptaddress)."\">\n";
122 }
21c3249f 123 echo " </TABLE>\n";
124 echo " </TD>\n";
125 echo " </TR><TR>\n";
126 echo " <TD>\n";
67c62ef9 127 echo " <CENTER><INPUT TYPE=SUBMIT VALUE=\"";
128 echo _("Login");
9ee3e401 129 echo "\"></CENTER>\n";
21c3249f 130 echo " </TD>\n";
131 echo " </TR>\n";
132 echo "</TABLE>\n";
a37f3771 133 echo "<input type=hidden name=just_logged_in value=1>\n";
901d125e 134 do_hook('login_form');
21c3249f 135 echo "</FORM>\n";
06ad27a2 136 do_hook("login_bottom");
21c3249f 137?>
21c3249f 138</BODY>
139</HTML>
140