Home >php教程 >php手册 >php单一入口权限检查

php单一入口权限检查

WBOY
WBOYOriginal
2016-06-13 10:47:251963browse

function  checkprive(){ 
                    $M= $_SESSION['prive_list'];  //模型权限 
    $A=$_SESSION['action'];       //操作权限 
    $UrlM=$_GET['m'];             //$_GET获取模型 
    $UrlA=$_GET['a'];             //$_GET获取操作 
    if(strpos($M['m'],$UrlM)!==false||$M['m']=='all'){ 
        if(strpos($A['a'],$UrlA)!==false||$A['a']=='all') return true; 
        exit("<script>alert(&#39;你没有该操作权限!&#39;);history.go(-1) </script>"); 
        return false; 
    }else { 
        exit( "<script>alert(&#39;你没有该模块权限!&#39;);history.go(-1) </script>"); 
        return false; 
    } 


摘自 chaojie2009的专栏

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn