Home >Backend Development >PHP Tutorial >PHP single entry permission check_PHP tutorial

PHP single entry permission check_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:48:56787browse

function checkprive(){
                       $M= $_SESSION['prive_list']; //Model permissions
$A=$_SESSION['action']; //Operation permissions
$UrlM=$_GET['m']; //$_GET gets the model
$UrlA=$_GET['a']; //$_GET acquisition operation
If(strpos($M['m'],$UrlM)!==false||$M['m']=='all'){
If(strpos($A['a'],$UrlA)!==false||$A['a']=='all') return true;
            exit("<script>alert('You do not have the permission to operate!');history.go(-1) </script>");
        return false;
}else {
exit( "<script>alert('You do not have permission for this module!');history.go(-1) </script>");
        return false;
}  
}

Excerpted from chaojie2009’s column

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478389.htmlTechArticlefunction checkprive(){ $M= $_SESSION[prive_list]; //Model permissions $A=$_SESSION[ action]; //Operation permission $UrlM=$_GET[m]; //$_GET gets the model $UrlA=$_GET[a]; //$_GET gets the operation if(strp...
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