php 審核管理

來源:互聯網
上載者:User

標籤:

許可權管理介面

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title><script src="jquery-1.11.2.min.js"></script><?phpinclude("DBDA.php");$db = new DBDA();//查詢使用者表,查出所有資料$suser = "select * from users";$auser = $db->Query($suser);//查詢角色表,查出所有資料$sjuese = "select * from juese";$ajuese = $db->Query($sjuese);?></head><body><h1>許可權管理:使用者對應角色管理</h1><div>    請選擇使用者:    <select id="user">        <?php        foreach($auser as $v)        {            echo "<option value=‘{$v[0]}‘>{$v[2]}</option>";        }        ?>    </select></div><br /><div>    請選擇相應的角色:    <?php        foreach($ajuese as $v)        {            echo "<input type=‘checkbox‘ class=‘juese‘ value=‘{$v[0]}‘ /> {$v[1]} &nbsp;&nbsp;";        }    ?></div><br /><div><input type="button" value="儲存" id="btn" /></div></body><script type="text/javascript">$(document).ready(function(e) {        JSChecked();        $("#btn").click(function(){                //取人員的選中值        var uid = $("#user").val();                //取複選框的所有選中值        var ck = $(".juese");                var js = "";                for(var i=0;i<ck.length;i++)        {            if(ck[i].checked)            {                js = js+ck.eq(i).val()+"|";            }        }                js = js.substr(0,js.length-1);                $.ajax({            url:"quanxianchuli.php",            data:{uid:uid,js:js},            type:"POST",            dataType:"TEXT",            success: function(data){                    if(data.trim()=="OK")                    {                        alert("添加成功!");                    }                    else                    {                        alert("添加失敗!");                    }                }                            });                })            $("#user").change(function(){                JSChecked();                })        });function JSChecked(){    //取選中的使用者名稱        var uid = $("#user").val();        $.ajax({            url:"quanxianchuli2.php",            data:{uid:uid},            type:"POST",            dataType:"TEXT",            success: function(data){                                    //清空原有選中資訊                    $(".juese").prop("checked",false);                                        //找到該人員對應的角色代號數組                    var attr = data.split("|");                                        //找到所有的checkbox                    var ck = $(".juese");                                        //遍曆每個複選框,設定選中                    for(var i=0; i<ck.length;i++)                    {                        var dh = ck.eq(i).val();                        //$.inArray(dh,attr) 判斷元素是否在數組中,如果在返回所在位置的索引,如果不在返回-1                                                if($.inArray(dh,attr)>=0)                        {                            ck.eq(i).prop("checked",true);                        }                    }                                    }            });}</script></html>
View Code
<?phpinclude("DBDA.php");$db = new DBDA();$uid = $_POST["uid"];$juese = $_POST["js"];//將傳入的角色字串拆分為數組$attr = explode("|",$juese);//刪除原資料$sdel = "delete from userinjuese where userid=‘{$uid}‘";$db->Query($sdel,0);//迴圈添加資料foreach($attr as $v){    $sql = "insert into userinjuese values(‘‘,‘{$uid}‘,‘{$v}‘)";    $db->Query($sql,0);}echo "OK";
View Code
<?phpinclude("DBDA.php");$db = new DBDA();$uid = $_POST["uid"];$sql = "select jueseid from userinjuese where userid=‘{$uid}‘";echo $db->StrQuery($sql);
View Code

登陸介面

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title></head><body><h1>登入頁面</h1><form action="quanxianchuli3.php" method="post"><div>使用者名稱:<input type="text" name="uid" /></div><div>密碼:<input type="password" name="pwd" /></div><div><input type="submit" value="登入" /></div></form></body></html>
View Code
<?phpsession_start();include("DBDA.php");$db = new DBDA();$uid = $_POST["uid"];$pwd = $_POST["pwd"];$sql = "select pwd from users where uid=‘{$uid}‘";$mima = $db->StrQuery($sql);if($pwd==$mima && $uid != "" && $pwd != ""){    $_SESSION["uid"]=$uid;    header("location:quanxian3.php");}else{    echo "登入失敗!";}
View Code

首頁面

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title><style type="text/css">*{ margin:0px auto; padding:0xp}#menu{ width:90%; height:35px}.list{ width:120px; height:35px; margin-left:5px; background-color:#60C; color:white; font-family:微軟雅黑; font-size:16px; font-weight:bold; text-align:center; line-height:35px; vertical-align:middle; float:left}</style></head><?phpsession_start();include("DBDA.php");$db = new DBDA();if(empty($_SESSION["uid"])){    header("location:quanxian2.php");    exit;}$uid = $_SESSION["uid"];//根據使用者名稱查使用者對應角色表,找到相應的角色代號$sjs = "select jueseid from userinjuese where userid=‘{$uid}‘";$attr = $db->Query($sjs);//根據角色代號尋找功能$gn = array(); //存放功能的二維數組$onegn = array();//存放功能的一維數組foreach($attr as $v){    $sgn = "select ruleid from juesewithrules where jueseid=‘{$v[0]}‘";    $agn = $db->Query($sgn);    $gn = array_merge($gn,$agn);}//將二維數組轉化為一維數組foreach($gn as $v){    $onegn[] = $v[0];}//對功能的一維數組進行去重$onegn = array_unique($onegn);?><body><h1>首頁面</h1><div id="menu">    <?php    foreach($onegn as $v)    {        $sname = "select name from rules where code=‘{$v}‘";        $name = $db->StrQuery($sname);        echo "<div class=‘list‘>{$name}</div>";    }    ?></div></body></html>
View Code

 

php 審核管理

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.