📄 checklogin.asp
字号:
<%response.expires=0%>
<!--#INCLUDE FILE="conn.asp" -->
<!--#INCLUDE FILE="const.asp" -->
<!--#INCLUDE FILE="char.asp" -->
<%
userid=trim(request.form("username"))
userpwd=trim(request.form("userpwd"))
if userid="" then
Errormsg=Errormsg+"<br>"+"<li>请输入用户名!</a>!"
call disperrs()
response.end
elseif isValidstring(userid)<>"" then
Errormsg=Errormsg+"<br>"+"<li>您输入了非法的用户名!</a>!"
call disperrs()
response.end
elseif isValidstring(userpwd)<>"" then
Errormsg=Errormsg+"<br>"+"<li>您输入了非法的密码!</a>!"
call disperrs()
response.end
end if
userid=replace(userid,"'","")
userpwd=replace(userpwd,"'","")
set rs=server.CreateObject ("ADODB.RecordSet")
rs.Source="select ID from admin where User='"&userid&"' and userpwd='"&userpwd&"'"
rs.Open rs.Source,conn,1,1
thesoft=Request.ServerVariables("HTTP_USER_AGENT")
if instr(thesoft,"Windows NT 5.0") then
vOS="Win 2000"
elseif instr(thesoft,"Windows NT 5.1") then
vOs="Win XP"
elseif instr(thesoft,"Windows NT") then
vOs="Win NT"
elseif instr(thesoft,"Windows 9") then
vOs="Win 9x"
elseif instr(thesoft,"unix") or instr(thesoft,"linux") or instr(thesoft,"SunOS") or instr(thesoft,"BSD") then
vOs="类Unix"
elseif instr(thesoft,"Mac") then
vOs="Mac"
else
vOs="Other"
end if
if not rs.EOF then
session("level")=3
session("name")=userid
session("pass")=userpwd
set rs1=Server.Createobject("adodb.recordset")
sql1="Select * from Log"
rs1.open sql1,conn,3,3
rs1.addnew
rs1("User")=userid
rs1("LoginIP")=request.ServerVariables("Remote_Addr")
rs1("OS")=vOS
rs1.update
rs1.close
set rs=nothing
Response.Redirect "form.asp"
else
set rs1=Server.Createobject("adodb.recordset")
sql1="Select * from Log"
rs1.open sql1,conn,3,3
rs1.addnew
rs1("User")=Request.Form("username")
rs1("LoginIP")=request.ServerVariables("Remote_Addr")
rs1("OS")=vOS
rs1("ErrorPas")=Request.Form("Password")
rs1("Result")="Error"
rs1.update
rs1.close
set rs=nothing
response.redirect"index.htm"
end if
dim Errormsg
set rs=conn.execute("Select * from admin where user='"&userid&"'")
if rs.eof and rs.bof then
Errormsg=Errormsg+"<br>"+"<li>你不是管理员!</a>!"
call disperrs()
response.end
elseif rs("userpwd")<>userpwd then
Errormsg=Errormsg+"<br>"+"<li>密码错误!请重新<a href=javascript:history.back()>登陆</a>!!"
call disperrs()
response.end
else
'管理员:3 超级用户:2 高级用户:1 普通用户:0
session("level")=3
session("name")=userid
session("pass")=userpwd
response.redirect "form.asp"
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -