<!--#include file="Inc.asp"-->
<!--#include file="inc/md5.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rel=stylesheet type=text/css href="Inc/94kk.css" />
<title>论坛后台登陆</title>
</head>
<body>
<%Dim Action
Action=request.querystring("Action")
Select Case Action
Case"exit"
	ExitLogin()
Case"login"
	CheckLogin()
Case Else
	Main()
End select
Set BBS94KK=Nothing

Sub Main()
	Response.Write""&_
	"<form method=POST action='?action=login'>"&_
	"<div class='mian' style='width:400px;margin-top:50px'>"&_
	"<div class='top'>《猪婷家园网》—后台管理登陆</div><div class='divtr1' style='height:100px'><div style='height:34px'><br />"&_
	"<div style='margin-left:50px'>用户名称：<input name='AdminName' type=text size='22' style='width:120px'></div></div>"&_
	"<div style='height:24px'><div style='margin-left:50px'>后台密码：<input name='Password' type=password size='22' style='width:120px'></div></div>"&_
	"<div style='height:24px'><div style='margin-left:50px'>验证号码："&BBS94KK.GetSafeCode&"</div></div></div> "&_
	"<div class='bottom'><input type='submit' class='button' value='提 交'></div></div></form></body></html>"
End Sub

Sub CheckLogin()
	Dim AdminName,AdminPassword,PassCode,Temp
	With BBS94KK
	AdminName=.Fun.GetStr("AdminName")
	AdminPassword=.Fun.GetStr("Password")
	PassCode=.Fun.GetStr("SafeCode")
	If PassCode="" or AdminName="" or AdminPassword="" Then .Alert"请输入完整后再提交！","Admin_login.asp"
	If not .Fun.CheckName(AdminName) or not .Fun.CheckPassword(AdminPassword) then
		.SafeBuckler AdminName,.MyIP,1
		.Alert"您输入的用户名不存在或者密码错误！","Admin_login.asp"
	End if
	AdminPassword=Md5(AdminPassword)
	If .SafeBuckler(AdminName,.MyIP,0) Then .Alert"BBS安全盾已启动！\n对不起，你尝试登陆错误超过5次，今天不能再登陆后台。\n你的信息已被系统记录！","Index.asp"
	If .execute("select name From [KK_admin] where name='"&AdminName&"' And Password='"&AdminPassword&"' And boardID=0").eof Or Session("SafeCode")<>PassCode  Then
		Session("SafeCode")=Empty
		.SafeBuckler AdminName,.MyIP,1
		.Alert"您输入的用户名不存在或者密码错误或者随机验证码错误！","Admin_login.asp"
	Else
		.LetMemor "Admin","AdminName",AdminName
		.LetMemor "Admin","AdminPassword",AdminPassword
		.MyName=AdminName
		.NetLog"成功登陆后台"
		If .Info(16)="1" Then .execute("delete from [KK_Log] where DATEDIFF('d', LogTime,'"&.NowBBSTime&"')>7")
		Session("SafeCode")=Empty
		Response.Redirect"Admin_index.asp"
		Response.End
	End if
	End With
End Sub

Sub ExitLogin()
	Session(CacheName &"AdminName") = Empty
	Response.Cookies(CacheName &"Admin")("AdminName")= Empty
	Session(CacheName &"AdminName") = Empty
	Response.Cookies(CacheName &"Admin")("AdminPassword")= Empty
	'Session.Abandon
	Response.redirect"Index.asp"
End Sub
%>