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