PHP中权限管理怎样实现呀? 在你的用户表里。加一个字段,如:加一个level。不同数据。体现不同的权限。如level=1里为管理员。level=2时为普通用户。程序中再根据数据库里读出来的值进行限制。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://feyge.l79.isdns.com/feyge/article/item_php/1024023122.htm 讨论:权限设计 http://bbs.chinaunix.net/forum/viewtopic.php?t=220963你仔细读一下这个帖子~~~~真理啊~~~~ 如同c/s中不同的用户对菜单可否控制那样?我想用PHP作个树型菜单,根据不同的用户使的菜单中的内容不可见。 用户登录后把权限表读入到一个数组中,并把这个数组注册到SESSION中 $query="SELECT perm_id FROM oper_perms WHERE oper_code=\"$op_code\""; $result=ifx_query($query,$conn); if($result) { $data_row=ifx_fetch_row($result,"FIRST"); while(is_array($data_row)) { $perm_id=$data_row["perm_id"]; $perms[$perm_id]=1; $data_row=ifx_fetch_row($result,"NEXT"); } ifx_free_result($result); } session_register("perms");在须检查权限的页面开头:<?session_start();$check_perms=111;/*该页面的权限ID*/if ($_SESSION["op_code"]=="" || empty($_SESSION["op_code"])){ header("location:../errors/err_timeout.htm"); exit; }if ($_SESSION["perms"][$perm_id]!=1){ header("location:../errors/err_forbid.htm"); exit;}?> htmlspecialchars($value)导致中文丢失 nginx+php5.3.20下,file_get_contents无法使用,求助 php程序的模板标签 php declare()问题 smarty 非常棘手的问题!!! 在线等~~ 感谢 紧急求助求助 mysql的连接方式问题 一个WEB查分系统(300分) ℃ 它没有所相配的助记符,如不替换,则会显示是乱码!请问有何办法解决? javascript编程练习 新手的变量定义问题,大哥们帮网 请问
http://bbs.chinaunix.net/forum/viewtopic.php?t=220963你仔细读一下这个帖子~~~~真理啊~~~~
我想用PHP作个树型菜单,根据不同的用户使的菜单中的内容不可见。
$query="SELECT perm_id FROM oper_perms WHERE oper_code=\"$op_code\"";
$result=ifx_query($query,$conn);
if($result)
{
$data_row=ifx_fetch_row($result,"FIRST");
while(is_array($data_row))
{
$perm_id=$data_row["perm_id"];
$perms[$perm_id]=1;
$data_row=ifx_fetch_row($result,"NEXT");
}
ifx_free_result($result);
}
session_register("perms");
在须检查权限的页面开头:
<?
session_start();
$check_perms=111;/*该页面的权限ID*/
if ($_SESSION["op_code"]=="" || empty($_SESSION["op_code"]))
{
header("location:../errors/err_timeout.htm");
exit;
}
if ($_SESSION["perms"][$perm_id]!=1)
{
header("location:../errors/err_forbid.htm");
exit;
}
?>