<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #INCLUDE FILE = "conn.asp" -->
<!-- #INCLUDE FILE = "MD5.asp" -->
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
</head>
<%
dim act,username,password
act=request.QueryString("act")
if(act<>"" and act="login") then
	username=request.Form("username")
	if(username<>"") then
		username=replace(username,"'","")		
	end if
	password=md5(request.Form("password"),32)
	Set rs=Server.CreateObject("ADODB.Recordset")
	rs.open "select * from t_admin where adminname='"&username&"' and adminpass='"&password&"'",conn,3,1
	if not rs.eof then
		session("name")="adminlogined"
		response.Write("<script>parent.location.href='admin_index.asp';</script>")
	else
		response.Redirect("login.asp")
	end if
	rs.close
	set rs=nothing
else
%>
<body>
<script language="javascript">
function check(obj){
	with(obj){
		if(username.value==""){
			alert("用户名不能为空!");
			username.focus();
			username.select();
			return false;
		}
		if(password.value==""){
			alert("密码不能为空!");
			password.focus();
			password.select();
			return false;
		}
		return true;
	}
}
</script>
<form id="form1" name="form1" method="post" action="?act=login" onsubmit="return check(this)">
  <table width="600" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#E7E7E7">
    <tr>
      <td height="22" colspan="2" bgcolor="#006699"><div align="center" class="style1">用户登录</div></td>
    </tr>
    <tr>
      <td width="300" height="30" bgcolor="#FFFFFF"><div align="right">用户名：</div></td>
      <td width="300" bgcolor="#FFFFFF"><input name="username" type="text" id="username" size="20" /></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><div align="right">密码：</div></td>
      <td height="30" bgcolor="#FFFFFF"><input name="password" type="password" id="password" size="20" /></td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#FFFFFF"><div align="center">
        <input type="submit" name="Submit" value="登录" />&nbsp;&nbsp;
        <input type="reset" name="Submit2" value="取消" />
      </div></td>
    </tr>
  </table>
</form>
<%
end if
%>
</body>
</html>
<%
call connclose()
%>