[eluser]Unknown[/eluser]
i try to authenticate a user after controller request, but before the method is called (post_controller_constructor).
however, my browser is telling me the request will get in an infinite loop, so i can't output anything nor debug anything.
in codeingiter.php, here the hook is called
Code:
$EXT->_call_hook('post_controller_constructor');
my hook:
Code:
class Auth {
private $CI;
function __construct(){
$this->CI =& get_instance();
}
function authenticate(){
$this->CI->session->set_userdata(array('hook' => $_SERVER['php_self']));
if(!$this->CI->session->userdata("logged_in")) {
redirect('user/login', 'location');
}
}
}
Code:
class User extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function login(){
$this->load->view('pages/login');
$arr['un'] = $this->input->post('naam');
$arr['pw'] = $this->input->post('paswoord');
$this->session->set_userdata(array('logged_in' => $arr));
redirect($this->session->userdata('hook'), 'location');
}
}
HOW SHOULD I NAVIGATE TO GET OUT OF THE HOOK AND PROCEED WITH THE REQUESTED CONTROLLER AND METHOD, THANKS ALOT FOR REPLY !!!!!