<!--#include file="function.asp"-->
<!--#include file="md5.asp"-->
<%
if request.QueryString("action")="submit" then

	m_user=server.HTMLEncode(trim(request.Form("m_user")))
	m_pass=server.HTMLEncode(request.Form("m_pass"))
	checkcode=server.HTMLEncode(request.Form("checkcode"))
	m_saveuser=request.Form("m_saveuser")
	m_savepass=request.Form("m_savepass")
	
	if m_user="" then
	p3t ErrMsg("请输入用户名")
	elseif m_pass="" then
	p3t ErrMsg("请输入密码")
	elseif checkcode="" or isnumeric(checkcode)=false then
	p3t ErrMsg("请输入验证码")
	elseif int(checkcode)<>session("getCode") then
	p3t ErrMsg("验证码错误")
	end if
	
	if m_saveuser<>1 then m_saveuser=0
	if m_savepass<>1 then m_savepass=0

	set rs=server.createobject("adodb.recordset")
	sql="select * from p3t_manage where m_user='"&m_user&"' and m_pass='"&md5(m_pass)&"'"
	rs.open sql,conn,1,1
		if rs.eof then
			p3t ErrMsg("您输入的用户名或密码有误")
		else
			session("m_id")=rs("m_id")
			session("m_user")=rs("m_user")
			session("m_realname")=rs("m_realname")
			session.timeout=30
			if m_saveuser=1 then response.Cookies("m_user")=m_user else response.Cookies("m_user")=""
			if m_savepass=1 then response.Cookies("m_pass")=m_pass else response.Cookies("m_pass")=""
			response.Cookies("m_saveuser")=m_saveuser
			response.Cookies("m_savepass")=m_savepass
			p3t "<script>parent.location.href='./';</script>"
			p3t_end
		end if
	rs.close
	set rs=nothing
	
	
end if
%>
<!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>后台管理系统</title>
<link type="text/css" rel="stylesheet" href="images/login.css" />
</head>

<body>
<div id="login">
    <div class="login_panel">
    <form name="form_login" id="form_login" action="?action=submit" method="post" target="yukiiak">
        <div class="login_form">
        	<p>
            用户名：<input type="text" name="m_user" class="login_input" size="7" value="<%=request.Cookies("m_user")%>" onFocus="this.select()" tabindex="1" />
            密码：<input type="password" name="m_pass" class="login_input" size="7" value="<%=request.Cookies("m_pass")%>" onFocus="this.select()" tabindex="2" />
            验证码：<input type="text" name="checkcode" class="login_input" size="3" maxlength="4" onFocus="this.select()" tabindex="3" />
            </p>
        	<p>
            <input type="checkbox" id="saveuser" name="m_saveuser" value="1" style="margin-left:44px;"<%if request.Cookies("m_saveuser")="1" then p3t " checked"%> /><label for="saveuser">记住用户</label>
            <input type="checkbox" id="savepass" name="m_savepass" value="1" style="margin-left:34px;"<%if request.Cookies("m_savepass")="1" then p3t " checked"%> /><label for="savepass">记住密码</label>
            <img src="images/code.asp" class="login_checkcode" alt="点击更换验证码" onClick="this.src='images/code.asp?rnd='+Math.random()" />
            </p>
        </div>
        <div class="login_submit">
        	<input name="submit" type="image" src="images/login_submit.gif" tabindex="4" />
        </div>
        <div class="login_getpass">
        	<p><img src="images/login_getpass.gif" /></p>
        </div>
    </form>
    </div>
    <div class="login_copyright">
        <p><%=admin_login_copyright%></p>
    </div>
</div>
<iframe name="yukiiak" id="yukiiak" style="display:none"></iframe>
</body>
</html>
