samedi 7 juin 2014

how to display the content before exit() in php?


Vote count:

0




I'm using codeigniter. And in one of my admin controller, after a admin was logged in, I wanted to create a switch to check his admin level. If his level is below a certain number, he cannot view a certain page. And instead, a restriction notice page will be loaded and then the page will stop loading.



function add_user() {

$this->set_admin_level(9);
// stuffs
}

private function set_admin_level($level){

if ($this->session->userdata('admin_level') < $level ) {

$this->load->view("admin/restriction");

exit();
}

}


I tried exit() and die(), but both of them just killed the entire page without displaying anything. I know that I can do this with an if and then redirect method, but I wanted to know if I can do it the previous way.



asked 32 secs ago






Aucun commentaire:

Enregistrer un commentaire