rendered paste bodyconfig/hooks.php
<?php
$hook['post_controller_constructor'][] = array(
'class' => 'Restricted_Access',
'function' => 'restrict',
'filename' => 'restricted_access.php',
'filepath' => 'hooks',
'params' => array()
);
?>
hooks/restricted_access.php
<?php
class Restricted_Access {
private $obj;
// Initialize: start a session
public function Restricted_Access()
{
$this->obj =& get_instance();
}
public function restrict($pages)
{
$this->obj->load->config('restricted_pages');
$current = $this->obj->uri->slash_segment(1) . $this->obj->uri->segment(2);
if(in_array($current, $this->obj->config->item('restricted_pages')))
{
if($_SESSION['gebruiker']['beheer'] != '1')
{
show_error('Geen toegang');
}
}
return;
}
}
?>