3 * login.php -- simple login screen
5 * Copyright (c) 1999-2001 The Squirrelmail Development Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 * This a simple login screen. Some housekeeping is done to clean
9 * cookies and find language.
15 if (isset($emailaddress)) {
16 if (stristr($emailaddress, 'mailto:')) {
17 $rcptaddress = substr($emailaddress, 7);
19 $rcptaddress = $emailaddress;
22 if (($pos = strpos($rcptaddress, '?')) !== false) {
23 $a = substr($rcptaddress, $pos +
1);
24 $rcptaddress = substr($rcptaddress, 0, $pos);
25 $a = explode('=', $a, 2);
27 $name = urldecode($a[0]);
28 $val = urldecode($a[1]);
34 /* At this point, we have parsed a lot of the mailto stuff. */
35 /* Let's do the rest -- CC, BCC, Subject, Body */
36 /* Note: They can all be case insensitive */
37 foreach ($GLOBALS as $k => $v) {
38 $key = strtolower($k);
39 $value = urlencode($v);
41 $rcptaddress .= '&send_to_cc=' . $value;
42 } else if ($key == 'bcc') {
43 $rcptaddress .= '&send_to_bcc=' . $value;
44 } else if ($key == 'subject') {
45 $rcptaddress .= '&subject=' . $value;
46 } else if ($key == 'body') {
47 $rcptaddress .= '&body=' . $value;
51 /* Double-encode in this fashion to get past redirect.php properly. */
52 $rcptaddress = urlencode($rcptaddress);
55 require_once('../functions/strings.php');
56 require_once('../config/config.php');
57 require_once('../functions/i18n.php');
58 require_once('../functions/plugin.php');
59 require_once('../functions/constants.php');
62 * $squirrelmail_language is set by a cookie when the user selects
63 * language and logs out
65 set_up_language($squirrelmail_language, true);
67 /* Need the base URI to set the cookies. (Same code as in webmail.php). */
68 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
73 * In case the last session was not terminated properly, make sure
76 $cookie_params = session_get_cookie_params();
77 setcookie(session_name(),'',0,$cookie_params['path'].$cookie_params['domain']);
78 setcookie('username', '', 0, $base_uri);
79 setcookie('key', '', 0, $base_uri);
80 header ('Pragma: no-cache');
82 do_hook('login_cookie');
84 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' .
89 if ($theme_css != '') {
90 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">\n";
93 /* Output the javascript onload function. */
94 echo "<SCRIPT LANGUAGE=\"JavaScript\">\n" .
96 " function squirrelmail_loginpage_onload() {\n".
97 " document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON
. "';\n".
98 " document.forms[0].elements[0].focus();\n".
103 /* Set the title of this page. */
104 echo "<TITLE>$org_name - " . _("Login") . "</TITLE></HEAD>\n".
105 "<BODY TEXT=#000000 BGCOLOR=#FFFFFF LINK=#0000CC VLINK=#0000CC ALINK=#0000CC onLoad='squirrelmail_loginpage_onload();'>\n".
106 "<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n";
108 $username_form_name = 'login_username';
109 $password_form_name = 'secretkey';
110 do_hook('login_top');
112 $loginname_value = (isset($loginname) ?
htmlspecialchars($loginname) : '');
115 " <IMG SRC=\"$org_logo\"><BR>\n".
116 ( $hide_sm_attributions ?
'' :
117 '<SMALL>' . sprintf (_("SquirrelMail version %s"), $version) . "<BR>\n".
118 ' ' . _("By the SquirrelMail Development Team") . "<BR></SMALL>\n" ) .
122 "<TABLE COLS=1 WIDTH=350>\n".
123 " <TR><TD BGCOLOR=#DCDCDC>\n".
124 ' <B><CENTER>' . sprintf (_("%s Login"), $org_name) . "</CENTER></B>\n".
126 " <TR><TD BGCOLOR=\"#FFFFFF\"><TABLE COLS=2 WIDTH=\"100%\">\n".
128 ' <TD WIDTH=30% ALIGN=right>' . _("Name:") . "</TD>\n".
129 " <TD WIDTH=* ALIGN=left>\n".
130 " <INPUT TYPE=TEXT NAME=\"$username_form_name\" VALUE=\"$loginname_value\">\n".
134 ' <TD WIDTH="30%" ALIGN=right>' . _("Password:") . "</TD>\n".
135 " <TD WIDTH=* ALIGN=left>\n".
136 " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n".
137 " <INPUT TYPE=HIDDEN NAME=\"js_autodetect_results\" VALUE=\"" . SMPREF_JS_OFF
. "\">\n".
138 " <INPUT TYPE=HIDDEN NAME=\"just_logged_in\" value=1>\n";
139 if ($rcptaddress != '') {
140 echo " <INPUT TYPE=HIDDEN NAME=\"rcptemail\" VALUE=\"".htmlspecialchars($rcptaddress)."\">\n";
144 " </TABLE></TD></TR>\n".
146 ' <CENTER><INPUT TYPE=SUBMIT VALUE="' . _("Login") . "\"></CENTER>\n".
151 do_hook('login_form');
154 do_hook('login_bottom');