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.
15 /*****************************************************************/
16 /*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
17 /*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
18 /*** + Base level indent should begin at left margin, as ***/
19 /*** the first two lines below look. ***/
20 /*** + All identation should consist of four space blocks ***/
21 /*** + Tab characters are evil. ***/
22 /*** + all comments should use "slash-star ... star-slash" ***/
23 /*** style -- no pound characters, no slash-slash style ***/
24 /*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
25 /*** ALWAYS USE { AND } CHARACTERS!!! ***/
26 /*** + Please use ' instead of ", when possible. Note " ***/
27 /*** should always be used in _( ) function calls. ***/
28 /*** Thank you for your help making the SM code more readable. ***/
29 /*****************************************************************/
32 if (isset($emailaddress)) {
33 if (stristr($emailaddress, 'mailto:')) {
34 $rcptaddress = substr($emailaddress, 7);
36 $rcptaddress = $emailaddress;
39 if (($pos = strpos($rcptaddress, '?')) !== false) {
40 $a = substr($rcptaddress, $pos +
1);
41 $rcptaddress = substr($rcptaddress, 0, $pos);
42 $a = explode('=', $a, 2);
44 $name = urldecode($a[0]);
45 $val = urldecode($a[1]);
51 /* At this point, we have parsed a lot of the mailto stuff. */
52 /* Let's do the rest -- CC, BCC, Subject, Body */
53 /* Note: They can all be case insensitive */
54 foreach ($GLOBALS as $k => $v) {
55 $key = strtolower($k);
56 $value = urlencode($v);
58 $rcptaddress .= '&send_to_cc=' . $value;
59 } else if ($key == 'bcc') {
60 $rcptaddress .= '&send_to_bcc=' . $value;
61 } else if ($key == 'subject') {
62 $rcptaddress .= '&subject=' . $value;
63 } else if ($key == 'body') {
64 $rcptaddress .= '&body=' . $value;
68 /* Double-encode in this fashion to get past redirect.php properly. */
69 $rcptaddress = urlencode($rcptaddress);
74 require_once('../functions/strings.php');
75 require_once('../config/config.php');
76 require_once('../functions/i18n.php');
77 require_once('../functions/plugin.php');
78 require_once('../functions/constants.php');
79 require_once('../functions/page_header.php');
82 * $squirrelmail_language is set by a cookie when the user selects
83 * language and logs out
85 set_up_language($squirrelmail_language, true);
87 /* Need the base URI to set the cookies. (Same code as in webmail.php). */
88 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
93 * In case the last session was not terminated properly, make sure
96 $cookie_params = session_get_cookie_params();
97 setcookie(session_name(),'',0,$cookie_params['path'].$cookie_params['domain']);
98 setcookie('username', '', 0, $base_uri);
99 setcookie('key', '', 0, $base_uri);
100 header ('Pragma: no-cache');
102 do_hook('login_cookie');
104 /* Output the javascript onload function. */
105 displayHtmlHeader( "$org_name - " . _("Login"),
106 "<SCRIPT LANGUAGE=\"JavaScript\">\n" .
108 " function squirrelmail_loginpage_onload() {\n".
109 " document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON
. "';\n".
110 " document.forms[0].elements[0].focus();\n".
113 "</script>\n", FALSE );
115 /* Set the title of this page. */
116 echo "<BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000CC\" VLINK=\"#0000CC\" ALINK=\"#0000CC\" onLoad='squirrelmail_loginpage_onload();'>\n".
117 "<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n";
119 $username_form_name = 'login_username';
120 $password_form_name = 'secretkey';
121 do_hook('login_top');
123 $loginname_value = (isset($loginname) ?
htmlspecialchars($loginname) : '');
126 " <IMG SRC=\"$org_logo\"><BR>\n".
127 ( $hide_sm_attributions ?
'' :
128 '<SMALL>' . sprintf (_("SquirrelMail version %s"), $version) . "<BR>\n".
129 ' ' . _("By the SquirrelMail Development Team") . "<BR></SMALL>\n" ) .
133 "<TABLE COLS=1 WIDTH=350>\n".
134 " <TR><TD ALIGN=CENTER BGCOLOR=\"#DCDCDC\">\n".
135 ' <B>' . sprintf (_("%s Login"), $org_name) . "</B>\n".
137 " <TR><TD BGCOLOR=\"#FFFFFF\"><TABLE COLS=2 WIDTH=\"100%\">\n".
139 ' <TD WIDTH="30%" ALIGN=right>' . _("Name:") . "</TD>\n".
140 " <TD WIDTH=\"*\" ALIGN=left>\n".
141 " <INPUT TYPE=TEXT NAME=\"$username_form_name\" VALUE=\"$loginname_value\">\n".
145 ' <TD WIDTH="30%" ALIGN=right>' . _("Password:") . "</TD>\n".
146 " <TD WIDTH=\"*\" ALIGN=left>\n".
147 " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n".
148 " <INPUT TYPE=HIDDEN NAME=\"js_autodetect_results\" VALUE=\"" . SMPREF_JS_OFF
. "\">\n".
149 " <INPUT TYPE=HIDDEN NAME=\"just_logged_in\" value=1>\n";
150 if ($rcptaddress != '') {
151 echo " <INPUT TYPE=HIDDEN NAME=\"rcptemail\" VALUE=\"".htmlspecialchars($rcptaddress)."\">\n";
155 " </TABLE></TD></TR>\n".
157 ' <CENTER><INPUT TYPE=SUBMIT VALUE="' . _("Login") . "\"></CENTER>\n".
162 do_hook('login_form');
165 do_hook('login_bottom');