Home >Backend Development >PHP Tutorial >PHP single entry permission check_PHP tutorial
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