[eluser]condoace[/eluser]
I am trying to redirect a user to a login page if no sessions are detected, but my code below is not working - it just keeps redirecting to index() within the class, not checking the is_logged_in() method... any ideas??
Code:
class Cars extends CI_Controller {
function __construct()
{
parent::__construct();
$this->is_logged_in();
}
function index()
{
$this->load->view('cars/addcar_view');
}
function is_logged_in()
{
$check = $this->session->userdata('logged_in');
if(!isset($check))
{
redirect('login/index');
}
}
}