📄 login.asp
字号:
<!-- #include file="utility/const.asp" -->
<!-- #include file="utility/md5.asp" -->
<%
'****************************************
'目的: 验证用户登陆
'开始时间: 2005-5-30
'最后修改时间: 2005-5-30
'编写人: 某某某
'****************************************
dim userID '用户名
dim userPassword '密码
dim userType '用户类别
dim sql '将被执行的SQL命令
dim rs 'RecordSet对象
'读取用户提交的数据并进行完整性判断
userID = trim(request.form("userID"))
userPassword = trim(request.form("userPassword"))
userType = request.form("userType")
if(userID = "" or userPassword = "") then
alert("对不起,您的信息填写不完整,请查实后再登陆!")
GoBack()
Response.end
end if
'过滤单引号
userID = CheckStr(userID)
userPassword = md5(userPassword)
'进行登陆信息验证
if(userType = "teacher") then
sql = "select ID,tName,tFlag from teacher where tName = '" & userID &_
"' and tPassword = '" & userPassword & "'"
set rs = ExecuteQuery(sql)
if(rs.eof) then
alert("对不起,您输入的用户名或者密码错误,请查实!")
GoBack()
Response.end
else
Session("userID") = rs("ID") '编号
Session("userName") = rs("tName") '姓名
Session("userType") = userType '类型:[student|teacher]
Session("userFlag") = rs("tFlag") '级别:[管理员|教师]
Response.Redirect("teacher/index.asp")
end if
elseif(userType = "student") then
sql = "select sName,sCheck from student where ID = '" & userID &_
"' and sPassword = '" & userPassword & "'"
set rs = ExecuteQuery(sql)
if( rs.eof ) then
alert("对不起,您输入的用户名或者密码错误,请查实!")
GoBack()
Response.end
else
Session("userID") = userID '学号
Session("userName") = rs(0) '姓名
Session("userType") = userType '用户类型:[student|teacher]
Session("userCheck") = rs(1) '是否通过审核
Response.Redirect("student/index.asp")
end if
else
alert("对不起,您的信息填写不完整,请查实后再登陆!")
GoBack()
Response.end
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -