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

📄 login.asp

📁 一个虚拟主机代理系统
💻 ASP
字号:
<%'=========================================
'ScriptMate User Manager Version 2.1
'Copyright 2001 (C) ScriptMate.Com
'User Module
'This module helps member to login
'For any help with modification to
'this file contact support@scriptmate.com
'=========================================%>

<script language="JAVASCRIPT">

	var errfound = false;

		function ValidLength(item, len) {
		   return (item.length >= len);
		}

		function error(elem, text) {
		   if (errfound) return;
		   window.alert(text);
		   elem.select();
		   elem.focus();
		   elem.style.backgroundColor=errorcolor;
		   errfound = true;
		}
		function Validate() {
		   errfound = false;
		   d=document.login
		   if (!ValidLength(d.members_username.value,1))error(d.members_username,"Username should not be blank.");
		   if (!ValidLength(d.members_password.value,1))error(d.members_password,"Password should not be blank.");
		   return !errfound;
		}

</script>

<%Sub Login()
	
	dim todo,action,url,chkerror,members_username,members_password,smumcookies,dbusername,dbpassword,dbfirstname,dblastname,dbactive,dbadmin,dbid,dbexpirydate,dbaccesslevel,dbmembertype,sessionsar,n,_
	smumquery1,adderror,currenturl
	
	if not Application("smumdebugmode") then on error resume next

	action = request("action")
	url = Request("url")
	todo = Request.form("todo")
	currenturl = Request.ServerVariables("url")
	
	if application("smumcookies") then
	
		if Request.Cookies ("smumcookies")("password") <> "" and  Request.Cookies ("smumcookies")("username") <> "" then
			todo = "login"
			members_username = Request.Cookies("smumcookies")("username")
			members_password = Request.Cookies("smumcookies")("password")
			url = url
		end if
	
	end if
	
	if todo = "" then

		smumFormAction "<form action="""&currenturl&"?action=login"" method=post name=login language=""JAVASCRIPT"" onsubmit=""return Validate();"">"
		smumFormHiddenField "todo","login"
		smumFormHiddenField "url",url
		smumFormOpenTable
		smumFormHeader "Member Login Area"
		smumFormResponseCol Application("smumnotloggedin")
		smumFormFields "Username","<input class=fieldbox type=text size=35 maxlength=50 name=""members_username"">"
		smumFormFields "Password","<input class=fieldbox type=password size=35 maxlength=50 name=""members_password"">"
		if application("smumcookies") then smumFormFields "","<input type=checkbox name=smumcookies> Remember my UserName and Password"
		smumFormButtons "<input class=fieldbox type=submit value=""Login"" id=submit2 name=submit2>"
		smumFormResponseCol "<a href="""&currenturl&"?action=register"">Register Now</a> | <a href="""&currenturl&"?action=forgotpass"">Forgot Password</a>"
		smumFormCloseTable
		smumFormClose		

	elseif todo = "login" then

		if application("smumcookies") then

			if Request.Cookies ("smumcookies")("password") <> "" then
				todo = "login"
				members_username = Request.Cookies("smumcookies")("username")
				members_password = Request.Cookies("smumcookies")("password")
				url = url
			else
				members_username = smFixer(smChecknull("Username", request.form("members_username"), chkerror))
				members_password = smFixer(smChecknull("Password", request.form("members_password"), chkerror))
				url = Request.Form("url")
				smumcookies = Request.Form("smumcookies")
			end if

		else

			members_username = smFixer(smChecknull("Username", request.form("members_username"), chkerror))
			members_password = smFixer(smChecknull("Password", request.form("members_password"), chkerror))
			url = Request("url")
			smumcookies = Request.Form("smumcookies")

		end if

		if chkerror <> "" then adderror = "<b>Errors in login. Please check and submit again.</b> <bR>&#149;&nbsp;"& left(chkerror, (len(chkerror)-2)) & " should not be blank."

		if members_username = "" or members_password = "" then 
		else

			smumquery = "select * from smum_memberstbl where members_username = '" & members_username & "'"
			smumOpenrs smumquery,"smumrs",action
			
				if smumrs.eof then
					adderror = adderror & " &#149; "& Application("smuminvalidusername")
				else
				
					dbusername = smumrs("members_username")
					dbpassword = smumrs("members_password")
					dbfirstname = smumrs("members_firstname")
					dblastname = smumrs("members_lastname")
					dbadmin = smumrs("members_admin")
					dbactive = smumrs("members_active")
					dbid = smumrs("members_id")
					
					if smumrs("members_expirydate") = "1/1/9000" then
						dbexpirydate = ""
					else
						dbexpirydate = smumrs("members_expirydate")
					end if	
					
					dbaccesslevel = smumrs("members_accesslevel")
										
					sessionsar = split(Application("smumlistingsessions"),",")
					
					For n = 0 to ubound(sessionsar)
						session(trim(sessionsar(n))) = smumrs(trim(sessionsar(n)))
					Next
	
				end if
			
			smumClosers(smumrs)
		
			if Request.Cookies("smumcookies")("password") <> dbpassword then
				Response.Cookies("smumcookies")("username") = "a"
				Response.Cookies("smumcookies")("password") = "a"
				Response.Cookies("smumcookies").expires = date() - 1
			end if

			if dbpassword = members_password then	
					
				if not checkip(dbid) then 
					session.Abandon()
					Response.Redirect smumpage & "?action=messages&mesid=7"
				end if	
						
				smumquery1 = "select usergroups_groupid from smum_usergroupstbl where usergroups_userid = "& dbid
				smumOpenrs smumquery1,"smumrs1",action
						
					if smumrs1.eof then
						session("groups") = ""
					else
								
						do until smumrs1.eof
							session("groups") = session("groups")& smumrs1("usergroups_groupid") & ","
						smumrs1.movenext
						loop
								
					end if
						
				smumClosers(smumrs1)
		
				if dbadmin then
					session("Admin") = true
				else
					session("Admin") = false
				end if
						
				if dbactive then
					session("active") = true
				else
					session("admin") = ""
					Response.Redirect smumpage & "?action=messages&mesid=3"
				end if
						
				if dbexpirydate = "" then
					session("Expirydate") = true
				else
						
					if dbexpirydate < now()	then
						session("admin") = ""
						session("active") = ""
						Response.Redirect smumpage & "?action=messages&mesid=5"
					else
						session("Expirydate") = true
					end if
						
				end if
						
				if dbaccesslevel = Application("smummaxlevels") then
					session("Accesslevel") = dbaccesslevel + 1
				else
					session("Accesslevel") = dbaccesslevel
				end if
						
				if not Application("smummultiplelogin") and dbaccesslevel < (Application("smummaxlevels")+1) then
							
					if instr(Application("smummultiplelogs"),dbusername&"|") <> 0 then
						session.Abandon()
						Response.Redirect smumpage & "?action=messages&mesid=8"
					end if
							
				end if
							
				session("Username") = dbusername
				session("Membername") = dbfirstname &" "&dblastname
				session("Id") = dbid
							
				Application("smummultiplelogs")=Application("smummultiplelogs")&session("Username")&"|"
						
			else
			
				adderror = adderror & " &#149; "& Application("smuminvalidpassword")

			end if
			
		end if

		if adderror = "" then

			smumquery = "insert into smum_userlogstbl (userlogs_logdate, userlogs_ipaddress, userlogs_userid ) values ('"&now()&"','"&Request.ServerVariables("remote_host")&"',"&session("id")&")"
			smumexecutequery smumquery,action

			if smumcookies = "on" then
				Response.Cookies("smumcookies")("username") = members_username
				Response.Cookies("smumcookies")("password") = members_password
				Response.Cookies("smumcookies").expires = date + 30
			end if

			if url = "" then
				Response.Redirect "/"
			else
				url = replace(replace(url,"@$@$","?"),"@@$$","&")
				Response.redirect url
			end if

		else

			smumFormAction "<form action="""&currenturl&"?action=login"" method=post name=login language=""JAVASCRIPT"" onsubmit=""return Validate();"">"
			smumFormHiddenField "todo","login"
			smumFormHiddenField "url",url
			smumFormOpenTable
			smumFormHeader "Member Login Area"
			smumFormResponseCol adderror
			smumFormFields "Username","<input class=fieldbox type=text size=35 maxlength=50 name=""members_username"" value="""&members_username&""">"
			smumFormFields "Password","<input class=fieldbox type=password size=35 maxlength=50 name=""members_password"" value="""&members_password&""">"
			if application("smumcookies") then smumFormFields "","<input type=checkbox name=smumcookies> Remember my UserName and Password"
			smumFormButtons "<input class=fieldbox type=submit value=""Login"" id=submit2 name=submit2>"
			smumFormResponseCol "<a href="""&currenturl&"?action=register"">Register Now</a> | <a href="""&currenturl&"?action=forgotpass"">Forgot Password</a>"
			smumFormCloseTable
			smumFormClose		

		end if

	end if

End Sub%>

⌨️ 快捷键说明

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