4 * login.php -- simple login screen
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This a simple login screen. Some housekeeping is done to clean
10 * cookies and find language.
16 if (isset($emailaddress)) {
17 if (stristr($emailaddress, 'mailto:')) {
18 $rcptaddress = substr($emailaddress, 7);
20 $rcptaddress = $emailaddress;
23 if (($pos = strpos($rcptaddress, '?')) !== false) {
24 $a = substr($rcptaddress, $pos +
1);
25 $rcptaddress = substr($rcptaddress, 0, $pos);
26 $a = explode('=', $a, 2);
28 $name = urldecode($a[0]);
29 $val = urldecode($a[1]);
35 /* At this point, we have parsed a lot of the mailto stuff. */
36 /* Let's do the rest -- CC, BCC, Subject, Body */
37 /* Note: They can all be case insensitive */
38 foreach ($GLOBALS as $k => $v) {
39 $key = strtolower($k);
40 $value = urlencode($v);
42 $rcptaddress .= '&send_to_cc=' . $value;
43 } else if ($key == 'bcc') {
44 $rcptaddress .= '&send_to_bcc=' . $value;
45 } else if ($key == 'subject') {
46 $rcptaddress .= '&subject=' . $value;
47 } else if ($key == 'body') {
48 $rcptaddress .= '&body=' . $value;
52 /* Double-encode in this fashion to get past redirect.php properly. */
53 $rcptaddress = urlencode($rcptaddress);
56 require_once('../functions/strings.php');
57 require_once('../config/config.php');
58 require_once('../functions/i18n.php');
59 require_once('../functions/plugin.php');
60 require_once('../functions/constants.php');
61 require_once('../functions/page_header.php');
64 * $squirrelmail_language is set by a cookie when the user selects
65 * language and logs out
67 set_up_language($squirrelmail_language, TRUE);
69 /* Need the base URI to set the cookies. (Same code as in webmail.php). */
70 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
75 * In case the last session was not terminated properly, make sure
78 $cookie_params = session_get_cookie_params();
79 setcookie(session_name(),'',0,$cookie_params['path'].$cookie_params['domain']);
80 setcookie('username', '', 0, $base_uri);
81 setcookie('key', '', 0, $base_uri);
82 header('Pragma: no-cache');
84 do_hook('login_cookie');
86 /* Output the javascript onload function. */
88 $header = "<SCRIPT LANGUAGE=\"JavaScript\">\n" .
90 " function squirrelmail_loginpage_onload() {\n".
91 " document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON
. "';\n".
92 ' document.forms[0].elements[' . (isset($loginname) ?
1 : 0) . "].focus();\n".
97 displayHtmlHeader( "$org_name - " . _("Login"), $header, FALSE );
99 /* Set the title of this page. */
100 echo '<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000CC" VLINK="#0000CC" ALINK="#0000CC" onLoad="squirrelmail_loginpage_onload();">'.
101 "\n<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n";
103 $username_form_name = 'login_username';
104 $password_form_name = 'secretkey';
105 do_hook('login_top');
107 $loginname_value = (isset($loginname) ?
htmlspecialchars($loginname) : '');
109 /* Display width and height like good little people */
110 $width_and_height = '';
111 if (isset($org_logo_width) && is_int($org_logo_width) && $org_logo_width>0) {
112 $width_and_height = " WIDTH=\"$org_logo_width\"";
114 if (isset($org_logo_height) && is_int($org_logo_height) && $org_logo_height>0) {
115 $width_and_height .= " HEIGHT=\"$org_logo_height\"";
119 " <IMG SRC=\"$org_logo\" ALT=\"" . sprintf(_("%s Logo"), $org_name) .
120 "\"$width_and_height><BR>\n".
121 ( $hide_sm_attributions ?
'' :
122 '<SMALL>' . sprintf (_("SquirrelMail version %s"), $version) . "<BR>\n".
123 ' ' . _("By the SquirrelMail Development Team") . "<BR></SMALL>\n" ) .
127 "<TABLE COLS=1 WIDTH=350>\n".
128 " <TR><TD ALIGN=CENTER BGCOLOR=\"#DCDCDC\">\n".
129 ' <B>' . sprintf (_("%s Login"), $org_name) . "</B>\n".
131 " <TR><TD BGCOLOR=\"#FFFFFF\"><TABLE COLS=2 WIDTH=\"100%\">\n".
133 ' <TD WIDTH="30%" ALIGN=right>' . _("Name:") . "</TD>\n".
134 " <TD WIDTH=\"*\" ALIGN=left>\n".
135 " <INPUT TYPE=TEXT NAME=\"$username_form_name\" VALUE=\"$loginname_value\">\n".
139 ' <TD WIDTH="30%" ALIGN=right>' . _("Password:") . "</TD>\n".
140 " <TD WIDTH=\"*\" ALIGN=left>\n".
141 " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n".
142 " <INPUT TYPE=HIDDEN NAME=\"js_autodetect_results\" VALUE=\"" . SMPREF_JS_OFF
. "\">\n".
143 " <INPUT TYPE=HIDDEN NAME=\"just_logged_in\" value=1>\n";
144 if ($rcptaddress != '') {
145 echo " <INPUT TYPE=HIDDEN NAME=\"rcptemail\" VALUE=\"".htmlspecialchars($rcptaddress)."\">\n";
149 " </TABLE></TD></TR>\n".
151 ' <CENTER><INPUT TYPE=SUBMIT VALUE="' . _("Login") . "\"></CENTER>\n".
156 do_hook('login_form');
159 do_hook('login_bottom');