【asp】请问多条件判断用户权限登陆到对应页面怎么弄(附代码)

akihashiki1 2019-11-19 03:42:27
<!--#include file="conn.asp" -->
<% if session("adminname") = "" or session("adminpassword") = "" then %>
<script>alert('你还没有登录呢');history.back();</script>
<% else %>

<%
set rswebsite=server.createobject("adodb.recordset")
sqlwebsite = "select *,web_id from website "
rswebsite.open sqlwebsite,conn,1,1
%>
<link href="css/css.css" rel="stylesheet" type="text/css">
<title>登录成功!</title>
<%
yzzh=session("adminname")
set rslx_admin=server.createobject("adodb.recordset")
sqllx_admin = "select lx_power from lx_admin where lx_username ='"&yzzh&"' "
rslx_admin.open sqllx_admin,conn,1,1
dengji = rslx_admin("lx_power")
if dengji = 1 then
%>

<style type="text/css">
<!--
.STYLE3 {color: #FF0000}
body {
background-image: url();
}
-->
</style>
<!--#include file="admin_top.asp" -->
<table width="1024" height="652" border="1" align="center" bordercolor="#F9F9F9" background="image/water.gif">
<tr>
<td width="887" height="646" align="center" valign="top" bordercolor="#3F6CB0"><table width="663" height="26" align="center">
<tr>
<td width="666" height="20" align="center" border="0"><marquee>
<span class="p12"><%=rswebsite("web_note")%></span>
</marquee>
</td>
</tr>
</table>
<p class="p11"> </p>
<p class="p11"> </p>
<p class="p11"> </p>
<p class="p11"><span class="se"><span class="red"><%=session("adminname")%></span>欢迎登录<%=rswebsite("web_title")%> 扬州市苏扬培训学校报名管理系统</span></p></td>
</tr>
</table>
<table width="1024" border="0" align="center" background="image/bg2.png">
<tr>
<td align="center" valign="top" class="se"><div align="center"><img src="image/bg2.png" width="2" height="25" />Copyright© 2009-2010 longxiang All Rights Reserved.</div></td>
</tr>
</table>
<p> </p>
<p>
<% else %>
</p>
<!--#include file="user_top.asp" -->

<table width="886" height="652" border="1" align="center" bordercolor="#F9F9F9" background="image/water.gif">
<tr>
<td width="887" height="646" align="center" valign="top" bordercolor="#3F6CB0"><table width="663" height="26" align="center">
<tr>
<td width="666" height="20" align="center" border="0"><marquee>
<span class="p12"><%=rswebsite("web_note")%></span>
</marquee>
</td>
</tr>
</table>
<p class="p11"> </p>
<p class="p11"> </p>
<p class="p11"> </p>
<p class="p11"><span class="se"><span class="red"><%=session("adminname")%></span>欢迎登录<%=rswebsite("web_title")%> 扬州市苏扬培训学校报名管理系统</span></p></td>
</tr>
</table>
<table width="880" border="0" align="center" background="image/bg2.png">
<tr>
<td align="center" valign="top" class="se"><div align="center"><img src="image/bg2.png" width="2" height="25" />Copyright© 2009-2010 longxiang All Rights Reserved.</div></td>
</tr>
</table>
<p> </p>
<p>
<% end if %>
</p>
<% rslx_admin.close
set rslx_admin = nothing
%>
<% end if %>


--------------------------

疑问是这样的,自定义dengji 为数据库用户权限,一共有3个数字。
0为 admin管理员权限 (可登陆到对应页面)
1为 普通用户权限(可登陆到普通页面)
我现在在数据库里添加了一个权限为2的用户,想登陆到对应页面,请问该如何操作。

中间我添加过几次if dengji = 2,但实际登陆到的页面还是1的页面。

谢谢各位了
...全文
131 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
akihashiki1 2019-11-20
  • 打赏
  • 举报
回复
引用 1 楼 qq_63572063 的回复:
Cint(dengji) = 2
不好意思,没能理解。 请问要加在哪
  • 打赏
  • 举报
回复
Cint(dengji) = 2

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧