![]() |
#2
午夜屠猪男2010-05-12 11:40
|
<%@ page contentType="text/html;charset=gb2312" language="java"%>
<%@ include file="common.jsp"%>
<%
if((String)session.getValue("Enter")!="true")
{
String errmsg="error2";
out.print("<script>alert('请先登录!');top.location.href='../login.jsp';</script>");
}else{
String Id= (String)session.getAttribute("username");
//查询该用户的角色
DBSQLManager dbsm=new DBSQLManager();
String sql="select purview from usertable where username='"+Id+"'";
dbsm.setSqlStr(sql);
dbsm.executeQuery();
ResultSet rs=dbsm.getRs();
rs.next();
String purview=rs.getString(1);
//查询该用户的角色权限
sql="select purview from rolepurview where role='"+purview+"' ";
dbsm.setSqlStr(sql);
dbsm.executeQuery();
rs=dbsm.getRs();
rs.next();
String listing=rs.getString(1);
String rolepage[]=listing.split(",");
String pageId=request.getRequestURI();
pageId=pageId.substring(pageId.lastIndexOf("/")+1);
for(int i=0;i<rolepage.length;i++)
{
if(rolepage[i].equals(pageId))
{
out.print("<script>alert('你没有权限查看!');top.location.href='admin.jsp';</script>");
}
}
}
%>
请大家帮我看看,运行不了呀