<!--#include file="../../mycartconn/conn.asp" -->
<!--#include file="../../mycartconn/md5.asp" -->
<!--#include file="../../mycartconn/ubbcode.asp" -->
<%
'禁止网页缓存
Response.Buffer = True 
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 
Response.CacheControl = "no-cache"
'判断是否使用了代理
if Request.ServerVariables("HTTP_X_FORWARDED_FOR") = ""  then
ip=Request.ServerVariables("REMOTE_ADDR")
else
ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
'超过3次错误的网站访问或已列入黑名单IP禁止访问
nosql_js=clng(conn.execute("select js from nosql where ip='"&ip&"'")(0))
if nosql_js>=5 then
response.write "连续5次以上错误的网址访问或您的IP被拒绝访问，请20分钟后再试或直接联系"&my_name&"客服中心取得帮助！<br><br>客服中心电话："&my_tel&""
Response.end
end if
'登陆
if request("login")="yes" then
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if not mid(server_v1,8,len(server_v2))=server_v2 then
Response.Write "<script language=JavaScript>{window.alert('系统错误，拒绝从非本服务器登陆!');window.history.go(-1);}</script>"
response.end
end if


adminname=request("name")
adminpass=md5(request("pass"))
yz=request("yz")
ok=dvHTMLCode(dvHTMLEncode(session("ok")))

'错误登陆超过一次则进行记录
if session("js")="" then session("js")=1 else session("js")=session("js")+1
if session("js")>2 then	
set rs = conn.execute("select js from nosql where ip='"&ip&"'")
if not rs.eof then
conn.execute("Update nosql set js=js+1 where ip='"&ip&"'")
else
conn.execute("Insert into nosql(ip)values('"&ip&"')")
end if
end If

if not yz=ok then
Response.Write "<script>alert(""填入的验证码错误，请重新输入。超过五次账号将被锁定"");location.href=""login.asp"";</script>"
response.end
response.write adminname&"<br>"&adminpass
response.end
end if

set rs=server.createobject("adodb.recordset")
sql="select adminname,adminpass,qx from admin where adminpass='"&adminpass&"' and adminname='"&adminname&"'"
rs.open sql,conn,1,1
if not(rs.bof and rs.eof) then
if adminname=rs("adminname") and adminpass=rs("adminpass") then
Set rs2 = Server.CreateObject("ADODB.Recordset")
sql2="select * from ip "
rs2.open sql2,conn,1,3
rs2.addnew
rs2("name")=rs("adminname")
rs2("ip")=ip
rs2("win")=Request.ServerVariables("HTTP_USER_AGENT")
rs2.update
rs2.close
set rs2=nothing
Session.Contents.Remove("js")
Session.Contents.Remove("ok")
session.timeout=4500
session("www.coodou.com")=rs("adminname")
session("qx")=rs("qx")
Response.Redirect "../admin.asp"
else
call Error
end if
else
call Error()
end if

sub Error()
response.write "<script>alert(""用户名或密码错误，请检查！超过五次账号将被锁定"");location.href=""login.asp"";</script>"
end sub
rs.close
conn.close
set rs=nothing
set conn=nothing

Response.end
end if%>

<html>
<head>
<title>酷豆-后台管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../mycartconn/admin.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle"> 
      <form name="form" method="post" action="?login=yes">
    <script language="javascript">
	<!--//
	function checksignup() {
		if ( document.form.name.value == '' ) {
			window.alert('请输入管理账号!!');
			document.form.name.focus();
		}
		else if ( document.form.pass.value == '' ) {
			window.alert('请输入管理账号密码!!');
			document.form.pass.focus();
		}
		else if ( document.form.yz.value == '' ) {
			window.alert('请输入网页上显示的5位数的验证码\n如果看不到请点击后面的看不到连接!!');
			document.form.yz.focus();
		}
       else {
		return true;
			}
		return false;
	}
	//-->
	</script>
        <table width="350" align="center" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
          <tr align="center" valign="middle" bgcolor="#f1f1f1"> 
            <td height="35" colspan="2"><font color="#FF3333"><strong>&gt;&gt;管理员登陆</strong></font></td>
    </tr>
          <tr valign="middle" bgcolor="#FFFFFF"> 
            <td width="75" height="30" align="center">管理账号</td>
            <td height="30"> 
              <div align="left"> 
          <input name="name" type="password" id="name" size="25" maxlength="20">
        </div></td>
    </tr>
          <tr valign="middle" bgcolor="#FFFFFF"> 
            <td width="75" height="30" align="center">管理密码</td>
            <td height="30"> 
              <div align="left"> 
          <input name="pass" type="password" id="pass" size="25" maxlength="20">
        </div></td>
    </tr>
          <tr valign="middle" bgcolor="#FFFFFF"> 
            <td width="75" height="30" align="center">验 证 码</td>
            <td height="30"> 
              <input name="yz" type="text" id="yz" size="8" maxlength="5">
        <img src="yz01.asp" width="70" height="20" alt="登陆验证码" border="1" align="absmiddle" />&nbsp;&nbsp;<a href="yz02.asp" target="_blank"><u>看不到？</u></a></td>
    </tr>
          <tr valign="middle" bgcolor="#FFFFFF"> 
            <td width="75" height="35" align="center">&nbsp;</td>
            <td height="35"> 
              <input name="Submit" type="submit" value="OK，登录" ONCLICK="javascript:return checksignup()"> 
        <input name="Submit2" type="reset" value="NO，重置">
            </td>
    </tr>
  </table>
</form><br><br><br>
</td>
  </tr>
</table>
</body>
</html>