9d5fbcc6a276ad8cdca15b95663e9a86b171385b
4 * login.php -- simple login screen
6 * Copyright (c) 1999-2003 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 /* Path for SquirrelMail required files. */
16 define('SM_PATH','../');
18 /* SquirrelMail required files. */
19 require_once(SM_PATH
. 'functions/strings.php');
20 require_once(SM_PATH
. 'config/config.php');
21 require_once(SM_PATH
. 'functions/i18n.php');
22 require_once(SM_PATH
. 'functions/plugin.php');
23 require_once(SM_PATH
. 'functions/constants.php');
24 require_once(SM_PATH
. 'functions/page_header.php');
25 require_once(SM_PATH
. 'functions/html.php');
26 require_once(SM_PATH
. 'functions/global.php');
29 * $squirrelmail_language is set by a cookie when the user selects
30 * language and logs out
32 set_up_language($squirrelmail_language, TRUE);
35 * Find out the base URI to set cookies.
37 if (!function_exists('sqm_baseuri')){
38 require_once(SM_PATH
. 'functions/display_messages.php');
40 $base_uri = sqm_baseuri();
43 * In case the last session was not terminated properly, make sure
49 header('Pragma: no-cache');
51 do_hook('login_cookie');
53 /* Output the javascript onload function. */
55 $header = "<script language=\"JavaScript\" type=\"text/javascript\">\n" .
57 " function squirrelmail_loginpage_onload() {\n".
58 " document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON
. "';\n".
59 " var textElements = 0;\n".
60 " for (i = 0; i < document.forms[0].elements.length; i++) {\n".
61 " if (document.forms[0].elements[i].type == \"text\" || document.forms[0].elements[i].type == \"password\") {\n".
63 " if (textElements == " . (isset($loginname) ?
2 : 1) . ") {\n".
64 " document.forms[0].elements[i].focus();\n".
73 displayHtmlHeader( "$org_name - " . _("Login"), $header, FALSE );
75 echo '<body text="#000000" bgcolor="#FFFFFF" link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="squirrelmail_loginpage_onload();">';
77 $username_form_name = 'login_username';
78 $password_form_name = 'secretkey';
81 $loginname_value = (sqGetGlobalVar('loginname', $loginname) ?
htmlspecialchars($loginname) : '');
83 /* If they don't have a logo, don't bother.. */
84 if (isset($org_logo) && $org_logo) {
85 /* Display width and height like good little people */
86 $width_and_height = '';
87 if (isset($org_logo_width) && is_numeric($org_logo_width) &&
89 $width_and_height = " width=\"$org_logo_width\"";
91 if (isset($org_logo_height) && is_numeric($org_logo_height) &&
93 $width_and_height .= " height=\"$org_logo_height\"";
96 global $shootMyFootOff;
97 if (check_php_version(4,3) and !isset($shootMyFootOff)) {
98 echo '<center><hr width="75%">' . "\n";
99 echo '<h2>PHP 4.3.x has been detected</h2>' . "\n";
100 echo '</center><p>The SquirrelMail team does not recommend the use of PHP 4.3.x with';
101 echo ' this software. Please see the <a href="http://www.squirrelmail.org">SquirrelMail';
102 echo ' website</a>, or the documentation that came with SquirrelMail for more information.</p>';
103 echo '<p>This warning can be disabled by either downgrading PHP, or inserting';
104 echo '"$shootMyFootOff = true;" in config/config_local.php.</p>' . "\n";
105 echo '<center><hr width="75%"></center>' . "\n";
109 echo "\n" . '<form action="redirect.php" method="post">' . "\n" .
114 ( isset($org_logo) && $org_logo
115 ?
'<img src="' . $org_logo . '" alt="' .
116 sprintf(_("%s Logo"), $org_name) .'"' . $width_and_height .
119 ( $hide_sm_attributions ?
'' :
120 '<small>' . sprintf (_("SquirrelMail version %s"), $version) . '<br />' ."\n".
121 ' ' . _("By the SquirrelMail Development Team") . '<br /></small>' . "\n" ) .
125 '<b>' . sprintf (_("%s Login"), $org_name) . "</b>\n",
126 'center', '#DCDCDC' )
129 html_tag( 'td', "\n" .
134 'right', '', 'width="30%"' ) .
136 '<input type="text" name="' . $username_form_name .'" value="' . $loginname_value .'" />' ,
137 'left', '', 'width="*"' )
142 'right', '', 'width="30%"' ) .
144 '<input type="password" name="' . $password_form_name . '" />' . "\n" .
145 '<input type="hidden" name="js_autodetect_results" value="SMPREF_JS_OFF" />' . "\n" .
146 '<input type="hidden" name="just_logged_in" value="1" />' . "\n",
147 'left', '', 'width="*"' )
149 'center', '#ffffff', 'border="0" width="100%"' ) ,
154 '<center><input type="submit" value="' . _("Login") . '" /></center>',
157 '', '#ffffff', 'border="0" width="350"' ) . '</center>',
160 '', '#ffffff', 'border="0" cellspacing="0" cellpadding="0" width="100%"' );
161 do_hook('login_form');
162 echo '</form>' . "\n";
164 do_hook('login_bottom');