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

📄 userchklogin.asp

📁 三鸟个人网站源码。
💻 ASP
字号:
<%@language=vbscript codepage=936 %>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/md5.asp"-->
<%
dim sql,rs
dim username,password,CookieDate
username=replace(trim(request("username")),"'","")
password=replace(trim(Request("password")),"'","")
CookieDate=trim(request("CookieDate"))
dim ComeUrl
ComeUrl=trim(request("ComeUrl"))
if ComeUrl="" then
	ComeUrl="index.asp"
end if
if UserName="" then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>用户名不能为空!</li>"
end if
if Password="" then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>密码不能为空!</li>"
end if
if CookieDate="" then
	CookieDate=0
else
	CookieDate=Clng(CookieDate)
end if
if FoundErr<>True then
	password=md5(password)
	set rs=server.createobject("adodb.recordset")
	sql="select * from [User] where LockUser=False and username='" & username & "' and password='" & password &"'"
	rs.open sql,conn,1,3
	if rs.bof and rs.eof then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>用户名或密码错误!!!</li>"
	else
		if password<>rs("password") then
			FoundErr=True
			ErrMsg=ErrMsg & "<br><li>用户名或密码错误!!!</li>"
		else
			if rs("UserLevel")>999 then
				FoundErr=True
				ErrMsg=ErrMsg & "<br><li>对不起,你尚未通过认证,不能登录!</li>"
			else
				rs("LastLoginIP")=Request.ServerVariables("REMOTE_ADDR")
				rs("LastLoginTime")=now()
				rs("LoginTimes")=rs("LoginTimes")+1
				rs.update
				call SaveCookie_asp163()
				rs.close
				set rs=nothing
				call CloseConn()
				response.redirect ComeUrl
			end if
		end if
	end if
	rs.close
	set rs=nothing
end if
if FoundErr=True then
	call WriteErrMsg()
end if
call CloseConn()

sub SaveCookie_asp163()
	Response.Cookies("asp163")("UserName")=rs("username")
	Response.Cookies("asp163")("Password") = rs("PassWord")
	Response.Cookies("asp163")("UserLevel")=rs("UserLevel")
	select case CookieDate
		case 0
			Response.Cookies("asp163")("CookieDate") = CookieDate
		case 1
		   	Response.Cookies("asp163").Expires=Date+1
			Response.Cookies("asp163")("CookieDate") = CookieDate
		case 2
			Response.Cookies("asp163").Expires=Date+31
			Response.Cookies("asp163")("CookieDate") = CookieDate
		case 3
			Response.Cookies("asp163").Expires=Date+365
			Response.Cookies("asp163")("CookieDate") = CookieDate
	end select
end sub

'****************************************************
'过程名:WriteErrMsg
'作  用:显示错误提示信息
'参  数:无
'****************************************************
sub WriteErrMsg()
	dim strErr
	strErr=strErr & "<html><head><title>错误信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbcrlf
	strErr=strErr & "<link href='style.css' rel='stylesheet' type='text/css'></head><body>" & vbcrlf
	strErr=strErr & "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbcrlf
	strErr=strErr & "  <tr align='center'><td height='22' class='title'><strong>错误信息</strong></td></tr>" & vbcrlf
	strErr=strErr & "  <tr><td height='100' class='tdbg' valign='top'><b>产生错误的可能原因:</b><br>" & errmsg &"</td></tr>" & vbcrlf
	strErr=strErr & "  <tr align='center'><td class='tdbg'><a href=""UserLogin.asp?ComeUrl=" & ComeUrl & """>&lt;&lt; 返回登录页面</a></td></tr>" & vbcrlf
	strErr=strErr & "</table>" & vbcrlf
	strErr=strErr & "</body></html>" & vbcrlf
	response.write strErr
end sub

%>

⌨️ 快捷键说明

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