首页 > 代码库 > php判断用户有没有访问权限

php判断用户有没有访问权限

    //用来检查用户的访问权限        public function check_qx($name){        //$name代表要查询的字段名字          $this->load->model(‘User_model‘);        $this->load->model(‘Admin_model‘);        $uid = $this->Admin_model->userdata(‘id‘);         $useridinfo=$this->db->query("SELECT `userid` FROM `admin_user` WHERE `id` = $uid")->result_array();               //这是得到的userid:        $userid=$useridinfo[0][‘userid‘];                 // $qxuserinfo=  $this->db->query("SELECT * FROM `qx` WHERE `userid` LIKE ‘$uid‘")->result_array();                $result = $this->db->query("SELECT * FROM `qx` WHERE `userid` LIKE ‘$userid‘")->result_array();         //这是根据对应字段得到的返回值                    $url= $_SERVER[‘HTTP_REFERER‘];        //var_dump($url);        //var_dump($url);                /*if($result[0][$name]==0){             //等于0 说明没有权力访问             //TODO 记录用户最后访问的地址,自动返回上一级目录               //$referer = $_SERVER[‘HTTP_REFERER‘];              //redirect($referer);             //echo "<script>alert(‘没有访问权限,请联系你的管理员‘);document.location.href=http://www.mamicode.com/‘$referer‘</script>";        }else{            //        };*/                /*        if($userdata[‘systemnyc‘]==0){            $referer = $_SERVER[‘HTTP_REFERER‘];            redirect($referer);        } */                  }

 

php判断用户有没有访问权限