<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/function.asp"-->
<!--#include file="../inc/md5.asp"-->
<%
if request("act")=1 then
   session("admin")=""
   response.Redirect"index.asp"
end if

if request("act")=2 then
    if request("num")<>Session("iCode") then
	response.Write("<script>alert('验证码输入错误!');history.back();</script>")
	response.End()
    end if
    names=login_check(request("user"))'过滤危险字符
    pwds=md5(request("pass")) 'MD5加密
    set rs=server.CreateObject("adodb.recordset")
    sq="select * from cw_admin where [user]='"&names&"'"
    rs.open sq,conn,1,1
    if rs.recordcount=0 then
      response.Write("<script>alert('用户名或密码错误!');history.back();</script>")
      response.End()
    end if
    pwd2=rs("pass")
    if pwds<>pwd2 then
        response.Write("<script>alert('用户名或密码错误!');history.back();</script>")
        response.End()
    end if
        session("admin")=rs("user")
		session("type")=rs("type")
        session.timeout=999
        response.Redirect"Cw_main.asp"
        response.End()
    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>地方门户网站管理系统(<%=cf_version%>)</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function check(fr)
{
  if(fr.user.value=="")
  {
     alert('管理帐号不能为空！');
	 fr.user.focus();
	 return false
  }
  if(fr.pass.value=="")
  {
     alert('登录密码不能为空！');
	 fr.pass.focus();
	 return false
  }
  if(fr.num.value=="")
  {
     alert('验证码不能为空！');
	 fr.num.focus();
	 return false
  }
  return true
}
window.onload = function(){
document.getElementById("user").focus();
}
</script>
</head>

<body id="login">
<form id="loginForm" onsubmit="return check(this)" method="post" action="index.asp">
	<h3>地方门户管理系统(<%=cf_version%>)</h3>
	<label><span>管理帐号：</span><input name="user" type="text" class="input" id="user" maxlength="20" />
	</label>
	<label><span>登录密码：</span><input name="pass" type="password" class="input" id="pass" maxlength="20" />
	</label>
	<label><span>验 证 码：</span><input name="num" type="text" class="input2" id="num" maxlength="5" />
	&nbsp;&nbsp;<img src="../inc/code.asp" width="80" height="25" alt="看不清单击刷新" onclick="this.src='../inc/code.asp?' + Math.random();" style="cursor:pointer" align="absmiddle" title="单击刷新验证码" />
	</label>
  <div id="submit"><input name="aa" type="image" src="style/login.png" class="bt" value=" " />	
	  <input name="act" type="hidden" id="act" value="2" />
	</div>
</form>
<p id="siteCopyRight">版权所有：<a href="http://www.cwcms.cn" target="_blank">www.cwcms.cn</a></p>
</body>
</html>
