⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.asp

📁 简介:一个程序小巧而功能强大
💻 ASP
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--#include file="Includes/site-dataconn.asp" -->
<!--#include file="Includes/func-common.asp" -->
<!--#include file="Includes/site-config.asp" -->
<!--#include file="Includes/inc-common.asp" -->
<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
<html>

<head>
<title>// <%=Site_Name%> //</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK REL=stylesheet TYPE="text/css" HREF="Includes/site-style.css">
</head>

<body>
<%
if request.querystring("action") = "login" then
		
	set rsLogin = server.createobject("adodb.recordset")
	sqlLogin = "SELECT User_ID, User_Name, User_Password, User_IP, User_Laston_Date, User_Status, User_Activation, User_Login_Failures, User_Email FROM Forum_Users WHERE User_Name = '"& clean_text(request.form("Username"), 0) &"'"
	rsLogin.cursortype = 2
	rsLogin.locktype = 3
	rsLogin.open sqlLogin, adoConn
	if rsLogin.eof or rsLogin.bof then
		'Incorrect login details
		strHeading = "Error"
		strMessage = "用户名和密码错误. Please click <a href='"& request.form("url") &"'>here</a> if you are not redirected within 5 seconds."
		strRedirectURL = "javascript:history.go(-1)"
	else
		'Username correct check that the passwords match and the account is not banned and is active
		if rsLogin("User_Password") =  clean_text(request.form("Password"), 0) then
			if rsLogin("User_Status") = 2 then
				strHeading = "Error"
				strMessage = "Your account has been banned from "& Site_Name &". Please click <a href='"& request.form("url") &"'>here</a> if you are not redirected within 5 seconds."
				strRedirectURL = "default.asp"
			end if
			if rsLogin("User_Status") = 0 then
				strHeading = "Error"
				strMessage = "Your acount has not yet been activated, check your e-mail and activate your account. Please click <a href='"& request.form("url") &"'>here</a> if you are not redirected within 5 seconds."
				strRedirectURL = "default.asp"
			end if
			
			'If there are no errors log the user in
			if strMessage = "" then
				
				'set user session variables
				session("UserID") = rsLogin("User_ID")
				session("UserName") = rsLogin("User_Name")
				if request.cookies(Site_Name)("laston") <> "" then
					session("laston") = request.cookies(Site_Name)("laston")
				else
					session("laston") = rsLogin("User_Laston_Date")
				end if
				
				'Write user details to cookie if selected
				if request.form("Remember") = 1 then
					response.cookies(Site_Name)("id") = rsLogin("User_ID")
					response.cookies(Site_Name)("code") = rsLogin("User_Activation")
					if request.cookies(Site_Name)("Signature") = "1" then
						response.cookies(Site_Name)("Signature") = "1"
					else
						response.cookies(Site_Name)("Signature") = ""
					end if
					response.cookies(Site_Name).expires = DateAdd("yyyy", 1, Now())
				else
					response.cookies(Site_Name)("id") = ""
					response.cookies(Site_Name)("code") = ""
					response.cookies(Site_Name)("Signature") = ""
				end if
				
				response.cookies(site_name)("read") = "r"
				
				'Write last on date to cookie
				response.cookies(Site_Name)("laston") = db_time()
				
				'Update Database
				if request.servervariables("HTTP_X_FORWARDED_FOR") = "" then
					rsLogin("User_IP") = request.servervariables("REMOTE_ADDR")
				else
					rsLogin("User_IP") = request.servervariables("HTTP_X_FORWARDED_FOR")
				end If
				rsLogin("User_Laston_Date") = db_time()
				rsLogin("User_Login_Failures") = 0
				rsLogin.update
				
				'Admin check
				set rsAdmin = server.createobject("adodb.recordset")
				sqlAdmin = "SELECT * FROM Forum_Admin WHERE Admin_User_ID = "& session("userid") &""
				rsAdmin.open sqlAdmin, adoConn
				if not (rsAdmin.eof or rsAdmin.bof) then
					'Set Admin session
					session("Admin") = true
				end if
				rsAdmin.close
				set rsAdmin = nothing
				
				strHeading = "Login"
				strMessage = "登 陆 成 功。 将在5秒内自动进入论坛 please click <a href="""& request.form("url") &""">here</a> to go back."
				if instr(1, request.form("url"), "disabled.asp", 1) > 0 then
					strRedirectURL = "Admin/"
				else
					strRedirectURL = request.form("url")
				end if			
			end if
		else
		 	'Password do no match
			if rsLogin("User_Login_Failures") >= 2 then
				'Too many failures, de-activate and re-send activation email
				rsLogin("User_Status") = 0
				rsLogin("User_Login_Failures") = rsLogin("User_Login_Failures") + 1
				rsLogin.update
				strMessage = "Your account has been de-activated due to too many successive failed logins. An e-mail has now been sent to the registered e-mail address with instructions on how to re-activate your account. Please click <a href='"& request.form("url") &"'>here</a> if you are not redirected within 5 seconds."
				strRedirectURL = "default.asp"
				
				'Construct E-Mail
				emailTo = rsLogin("User_Email")
				emailFrom = Site_Name & "Accounts" & "<" & Site_Email_Address & ">"
				emailSubject = Site_Name & " Account Security"
				emailBody = "Hello " & rsLogin("User_Name") & ",<br><br> Due to a large number of succesive login failures due to the use of an incorrect password your account has been temporarily de-activated for your security.<br><br>To re-activate your account please click the following link: <a href=""" & Site_Forum_URL & "/register.asp?Action=Activate&U="& rsLogin("User_ID") &"&A="& rsLogin("User_Activation") &""">" & Site_Forum_URL & "/register.asp?Action=Activate&U="& rsLogin("User_ID") &"&A="& rsLogin("User_Activation") &"</a>.<br><br>Once your account has been re-activated we strongly recommend that you review your account passwords security.<br><br>" & Site_Email_Signature
					
				'Send Email using e-mail include
				%>
				<!--#include file="Includes/inc-email.asp" -->
				<%
			else
				'Increment failed login counter
				rsLogin("User_Login_Failures") = rsLogin("User_Login_Failures") + 1
				rsLogin.update
				strMessage = "The Username and/or Password that you have entered is incorrect. Please click <a href='"& request.form("url") &"'>here</a> if you are not redirected within 5 seconds."
				strRedirectURL = "javascript:history.go(-1)"
			end if
		end if
		rsLogin.close
		set rsLogin = nothing
	end if
end if
	
if request.querystring("action") = "logout" then
	strRedirectURL = "default.asp"
	session.abandon()
	response.cookies(Site_Name)("id") = ""
	response.cookies(Site_Name)("code") = ""
	response.cookies(Site_Name)("laston") = ""
	response.cookies(Site_Name).expires = DateAdd("d", -1, Now())
	strHeading = "Logout"
	strMessage = "你已经成功的退出论坛. 将在5秒内退出 please click <a href=""default.asp"">here</a> to return to "& Site_Name &"."
end if

if request.querystring("action") = "" then
	strHeading = "Error"
	strMessage = "You have reached this page in error. Click <a href=""deafault.asp"">here</a> if you are not redirected within 5 seconds."
	strRedirectURL = "default.asp"
end if
%>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td align="center" valign="middle">
	<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center" class="main">
		<tr valign="middle" class="title">
		<td align="center"><%=Site_Name%> // Login</td>
		</tr>
		<tr class="body">
		<td align="center"><%=strMessage%></td>
		</tr>
	</table>
	</td>
	</tr>
</table>
<META HTTP-EQUIV="Refresh" CONTENT="5; URL=<%=strRedirectURL%>">
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -