PHP实现权限管理功能示例(2)

<?php session_start(); $uid = $_POST["uid"]; $pwd = $_POST["pwd"]; require_once "./DBDA.class.php"; $db = new DBDA(); $sql = "select pwd from users where uid='{$uid}'"; $mm = $db->StrQuery($sql,0); if(!empty($pwd) && $pwd==$mm){ $_SESSION["uid"] = $uid; header("location:RBmain.php"); }else{ echo "<script>alert('用户名或密码有误!')</script>"; }

5.最后做用户的主页面RBmain.php

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>权限主页面</title> </head> <body> <?php session_start(); if(empty($_SESSION["uid"])){ header("location:RBlogin.php"); exit; } $uid = $_SESSION["uid"]; require_once "./DBDA.class.php"; $db = new DBDA(); //子查询 $sql = "select * from roleswork where code in (select * from roles_roleswork where rolesuid in (select * from users_roles where usersuid='{$uid}'))"; $arr = $db->query($sql,0); foreach($arr as $v){ echo "<div>{$v[1]}</div>"; } ?> </body> </html>

效果如图:

以上就是小编为大家带来的PHP实现权限管理功能示例的全部内容了,希望大家喜欢哦~

如果大家想了解更多游戏活动与游戏攻略,请持续关注本站,本站小编将在第一时间为大家带来最好看、最好玩、最新鲜的游戏资讯。更多精彩内容,尽在jb51游戏频道!

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a05f0c7ede1691b6a90e04c6cf5f9b67.html