<?php
	session_start(); 
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	$opendb = new mydb();
	require_once('inc/char_set.php');
	$config_sql="select * from ls_config";
	
	$config_query=$opendb->query($config_sql);
	//var_dump($opendb);
	$config_rows=mysql_fetch_assoc($config_query);
	$username=trim($_GET['username']);
	if(!isset($_SESSION['retryTimes']))
	{$_SESSION['retryTimes']=1;}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $engineName?>d</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="css/admin.css" />
<STYLE type="text/css">
body{background:#fff;padding-top:100px;}
td {table-layout:fixed; word-break:break-all }
input { FONT-SIZE: 9pt; color: #000 }
</STYLE>
<script type="text/JavaScript">
function CheckBrowser() 
{
  var app=navigator.appName;
  var verStr=navigator.appVersion;
  if (app.indexOf('Netscape') != -1) {
	alert(" 你使用的是Netscape浏览器，可能会导致无法使用后台的部分功能。建议您使用 IE6.0 或以上版本。");
  } 
  else if (app.indexOf('Microsoft') != -1) {
	if (verStr.indexOf("MSIE 3.0")!=-1 || verStr.indexOf("MSIE 4.0") != -1 || verStr.indexOf("MSIE 5.0") != -1 || verStr.indexOf("MSIE 5.1") != -1)
	  alert("   您的浏览器版本太低，可能会导致无法使用后台的部分功能。建议您使用 IE6.0 或以上版本。");
  }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
	if (val) { nm=val.name; if ((val=val.value)!="") {
	  if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
		if (p<1 || p==(val.length-1)) errors+='- '+nm+' 必须是邮箱地址.\n';
	  } else if (test!='R') { num = parseFloat(val);
		if (isNaN(val)) errors+='- '+nm+' 必须包含数字.\n';
		if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
		  min=test.substring(8,p); max=test.substring(p+1);
		  if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
	} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' 不能为空：\n'; }
  } if (errors) alert('请更正下列错误:\n'+errors);
  document.MM_returnValue = (errors == '');
}
</script>
</head>
<body onload="document.getElementById('username').focus()">

<form action="Checklogin.php" method="post" name="form1" >
	<div align="center">
		<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" id="table9" >
			<tr>
				<td><div align="center">
						<table border="0" cellpadding="0" cellspacing="0"   style="background-image:url(images/admin_login.gif); background-repeat:no-repeat" width="564" height="352" id="table10">
							<tr>
								<td width="564" valign="top"><div align="center">
										<table width="100%" height="372" border="0" cellpadding="0" cellspacing="0" id="table11">
											<tr>
												<td height="127" colspan="3" valign="top" style="font-size: 7pt; font-family:Microsoft YaHei; color: #000; table-layout: fixed; word-break: break-all">
													<div style=" height:15px; padding-top:20px;" align="center"><font color="#000000" size="4"><b><?php echo $config_rows['companyNameCn'];?></b></font></div></td>
												<td width="35" height="127"></td>
											</tr>
											<tr>
												<td width="209" height="108"></td>
												<td height="108" colspan="2"><table border="0" cellpadding="5" cellspacing="0" width="330" id="table12">
														<tr>
															<td width="88" align="center"> 用户名</td>
															<td width="222">&nbsp;
																<input type="text" name="username"  id="username"  value="<?=$username?>" size="24" maxlength="20" onMouseOver="this.style.background='#FDE8FE';" onMouseOut="this.style.background='#FFFFFF'" onFocus="this.select(); "></td>
														</tr>
														<tr>
															<td width="88" align="center"> 密　码</td>
															<td width="222">&nbsp;
																<input type="password" name="password" size="24" maxlength="20"  onMouseOver="this.style.background='#FDE8FE';" onMouseOut="this.style.background='#FFFFFF'" onFocus="this.select(); "></td>
														</tr>
													
                                                        <tr>
													<? 	if($_SESSION['retryTimes']>$codeRetryTimes)   //超过规定次数进行验证码验证
															{
														?>			<td width="88" height="46" align="center"> 验证码<br></td>
															<td width="222" valign="top">
																<input type="text" name="code" size="10" onMouseOver="this.style.background='#FDE8FE';" onMouseOut="this.style.background='#FFFFFF'" onFocus="this.select(); "   onclick="this.value=''"  style=" color:#999" value="不区分大小写">
																&nbsp;&nbsp;&nbsp;<img src="inc/code.php" border="0" valign="bottom"></td> 
                                                                <? }?>
														</tr>
													</table></td>
												<td width="35" height="108"></td>
											</tr>
											<tr>
												<td width="209" height="5"></td>
											  <td colspan="2"></td>
												<td width="35"></td>
										  </tr>
											<tr>
												<td width="209" height="25"></td>
												<td colspan="2"><p align="center">
														<input name="B1" type="image" value="提交" onClick="MM_validateForm('username','','R','password','','R');return document.MM_returnValue" src=images/login001.jpg width="72" height="21">
														&nbsp; <a href="#" onClick="window.close()" style="text-decoration: none; font-family: AdobeSm; color: #000"><img border="0" src="images/login002.jpg" width="72" height="21"></a></td>
												<td width="35"></td>
											</tr>
											<tr>
												<td height="52" valign="middle"></td>
												<td width="140" height="52" valign="bottom"><div align="center"><a href="fetchpassword.php" target="_blank"></a></div></td>
												<td width="180" height="52" valign="bottom"><div align="right"><a href="fetchpassword.php" target="_blank"><font color="#FFF">找回密码</font></a></div></td>
												<td height="52">&nbsp;</td>
											</tr>
											<tr>
												<td width="209"></td>
												<!--<td  colspan="2" valign="bottom"><div align="right" style="padding-bottom:4px"><a href="http://www.lanscend.com" target="_blank" class="STYLE1"><span class="STYLE1">Powered 
							  by Lanscend.com 蓝信网络</span></a></div></td>-->
												<td width="140" height="37" ></td>
											</tr>
				            </table>
							  </div></td>
							</tr>
						</table>
					</div></td>
			</tr>
		</table>
	</div>
</form>
</body>
</html>
