| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/zomuaban.com/public_html/webadmin/libraries/ |
Upload File : |
<?php
class permit_library
{
function __construct()
{
$this->CI =& get_instance();
//$this->check_permit();
}
function check_permit()
{
$module = $this->CI->uri->segment(1);
$func = $this->CI->uri->segment(2);
$this->CI->db->select('sys_permission_detail.*');
$this->CI->db->where('sys_permission_detail.permission_name',$module);
$this->CI->db->where('sys_permission_detail.function_name',$func);
$check_fn = $this->CI->db->get('sys_permission_detail')->row();
if($check_fn)
{
$admin_id = $this->CI->session->userdata('admin_id');
$this->CI->db->select('sys_permission_detail.*, sys_permission_admin.*');
$this->CI->db->join('sys_permission_detail','sys_permission_detail.function_id = sys_permission_admin.function_id');
$this->CI->db->where('sys_permission_detail.permission_name',$module);
$this->CI->db->where('sys_permission_admin.admin_id',$admin_id);
$this->CI->db->where('sys_permission_detail.function_name',$func);
$check = $this->CI->db->get('sys_permission_admin')->row();
if(!$check)
{
$this->CI->session->set_flashdata('message','Bạn không có quyền thực thi chức năng trên');
redirect($this->CI->session->userdata('Url'));
}else{
//$this->write_logs($module,$func);
}
}
}
function write_logs($Modules,$Function)
{
$Url = $this->CI->session->userdata('Url');
$AccountID = $this->CI->session->userdata('admin_id');
$data = array(
'admin_id' => $AccountID,
'Modules' => $Modules,
'Function' => $Function,
'Url' => $Url,
'LogInfo' =>$this->CI->agent->agent_string(),
'LogIP' => $this->CI->input->ip_address(),
'DateLog' => time()
);
$this->CI->db->insert('logs',$data);
}
}
?>