f8acbebb3001d3509ab9a527a6d73410cce8677c
3 ** login.php -- simple login screen
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
8 ** This a simple login screen. Some housekeeping is done to clean
9 ** cookies and find language.
15 if (isset($emailaddress)) {
16 if (stristr($emailaddress, 'mailto:'))
17 $rcptaddress = substr($emailaddress, 7);
19 $rcptaddress = $emailaddress;
21 if (($pos = strpos($rcptaddress, '?')) !== false)
23 $a = substr($rcptaddress, $pos +
1);
24 $rcptaddress = substr($rcptaddress, 0, $pos);
25 $a = explode('=', $a, 2);
27 $name = urldecode($a[0]);
28 $val = urldecode($a[1]);
34 // At this point, we have parsed a lot of the mailto stuff. Let's
35 // do the rest -- CC, BCC, Subject, Body
36 // Note: They can all be case insensitive
37 foreach ($GLOBALS as $k => $v)
39 $key = strtolower($k);
40 $value = urlencode($v);
42 $rcptaddress .= '&send_to_cc=' . $value;
43 elseif ($key == 'bcc')
44 $rcptaddress .= '&send_to_bcc=' . $value;
45 elseif ($key == 'subject')
46 $rcptaddress .= '&subject=' . $value;
47 elseif ($key == 'body')
48 $rcptaddress .= '&body=' . $value;
51 // Double-encode in this fashion to get past redirect.php properly
52 $rcptaddress = urlencode($rcptaddress);
55 require_once('../functions/strings.php');
56 require_once('../config/config.php');
57 require_once('../functions/i18n.php');
58 require_once('../functions/plugin.php');
60 // $squirrelmail_language is set by a cookie when the user selects
61 // language and logs out
62 set_up_language($squirrelmail_language, true);
64 // Need the base URI to set the cookies. (Same code as in webmail.php)
65 ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
68 setcookie("username", '', 0, $base_uri);
69 setcookie("key", '', 0, $base_uri);
70 header ("Pragma: no-cache");
72 // In case the last session was not terminated properly, make sure
74 $cookie_params = session_get_cookie_params();
75 setcookie(session_name(),"",0,$cookie_params["domain"].$cookie_params["path"]);
77 do_hook('login_cookie');
80 echo $org_name . " - " . _("Login");
81 echo "</TITLE></HEAD>\n";
82 echo "<BODY TEXT=000000 BGCOLOR=#FFFFFF LINK=0000CC VLINK=0000CC ALINK=0000CC>\n";
83 echo "<FORM ACTION=\"redirect.php\" METHOD=\"POST\" NAME=f>\n";
85 $username_form_name = 'login_username';
86 $password_form_name = 'secretkey';
89 echo "<CENTER><IMG SRC=\"$org_logo\"></CENTER>\n";
90 echo "<CENTER><SMALL>";
91 printf (_("SquirrelMail version %s"), $version);
93 echo _("By the SquirrelMail Development Team");
94 echo "<BR></SMALL><CENTER>\n";
95 echo "<TABLE COLS=1 WIDTH=350>\n";
97 echo " <TD BGCOLOR=#DCDCDC>\n";
99 printf (_("%s Login"), $org_name);
100 echo "</CENTER></B>\n";
103 echo " <TD BGCOLOR=#FFFFFF>\n";
104 echo " <TABLE COLS=2 WIDTH=100%>\n";
106 echo " <TD WIDTH=30% ALIGN=right>\n";
108 echo " </TD><TD WIDTH=* ALIGN=left>\n";
109 echo " <INPUT TYPE=TEXT NAME=\"$username_form_name\"";
110 if (isset($loginname))
111 echo " value=\"" . htmlspecialchars($loginname) . "\"";
115 echo " <TD WIDTH=30% ALIGN=right>\n";
117 echo " </TD><TD WIDTH=* ALIGN=left>\n";
118 echo " <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n";
120 if ($rcptaddress != '') {
121 echo " <INPUT TYPE=HIDDEN NAME=\"rcptemail\" VALUE=\"".htmlspecialchars($rcptaddress)."\">\n";
128 echo " <CENTER><INPUT TYPE=SUBMIT VALUE=\"";
130 echo "\"></CENTER>\n";
134 echo "<input type=hidden name=just_logged_in value=1>\n";
135 do_hook('login_form');
137 do_hook("login_bottom");