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