Fixed login header.
[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
ff8a98e7 55 require_once('../functions/strings.php');
56 require_once('../config/config.php');
57 require_once('../functions/i18n.php');
58 require_once('../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');
1bfeac81 78
79 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' .
80 "\n\n" .
81 "<HTML>\n" .
82 "<HEAD>\n";
83
84 if ($theme_css != "")
85 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">\n";
86
87 echo "<TITLE>";
0e743004 88 echo $org_name . " - " . _("Login");
288491a4 89 echo "</TITLE></HEAD>\n";
175e7218 90 echo "<BODY TEXT=000000 BGCOLOR=#FFFFFF LINK=0000CC VLINK=0000CC ALINK=0000CC>\n";
f644ad10 91 echo "<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n";
1899535f 92
09bb89f7 93 $username_form_name = 'login_username';
1899535f 94 $password_form_name = 'secretkey';
95 do_hook('login_top');
96
d61936fe 97 echo "<CENTER><IMG SRC=\"$org_logo\"></CENTER>\n";
aae41ae9 98 echo "<CENTER><SMALL>";
d10eeaf8 99 printf (_("SquirrelMail version %s"), $version);
100 echo "<BR>\n";
101 echo _("By the SquirrelMail Development Team");
aae41ae9 102 echo "<BR></SMALL><CENTER>\n";
21c3249f 103 echo "<TABLE COLS=1 WIDTH=350>\n";
104 echo " <TR>\n";
175e7218 105 echo " <TD BGCOLOR=#DCDCDC>\n";
d10eeaf8 106 echo " <B><CENTER>";
107 printf (_("%s Login"), $org_name);
108 echo "</CENTER></B>\n";
21c3249f 109 echo " </TD>\n";
110 echo " </TR><TR>\n";
175e7218 111 echo " <TD BGCOLOR=#FFFFFF>\n";
21c3249f 112 echo " <TABLE COLS=2 WIDTH=100%>\n";
113 echo " <TR>\n";
114 echo " <TD WIDTH=30% ALIGN=right>\n";
67c62ef9 115 echo _("Name:");
21c3249f 116 echo " </TD><TD WIDTH=* ALIGN=left>\n";
e1f548e8 117 echo " <INPUT TYPE=TEXT NAME=\"$username_form_name\"";
118 if (isset($loginname))
119 echo " value=\"" . htmlspecialchars($loginname) . "\"";
120 echo ">\n";
21c3249f 121 echo " </TD>\n";
122 echo " </TR><TR>\n";
123 echo " <TD WIDTH=30% ALIGN=right>\n";
67c62ef9 124 echo _("Password:");
21c3249f 125 echo " </TD><TD WIDTH=* ALIGN=left>\n";
1899535f 126 echo " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n";
6978d355 127 echo " </TD>\n";
d4e84069 128 if ($rcptaddress != '') {
6978d355 129 echo " <INPUT TYPE=HIDDEN NAME=\"rcptemail\" VALUE=\"".htmlspecialchars($rcptaddress)."\">\n";
130 }
f23778ac 131 echo " </TR>\n";
21c3249f 132 echo " </TABLE>\n";
133 echo " </TD>\n";
134 echo " </TR><TR>\n";
135 echo " <TD>\n";
67c62ef9 136 echo " <CENTER><INPUT TYPE=SUBMIT VALUE=\"";
137 echo _("Login");
9ee3e401 138 echo "\"></CENTER>\n";
21c3249f 139 echo " </TD>\n";
140 echo " </TR>\n";
141 echo "</TABLE>\n";
a37f3771 142 echo "<input type=hidden name=just_logged_in value=1>\n";
901d125e 143 do_hook('login_form');
21c3249f 144 echo "</FORM>\n";
06ad27a2 145 do_hook("login_bottom");
21c3249f 146?>
21c3249f 147</BODY>
148</HTML>
149