Start some register_globals = off fixes:
[squirrelmail.git] / src / login.php
CommitLineData
59177427 1<?php
895905c0 2
35586184 3/**
4 * login.php -- simple login screen
5 *
15e6162e 6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
35586184 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * This a simple login screen. Some housekeeping is done to clean
10 * cookies and find language.
11 *
12 * $Id$
13 */
8e2ed807 14
86725763 15/* Path for SquirrelMail required files. */
16define('SM_PATH','../');
17
18/* SquirrelMail required files. */
19require_once(SM_PATH . 'functions/strings.php');
20require_once(SM_PATH . 'config/config.php');
21require_once(SM_PATH . 'functions/i18n.php');
22require_once(SM_PATH . 'functions/plugin.php');
23require_once(SM_PATH . 'functions/constants.php');
24require_once(SM_PATH . 'functions/page_header.php');
25require_once(SM_PATH . 'functions/html.php');
a32985a5 26require_once(SM_PATH . 'functions/global.php');
98f2ee76 27
28/*
29 * $squirrelmail_language is set by a cookie when the user selects
30 * language and logs out
31 */
32set_up_language($squirrelmail_language, TRUE);
d4e84069 33
85b454a0 34/**
35 * Find out the base URI to set cookies.
36 */
f3bc099d 37if (!function_exists('sqm_baseuri')){
86725763 38 require_once(SM_PATH . 'functions/display_messages.php');
f3bc099d 39}
40$base_uri = sqm_baseuri();
98f2ee76 41@session_destroy();
8e2ed807 42
98f2ee76 43/*
44 * In case the last session was not terminated properly, make sure
45 * we get a new one.
46 */
47$cookie_params = session_get_cookie_params();
85b454a0 48setcookie(session_name(), '', 0, $cookie_params['path'],
49 $cookie_params['domain']);
98f2ee76 50setcookie('username', '', 0, $base_uri);
51setcookie('key', '', 0, $base_uri);
52header('Pragma: no-cache');
53
54do_hook('login_cookie');
55
56/* Output the javascript onload function. */
57
8e2ed807 58$header = "<SCRIPT LANGUAGE=\"JavaScript\" type=\"text/javascript\">\n" .
98f2ee76 59 "<!--\n".
60 " function squirrelmail_loginpage_onload() {\n".
61 " document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON . "';\n".
62 ' document.forms[0].elements[' . (isset($loginname) ? 1 : 0) . "].focus();\n".
63 " }\n".
64 "// -->\n".
65 "</script>\n";
a714cb95 66$custom_css = 'none';
98f2ee76 67displayHtmlHeader( "$org_name - " . _("Login"), $header, FALSE );
68
69/* Set the title of this page. */
8e2ed807 70echo '<body text="#000000" bgcolor="#FFFFFF" link="#0000CC" vlink="#0000CC" alink="#0000CC" onLoad="squirrelmail_loginpage_onload();">';
98f2ee76 71
0fce910a 72$username_form_name = 'login_username';
73$password_form_name = 'secretkey';
98f2ee76 74do_hook('login_top');
75
76$loginname_value = (isset($loginname) ? htmlspecialchars($loginname) : '');
77
b6e0c3b6 78/* Display width and height like good little people */
4da8e94a 79$width_and_height = '';
8e2ed807 80if (isset($org_logo_width) && is_numeric($org_logo_width) && $org_logo_width>0) {
81 $width_and_height = " width=\"$org_logo_width\"";
b6e0c3b6 82}
8e2ed807 83if (isset($org_logo_height) && is_numeric($org_logo_height) && $org_logo_height>0) {
84 $width_and_height .= " height=\"$org_logo_height\"";
98f2ee76 85}
3fde693b 86
8e2ed807 87echo "\n" . '<form action="redirect.php" method="post">' . "\n" .
88html_tag( 'table',
89 html_tag( 'tr',
90 html_tag( 'td',
91 '<center>'.
92 '<img src="' . $org_logo . '" alt="' . sprintf(_("%s Logo"), $org_name) .'"' .
93 $width_and_height .'><br>' . "\n".
94 ( $hide_sm_attributions ? '' :
95 '<small>' . sprintf (_("SquirrelMail version %s"), $version) . '<br>' ."\n".
96 ' ' . _("By the SquirrelMail Development Team") . '<br></small>' . "\n" ) .
97 html_tag( 'table',
98 html_tag( 'tr',
99 html_tag( 'td',
100 '<b>' . sprintf (_("%s Login"), $org_name) . "</b>\n",
101 'center', '#DCDCDC' )
102 ) .
103 html_tag( 'tr',
104 html_tag( 'td', "\n" .
105 html_tag( 'table',
106 html_tag( 'tr',
107 html_tag( 'td',
108 _("Name:") ,
109 'right', '', 'width="30%"' ) .
110 html_tag( 'td',
111 '<input type="text" name="' . $username_form_name .'" value="' . $loginname_value .'">' ,
112 'left', '', 'width="*"' )
113 ) . "\n" .
114 html_tag( 'tr',
115 html_tag( 'td',
116 _("Password:") ,
117 'right', '', 'width="30%"' ) .
118 html_tag( 'td',
119 '<input type="password" name="' . $password_form_name . '">' . "\n" .
120 '<input type=hidden name="js_autodetect_results" value="SMPREF_JS_OFF">' . "\n" .
02b0b1d5 121 '<input type=hidden name="just_logged_in" value=1>' . "\n",
8e2ed807 122 'left', '', 'width="*"' )
123 ) ,
124 'center', '#ffffff', 'border="0" cols="2" width="100%"' ) ,
125 'left', '#FFFFFF' )
126 ) .
127 html_tag( 'tr',
128 html_tag( 'td',
129 '<center><input type="submit" value="' . _("Login") . '"></center>',
130 'left' )
131 ),
132 '', '#ffffff', 'border="0" cols="1" width="350"' ),
133 'center' )
134 ) ,
135'', '#ffffff', 'border="0" cellspacing="0" cellpadding="0" width="100%"' ) .
136'</form>' . "\n";
98f2ee76 137
138do_hook('login_form');
98f2ee76 139
140do_hook('login_bottom');
8e2ed807 141echo "</body>\n".
142 "</html>\n";
143?>