<?
$err = (isset($_REQUEST["err"]))?$_REQUEST["err"]:0;
$erra = array(0=>"",1=>"You have to sign-in first.", 10=>"Signin failed. Please check your login/password/cookie setting.");
?>
<html>
<head><title>Laikwan's Web Mail Client</title>
<link href="main.css" rel="stylesheet" type="text/css" media="screen">
<script>
var submitted = 0; // use k prefix
var successful = 0; // use k prefix
var nextArray ;
var userArray ;
function submitForms(){
submitted = 0;
successful = 0;
nextArray = new Array(); // reset
userArray = new Array(); // reset
for(var i=0; i<3; i++){
if(document.forms[i].login.value.length > 0) {
if(document.forms[i].pass.value.length > 0){
document.forms[i].submit();
submitted++;
}else{
alert('Cannot login without password');
break;
}
}
}
}
function sortArrayFirstChild(a, b){
return a[0] - b[0];
}
function success(id){
document.forms[id].login.disabled = true;
document.forms[id].pass.disabled = true;
successful++;
nextArray.push(new Array(id, document.forms[id].login.value));
//userArray.push(document.forms[id].login.value);
// go to main page
if(successful == submitted){
nextArray.sort(sortArrayFirstChild); // ensures consistent order from form to ui
var s = new Array();
var u = new Array();
for(var i=0; i<nextArray.length; i++){
s.push(nextArray[i][0]);
u.push(nextArray[i][1]);
}
SetCookie('PHPSESSID', s.join(','));
SetCookie('LKWMC_USERNAMES', u.join(','));
location.href = 'test.html';
}
}
function failed(id, msg){
alert('The ' + (id+1) + ' login failed. ' + msg);
}
function SetCookie(cookieName,cookieValue) {
document.cookie = cookieName+"="+escape(cookieValue);
}
</script>
<body>
<br>
<br>
<table width="90%" align="center" cellpadding="0" cellspacing="0" border="0"><tr>
<td><img style="float:left" src="images/laikwan_wmc_logo.gif" width="125" height="23">
<div style="float:left">version 0.7 (based on Gmail-lite) </div>
<div style="clear:left">
<p style="color:red"><b><? if ($err) echo $erra[$err] ?></b></p>
<form action="login.php" method="post" target="iframe1">
<table width="300" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>Username</td><td><input type="text" name="login" value="">@gmail.com</td>
</tr>
<tr>
<td>Password</td><td><input type="password" name="pass"></td>
</tr>
</table>
<input type="hidden" name="sum" value="1">
<input type="hidden" name="num" value="0">
</form>
<br>
<form action="login.php" method="post" target="iframe2">
<table width="300" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>Username</td><td><input type="text" name="login" value="">@gmail.com</td>
</tr>
<tr>
<td>Password</td><td><input type="password" name="pass"></td>
</tr>
</table>
<input type="hidden" name="sum" value="1">
<input type="hidden" name="num" value="1">
</form>
<br>
<form action="login.php" method="post" target="iframe3">
<table width="300" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>Username</td><td><input type="text" name="login" value="">@gmail.com</td>
</tr>
<tr>
<td>Password</td><td><input type="password" name="pass"></td>
</tr>
</table>
<input type="hidden" name="sum" value="1">
<input type="hidden" name="num" value="2">
</form>
</div>
<p><input type="button" value="sign-in" onclick="submitForms()"></p>
</td></tr></table>
<div style="display:none">
<iframe id="iframe1" name="iframe1" src="images/spacer.gif" width="100" height="100"></iframe>
<iframe id="iframe2" name="iframe2" src="images/spacer.gif" width="100" height="100"></iframe>
<iframe id="iframe3" name="iframe3" src="images/spacer.gif" width="100" height="100"></iframe>
</div>
<p style="display:none">Timezone: GMT
<select name="tz">
<?
for ($i = -12; $i <= 12; $i++) {
echo "<option value='".$i."' ";
if ($i == $_COOKIE["TZ"] || (!isset($_COOKIE["TZ"]) && $i == 0))
echo "selected ";
echo ">".$i."</option>";
}
?></select>:<select name="tz2">
<?
$min = array("0"=>"00", "0.25"=>"15", "0.5"=>"30", "0.75"=>"45");
foreach($min as $k => $v) {
echo "<option value='".$k."' ";
if ($k == $_COOKIE["TZ2"] )
echo "selected ";
echo ">".$v."</option>";
}
?>
</select></p>
</body></html>