4 ** login.php -- simple login screen
6 ** Copyright (c) 1999-2001 The Squirrelmail Development 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 /* Check if system has been configured */
57 if ( !file_exists( '../config/config.php' ) ) {
60 '<title>' . _("Configuration Error") . "</title>\n".
64 _("This system has not been configured yet.") .
66 _("Please contact system administrator.") .
72 require_once('../functions/strings.php');
73 require_once('../config/config.php');
74 require_once('../functions/i18n.php');
75 require_once('../functions/plugin.php');
76 require_once('../functions/constants.php');
77 require_once('../functions/page_header.php');
80 * $squirrelmail_language is set by a cookie when the user selects
81 * language and logs out
83 set_up_language($squirrelmail_language, true);
85 /* Need the base URI to set the cookies. (Same code as in webmail.php). */
86 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
91 * In case the last session was not terminated properly, make sure
94 $cookie_params = session_get_cookie_params();
95 setcookie(session_name(),'',0,$cookie_params['path'].$cookie_params['domain']);
96 setcookie('username', '', 0, $base_uri);
97 setcookie('key', '', 0, $base_uri);
98 header ('Pragma: no-cache');
100 do_hook('login_cookie');
102 /* Output the javascript onload function. */
103 displayHtmlHeader( "$org_name - " . _("Login"),
104 "<SCRIPT LANGUAGE=\"JavaScript\">\n" .
106 " function squirrelmail_loginpage_onload() {\n".
107 " document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON
. "';\n".
108 " document.forms[0].elements[0].focus();\n".
111 "</script>\n", FALSE );
113 /* Set the title of this page. */
114 echo "<BODY TEXT=#000000 BGCOLOR=#FFFFFF LINK=#0000CC VLINK=#0000CC ALINK=#0000CC onLoad='squirrelmail_loginpage_onload();'>\n".
115 "<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n";
117 $username_form_name = 'login_username';
118 $password_form_name = 'secretkey';
119 do_hook('login_top');
121 $loginname_value = (isset($loginname) ?
htmlspecialchars($loginname) : '');
124 " <IMG SRC=\"$org_logo\"><BR>\n".
125 ( $hide_sm_attributions ?
'' :
126 '<SMALL>' . sprintf (_("SquirrelMail version %s"), $version) . "<BR>\n".
127 ' ' . _("By the SquirrelMail Development Team") . "<BR></SMALL>\n" ) .
131 "<TABLE COLS=1 WIDTH=350>\n".
132 " <TR><TD BGCOLOR=#DCDCDC>\n".
133 ' <B><CENTER>' . sprintf (_("%s Login"), $org_name) . "</CENTER></B>\n".
135 " <TR><TD BGCOLOR=\"#FFFFFF\"><TABLE COLS=2 WIDTH=\"100%\">\n".
137 ' <TD WIDTH=30% ALIGN=right>' . _("Name:") . "</TD>\n".
138 " <TD WIDTH=* ALIGN=left>\n".
139 " <INPUT TYPE=TEXT NAME=\"$username_form_name\" VALUE=\"$loginname_value\">\n".
143 ' <TD WIDTH="30%" ALIGN=right>' . _("Password:") . "</TD>\n".
144 " <TD WIDTH=* ALIGN=left>\n".
145 " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n".
146 " <INPUT TYPE=HIDDEN NAME=\"js_autodetect_results\" VALUE=\"" . SMPREF_JS_OFF
. "\">\n".
147 " <INPUT TYPE=HIDDEN NAME=\"just_logged_in\" value=1>\n";
148 if ($rcptaddress != '') {
149 echo " <INPUT TYPE=HIDDEN NAME=\"rcptemail\" VALUE=\"".htmlspecialchars($rcptaddress)."\">\n";
153 " </TABLE></TD></TR>\n".
155 ' <CENTER><INPUT TYPE=SUBMIT VALUE="' . _("Login") . "\"></CENTER>\n".
160 do_hook('login_form');
163 do_hook('login_bottom');