用ASP实现分级权限控制
本文实现的是一个帐务管理系统中分级权限的控制,程序使用ASP和"tright")<> "1" then
button1.hide
button2.hide
end if
…………
'自动填写时间和操作人
Textbox7.value=year(date) & "-" & month(date) & "-" & day(date)
Textbox9.value =session("username")
set cnn1=server.CreateObject("adodb.connection")
set rst1=server.CreateObject("adodb.recordset")
cnn1.CursorLocation=3
cnn1.ConnectionTimeout =30
cnn1.Open "DSN=jky"
rst1.Open "select * from bm ",cnn1,1,1,adcmdtext
if rst1.RecordCount >0 then
RST1.MoveFirst
Id=rst1.Fields("id")
do while not rst1.EOF
Listbox3.addItem rst1.Fields("bmName"),cint(rst1.Fields("id"))
“Response.Write rst1.Fields("bmname") & rst1.Fields("id")
rst1.MoveNext
loop
end if
rst1.Close
rst1.Open "select zgsname from zgs where bmid=" & id,cnn1,1,1,adcmdtext
if rst1.RecordCount >0 then
rst1.MoveFirst
do while not rst1.EOF
Listbox4.addItem cstr(rst1.Fields("zgsname"))
rst1.MoveNext
loop
end if
rst1.Close
cnn1.close
call writerst
end if
end function
………………
'凭证记帐
sub button2_onclick
dim s
s=Listbox1.selectedIndex
Response.Write s
end sub
sub listbox3_onchange
dim id,i
i=Listbox4.getCount()
do while i>-1
call Listbox4.removeItem(i)
i=i-1
loop
id=listbox3.getValue (listbox3.selectedIndex)
set cnn2=server.CreateObject("adodb.connection")
set rst2=server.CreateObject("adodb.recordset")
cnn2.CursorLocation=3
cnn2.ConnectionTimeout =30
cnn2.Open"DSN=jky"
rst2.Open "select zgsName from zgs where bmid=" & id,cnn2,1,1,adcmdtext
if rst2.RecordCount >0 then
RST2.MoveFirst
do while not rst2.EOF
Listbox4.addItem cstr(rst2.Fields("zgsName"))
rst2.MoveNext
loop
end if
rst2.Close
cnn2.Close
end sub
sub button2_onclick
set cnn5=server.CreateObject("adodb.connection")
cnn5.CursorLocation=3
cnn5.ConnectionTimeout =30
cnn5.Open"DSN=jky"
cnn5.Execute "insert into jzpz(bm,zgs,xmz,xm,sr,zc,szfx,szxs,rq,jbr,lrr,szsm) select bm,zgs,xmz,xm,sr,zc,szfx,szxs,rq,jbr,
lrr,szsm from wjzpz where lrr=“" & session("username") & "“"
cnn5.Execute "delete from wjzpz where lrr=“" & session("username") & "“"
end sub
3.数据查询(分级权限控制)
以凭证的字段为条件进行查询,在供选条件前有一方框供打“√”,其中“部门“条件必选(程序自动加上),部门内容由程序根据用户的权限自动
从数据库中调用相应值,分公司内容根据所属部门自动调整,部分程序如下:
……………
'根据权限值进入相应的查询界面
……………
function thisPage_onenter()
set cnn1=server.CreateObject("adodb.connection")
set rst1=server.CreateObject("adodb.recordset")
cnn1.CursorLocation=3
cnn1.ConnectionTimeout =30
cnn1.Open "dsn=jky"
select case session("Tright")
case "3"“副院长
rst1.Open "select bm.bmName from jk_user ,bm where JK_user.bmid=bm.id and jk_user.username =“"& session("username")
& "“",cnn1,1,1,adcmdtext
if rst1.RecordCount >0 then
RST1.MoveFirst
do while not rst1.EOF
Listbox1.addItem cstr(rst1.Fields("bmName"))
rst1.MoveNext
loop
end if
rst1.Close
rst1.Open "select zgsname from zgs ",cnn1,1,1,adcmdtext
if rst1.RecordCount >0 then
rst1.MoveFirst
do while not rst1.EOF
Listbox2.addItem cstr(rst1.Fields("zgsname"))
rst1.MoveNext
loop
end if
rst1.Close
cnn1.close
Checkbox1.setChecked (true)
case "2"“部门经理
Listbox1.addItem session("bm")
rst1.Open "select zgsname from zgs where bmid=" & session("bmid"),cnn1,1,1,adcmdtext
if rst1.RecordCount >0 then
rst1.MoveFirst
do while not rst1.EOF
Listbox2.addItem cstr(rst1.Fields("zgsname"))
rst1.MoveNext
loop
end if
rst1.Close
cnn1.close
Checkbox1.setChecked (true)
“Checkbox1.0
case "1"“会计
rst1.Open "select bmName from bm ",cnn1,1,1,adcmdtext
if rst1.RecordCount >0 then
RST1.MoveFirst
do while not rst1.EOF
Listbox1.addItem cstr(rst1.Fields("bmName"))
rst1.MoveNext
loop
end if
rst1.Close
rst1.Open "select zgsname from zgs ",cnn1,1,1,adcmdtext
if rst1.RecordCount >0 then
rst1.MoveFirst
do while not rst1.EOF
Listbox2.addItem cstr(rst1.Fields("zgsname"))
rst1.MoveNext
loop
end if
rst1.Close
cnn1.close
case "4"“院长
rst1.Open "select bmName from bm ",cnn1,1,1,adcmdtext
if rst1.RecordCount >0 then
RST1.MoveFirst
do while not rst1.EOF
Listbox1.addItem cstr(rst1.Fields("bmName"))
rst1.MoveNext
loop
end if
rst1.Close
rst1.Open "select zgsname from zgs ",cnn1,1,1,adcmdtext
if rst1.RecordCount >0 then
rst1.MoveFirst
do while not rst1.EOF
Listbox2.addItem cstr(rst1.Fields("zgsname"))
rst1.MoveNext
loop
end if
rst1.Close
cnn1.close
end select
end if
…………
end function
'按照权限查询凭证
sub button1_onclick
dim rst2,cnn2,str,i
dim bm(1),zgs(1),xmz(1),xm(1),szfx(1),szxs(1),rq(2),jbr(1)
bm(0)=Checkbox1.getChecked()
if bm(0) then
bm(1)=Listbox1.getText(Listbox1.selectedIndex )
str=" and bm=“" & bm(1) & "“"
end if
zgs(0)=Checkbox2.getChecked()
if zgs(0) then
zgs(1)=Listbox2.getText(Listbox2.selectedIndex )
str=str & " and zgs =“"& zgs(1) & "“"
end if
xmz(0)=Checkbox3.getChecked()
if xmz(0) then
xmz(1)=trim(txtxmz.value )
str=str & " and xmz like “%" & xmz(1) & "%“"
end if
xm(0)=Checkbox4.getChecked()
if xm(0) then
xm(1)=trim(tztxm.value )
str=str & " and xm like “%" & xm(1) & "%“"
end if
szfx(0)=Checkbox5.getChecked()
if szfx(0) then
szfx(1)=Listbox3.getText(Listbox3.selectedIndex )
str =str & " and szfx =“" & szfx(1) & "“"
end if
szxs(0)=Checkbox6.getChecked()
if szxs(0) then
szxs(1)=Listbox4.getText(Listbox4.selectedIndex )
str =str & " and szxs =“" & szxs(1) & "“"
end if
jbr(0)=Checkbox8.getChecked()
if jbr(0) then
jbr(1)=trim(txtjbr.value )
str =str & " and jbr like “%" & jbr(1) & "%“"
end if
set cnn2=server.CreateObject("adodb.connection")
set rst2=server.CreateObject("adodb.recordset")
cnn2.CursorLocation=3
cnn2.ConnectionTimeout =30
cnn2.Open "dsn=jky"
Response.Write "<table border=“1“ cellPadding=0 cellSpacing=0 width=“650“ height=“33“ >"
Response.Write "<tr>"
Response.Write "<td width=“100%“ colspan=“6“ height=“44“ align=“middle“ bgcolor=lightblue>"
Response.Write "<p align=“center“><b><font color=“#000084“>记 帐 凭 证 列 表"
Response.Write "</font></b></p></td></tr> "
Response.Write "<tr>"
Response.Write "<td width=“15%“ bgcolor=lightsteelblue>"
Response.Write "部 门</td>"
Response.Write "<td width=“20%“bgcolor=lightsteelblue>"
Response.Write "子公司</td>"
Response.Write "<td width=“15%“ bgcolor=lightsteelblue>"
Response.Write "项目组</td>"
Response.Write "<td width=“15%“ bgcolor=lightsteelblue>"
Response.Write "项目名/合同号</td>"
Response.Write "<td width=“15%“ bgcolor=lightsteelblue>"
Response.Write "收入金额(万元)</td>"
Response.Write "<td width=“15%“ bgcolor=lightsteelblue>"
Response.Write "支出金额(万元)</td></tr>"
if session("Tright")="1" then
“Response.Write "AAAAAAAA"
rst2.Open "select * from jzpz where id>0 and lrr=“" & session("username") & "“" & str ,cnn2,1,1,adcmdtext
else
“Response.Write "FFFFFFFFFFFFF"
rst2.Open "select * from jzpz where id>0 " & str ,cnn2,1,1,adcmdtext
end if
if rst2.RecordCount >0 then
rst2.MoveFirst
rst2.PageSize =20
rst2.AbsolutePage =1
i=0
do while not rst2.EOF and i< rst2.PageSize
Response.Write "<tr>"
Response.Write "<td width=“15%“ bgcolor=lightgrey>"& rst2.Fields("bm")& "</td>"
Response.Write "<td width=“15%“ bgcolor=lightgrey>"& rst2.Fields("zgs")& "</td>"
Response.Write "<td width=“15%“ bgcolor=lightgrey>"& rst2.Fields("xmz")& "</td>"
Response.Write "<td width=“15%“ bgcolor=lightgrey><a href=“FMjz1.asp?Id="& rst2.Fields("id") & "“
target=“_blank“>" & rst2.Fields("xm")& "</a></td>"
Response.Write "<td width=“5%“ bgcolor=lightgrey>"& rst2.Fields("sr")& "</td>"
Response.Write "<td width=“5%“ bgcolor=lightgrey>"& rst2.Fields("zc")& "</td>"
Response.Write "</tr>"
i=i+1
rst2.MoveNext
loop
end if
Response.Write "</table>"
Response.Write "</div>"
j= rst2.PageCount
Response.Write "<P align=center><b>共有页数: "
for i=1 to j
Response.Write "<a href=“Fmjzpzck1.asp?ID=" & i & "“ target=“_blank“>" & i & "</a>" & " "
if j mod 10= 0 then
Response.Write "<br>"
end if
next
Response.Write "</b></p>"
rst2.Close
cnn2.Close
…………
end sub
应用以上程序,可以根据用户的权限,按照用户的要求实行订制查询,该系统在win NT、IIS4.0和win98、PWS上运行通过。
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新日志
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]