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

📄 checkuser.asp

📁 酷虎网同学录V1.0
💻 ASP
字号:
<%
dim membername,clsid,sysadmin
sysadmin=false
membername=checkstr(request.cookies("fengyue")("txlusr"))
memberpwd=checkstr(request.cookies("fengyue")("txlpwd"))

clsid=request.cookies("fengyue")("myclass")

if membername<>"" then
	if chkuserlogin(membername,memberpwd)<>"" then
		response.cookies("fengyue")("txlusr")=""
		response.cookies("fengyue")("txlpwd")=""
		response.cookies("fengyue")("myclass")=""
		response.cookies("fengyue")("logintime")=""
		membername=""
		clsid=""
	else
		sysadmin=isSystemadmin()
	end if
end if


function chkjoinclass(byval myclassid)
dim tmprs
chkjoinclass=""

if myclassid="" then
	Errmsg=Errmsg+"<br>"+"<li>操作失败,请选择您加入的班级!"
	chkjoinclass=Errmsg
	exit function
end if

myclassid=clng(myclassid)

set tmprs=conn.execute("select classid from [class] where classid="&myclassid)
if tmprs.eof and tmprs.bof then
	Errmsg=Errmsg+"<br>"+"<li>操作失败!您要访问的班级不存在或已被删除。"
	chkjoinclass=Errmsg
	exit function
end if
set tmprs=nothing

if not sysadmin then
	set tmprs=conn.execute("select isauditing from [joinclass] where userid='"&membername&"' and classid="&myclassid)
	if tmprs.eof then
		Errmsg=Errmsg+"<br>"+"<li>对不起,您还没有加入这个班级!"
		founderr=true
	elseif tmprs(0)=true then
		Errmsg=Errmsg+"<br>"+"<li>操作失败!您还没有通过班级管理员的审核。"
		founderr=true
	end if
	set tmprs=nothing
end if

if founderr=true then
	chkjoinclass=Errmsg
else
	chkjoinclass=""
end if

end function


function isClassMember(byval bishowmsg)
dim tmprs,founderr,errmsg
if clsid="" then
	Errmsg=Errmsg+"<br>"+"<li>非法操作,请选择您加入的班级!"
	call error("Critical",errmsg)
	isClassMember=false
	exit function
end if

set tmprs=conn.execute("select isauditing from [joinclass] where userid='"&membername&"' and classid="&clsid)
if tmprs.eof then
	Errmsg=Errmsg+"<br>"+"<li>对不起,您还没有加入这个班级!"
	founderr=true
elseif tmprs(0)=true then
	Errmsg=Errmsg+"<br>"+"<li>操作失败!您还没有通过班级管理员的审核。"
	founderr=true
end if


if founderr=true then
	isClassMember=false
	if bishowmsg<>0 then call error("Exclamation",errmsg)
else
	isClassMember=true
end if
end function


function isClassadmin(bshowmsg)
dim tmprs

set tmprs=conn.execute("select admin1,admin2 from [class] where classid="&clsid)

if tmprs(0)=membername then
	isclassadmin=2
elseif tmprs(1)=membername then
	isclassadmin=1
else
	Errmsg=Errmsg+"<li>操作失败,您不是本班的管理员!"
	isclassadmin=0
		if bshowmsg<>0 then
			call error("Exclamation",errmsg)
		end if

end if

end function



function isSystemAdmin()
dim tmprs
dim founderr,errmsg

set tmprs=conn.execute("select s.userid,s.userpwd,a.* from [student] s inner join [admin] a on s.userid=a.userid where s.userid='"&membername&"'")
if tmprs.eof and tmprs.bof then
	Errmsg=Errmsg+"<li>对不起!您不是同学录系统管理员。"
	founderr=true
end if


if founderr=true then
	isSystemAdmin=false
'	if bshowmsg<>0 then	call error("Exclamation",errmsg)
else
	isSystemAdmin=true
end if

end function



function chkuserlogin(byval txluser,byval txlpwd)

dim tmprs
dim founderr,errormsg

chkuserlogin=""

set tmprs =conn.execute("select userpwd,locked from [student] where userid='"&txluser&"'")

if tmprs.EOF and tmprs.bof then
	Errormsg=Errormsg+"<br>"+"<li>对不起,您还没有<a href=register.asp>注册</a>!"
	founderr=true
elseif txlpwd<>tmprs("userpwd") then
	Errormsg=Errormsg+"<br>"+"<li>密码错误!请重新<a href=login.asp>登陆</a>!!"
	founderr=true
elseif tmprs("locked")=true then
	Errormsg=Errormsg+"<br>"+"<li>对不起,您的同学录帐号已被锁定,若有任何问题,请与<a href=mailto:"&SystemEmail&">系统管理员联系</a>!"
	founderr=true
end if

set tmprs=nothing

if founderr=true then
	chkuserlogin=errormsg
end if


end function




%>

⌨️ 快捷键说明

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