📄 class_user.asp
字号:
<%
'====================================================================
'= CnwyAsp 请假信息管理系统
'= 河南省宝丰县第二高级中学 文 三(2) 班
'= 作者:王铮(Cnwy)QQ32940696
'= Copyright (c) 2005 Cnwy Wang All Rights Reserved.
'=-------------------------------------------------------------------
'= 文件名称:class_user.asp
'= 摘 要:用户操作类文件
'=-------------------------------------------------------------------
'= 开始编写日期:2005-08-26
'= 编写完成日期:
'= 最后修改日期
'====================================================================
%>
<%
Class CnwyAsp_User
public maildx
Private Sub class_initialize() '类的初始设置
dim userrs,sql,rs1,sql1,week,Cnwy_public,tst
Set Cnwy_public=New CnwyAsp_Public
week=weekday(now())
With request
if .Cookies("user")="" or .Cookies("pass")="" then
info="对不起,你未登陆或者是超时连接."
else
Call ConnOpen()
sql="select * from CnwyAsp_admin where user='"&.cookies("user")&"'"
set userrs=conn.execute(sql)
if userrs.eof or userrs.bof then
info="对不起,此管理员帐号被删除."
elseif userrs("pass")<>.cookies("pass") then
info="对不起,您的密码被修改,请重新登陆."
elseif userrs("zt")=false then
info="对不起,此管理员的帐号被锁定."
elseif Cnwy_public.duty=true and userrs("type")="infoadmin" then
if instr(userrs("master"),"BC")=1 then
tst=true
sql1="select * from CnwyAsp_duty where id="&week&""
ELSEif instr(userrs("master"),"B")=1 then
tst=false
sql1="select * from CnwyAsp_duty where shenpi='"&userrs("user")&"' and id="&week&""
elseif instr(userrs("master"),"C")=1 then
tst=false
sql1="select * from CnwyAsp_duty where shenhe='"&userrs("user")&"' and id="&week&""
end if
if sql1<>"" then
set rs1=conn.execute(sql1)
if rs1.eof or rs1.bof then
info="尊敬的["&.cookies("user")&"]今天不轮您值班."
else
if tst=true and rs1("shenhe")<>.cookies("user") and rs1("shenpi")<>.cookies("user") then
info="尊敬的["&.cookies("user")&"]今天不轮您值班."
end if
end if
rs1.close
set rs1=nothing
end if
end if
userrs.close
set userrs=nothing
end if
end with
if info<>"" then
Cnwy_public.errinfo(info)
end if
set Cnwy_public=nothing
End Sub
Public Function userexit() '用户退出时调用的方法
dim Cnwy_public
set cnwy_public=New CnwyAsp_Public
with response
Call ConnOpen()
set exitrs=server.createobject("adodb.recordset")
sql="select * from CnwyAsp_admin where user='"&request.cookies("user")&"'"
exitrs.open sql,conn,2,3
exitrs("online")=false
exitrs.update
exitrs.close
set exitrs=nothing
Call Connclose()
.cookies("user")=""
.cookies("pass")=""
.cookies("name")=""
.cookies("master")=""
.cookies("type")=""
End with
info="您已安全的退出本系统."
Cnwy_public.errinfo(info)
set Cnwy_public=nothing
End function
Public function menu() '用户登陆管理系统后栏目根据管理员的类型和权限显示的方法
dim Cnwy_Html
set Cnwy_Html=new CnwyAsp_Html
with request
if .cookies("type")="superadmin" then
Cnwy_Html.menuhtml(0)
elseif .cookies("type")="infoadmin" and .cookies("master")<>"" then
Cnwy_Html.menuhtml(1)
else
Cnwy_Html.menuhtml(2)
end if
end with
set Cnwy_Html=nothing
End function
Public Function userxg(ByVal ty) '用户资料修改的方法(包括:管理员修改用户以及用户个人修改)
dim Cnwy_Html '0代表个人资料修改,1代表管理员修改用户资料
set Cnwy_Html=new CnwyAsp_Html
if ty=0 then
Cnwy_Html.userxghtml(0)
elseif ty=1 then
CheckMaster(1)
Cnwy_Html.userxghtml(1)
end if
set Cnwy_Html=nothing
End Function
public Function useradd() '增加管理员调用的方法
CheckMaster(1)
dim Cnwy_Html
set Cnwy_Html=new CnwyAsp_Html
Cnwy_Html.useraddhtml()
set Cnwy_Html=nothing
End function
public function usersave() '修改用户,增加用户向数据库操作的方法
dim ftype,savers,user,pass,uname,qq,email,phone,cell,typeinfo,info
dim Cnwy_public
set Cnwy_public=new CnwyAsp_Public
Call ConnOpen()
ftype=request.form("type")
if ftype=0 or ftype=1 then
user=request.querystring("user")
elseif ftype=2 then
user=request.form("user")
else
info="你非法操作,您的行为被禁止."
end if
if ftype=1 or ftype=2 then
CheckMaster(1)
end if
pass=trim(request.form("pass"))
uname=trim(request.form("name"))
qq=trim(request.form("qq"))
email=trim(request.form("email"))
phone=trim(request.form("phone"))
cell=trim(request.form("cell"))
if ftype=1 or ftype=2 then
typeinfo=request.form("infotype")
else
typeinfo="null"
end if
Cnwy_public.checkstrvar=user
if user="" or pass="" or uname="" or qq="" or email="" or phone="" or cell="" or typeinfo="" then
info="对不起请您把信息填写完整."
elseif Cnwy_public.checknumer<>0 then
info="您的帐号中有非法字符."
elseif not isnumeric(qq) then
info="您的QQ号码只能为数字."
elseif len(QQ)>=10 then
info="您输入的QQ号码不正确."
elseif instr(email,"@")=0 then
info="您输入的信箱不正确."
elseif not isnumeric(phone) then
info="您输入的电话号码必须为数字."
elseif len(phone)>13 then
info="您输入的电话号码不正确."
elseif not isnumeric(cell) then
info="您输入的手机号码必须为数字."
elseif len(cell)<>11 then
info="您输入的手机号码不正确."
else
if ftype=2 then
sql="select * from CnwyAsp_admin where user='"&user&"'"
set savers=conn.execute(sql)
if savers.eof and savers.bof then
sql="insert into CnwyAsp_admin (user,pass,name,qq,email,phone,cellphone,type) values "
sql=sql&"('"&user&"','"&pass&"','"&uname&"','"&qq&"','"&email&"','"&phone&"','"&cell&"','"&typeinfo&"')"
conn.execute(sql)
info="恭喜您增加"&user&"管理员成功~!"
savers.close
set savers=nothing
else
info=user&"这个帐号已被使用,请您换一个帐号."
savers.close
set savers=nothing
end if
else
sql="select * from CnwyAsp_admin where user='"&user&"'"
set savers=server.createobject("adodb.recordset")
savers.open sql,conn,2,3
savers("pass")=pass
savers("name")=uname
savers("qq")=qq
savers("email")=email
savers("phone")=phone
savers("cellphone")=cell
if ftype=1 then
savers("type")=typeinfo
end if
savers.update()
savers.close
set savers=nothing
info="恭喜你修改"&user&"的资料成功."
End if
End if
if info<>"" then
Cnwy_Public.massage(info)
end if
set Cnwy_Public=nothing
Call ConnClose()
End Function
Public Function Muserpage() '用户管理页面设计
CheckMaster(1)
dim Cnwy_Html
set Cnwy_Html=new CnwyAsp_Html
Cnwy_Html.Managehtml()
set Cnwy_Html=nothing
end function
Public Function Master() '用户权限管理设置的页面
CheckMaster(1)
dim Cnwy_Html
set Cnwy_Html=new CnwyAsp_Html
Cnwy_Html.masterhtml()
set Cnwy_Html=nothing
end function
public function ManageUser(ByVal ty) '用户资料删除,锁定,解锁,权限设置调用函数
CheckMaster(1)
dim rs,sql,user,master,info
dim Cnwy_Public
set Cnwy_Public=new CnwyAsp_Public ' 0代表用户锁定,1代表解锁,2代表用户的权限设置,3代表用户的删除
user=trim(request.querystring("user"))
Call Connopen()
if ty=0 or ty=1 or ty=2 then
set rs=server.createobject("adodb.recordset")
sql="select * from CnwyAsp_admin where user='"&user&"'"
rs.open sql,conn,2,3
if ty=0 then
rs("zt")=false
info="您已成功锁定用户"&user
elseif ty=1 then
rs("zt")=true
info="您已成功的解除用户"&user&"的锁定."
elseif ty=2 then
master=request.form("master")
master=replace(replace(master,",","")," ","")
rs("master")=master
info="您成功的修改"&user&"的权限."
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -