You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
764 B
PHTML
38 lines
764 B
PHTML
8 years ago
|
<?php
|
||
|
|
||
|
if (!defined('BASEPATH'))
|
||
|
exit('No direct script access allowed');
|
||
|
/*
|
||
|
* 访问权限管理
|
||
|
*/
|
||
|
|
||
|
class Permission {
|
||
|
|
||
|
var $CI;
|
||
|
|
||
|
public function __construct() {
|
||
|
$this->CI = & get_instance();
|
||
|
}
|
||
|
|
||
|
function is_admin($auto_redirect = true)
|
||
|
{
|
||
|
$referer_url='http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||
|
$this->CI->session->set_userdata('login_referer', $referer_url);
|
||
|
if ($this->CI->session->userdata('admin_chtcdn') === FALSE) {
|
||
|
if ($auto_redirect)
|
||
|
{
|
||
|
redirect(site_url('login/index'));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|