[eluser]barisv[/eluser]
Hi,
Basically, I am trying to check if the user has been logged in or not. If it is logged in, it should go to members area, if not it should go to another page that is saying "you dont have access to this page, please log in first" .
But the code as below doesnt working properly. If the user was not logged in, it concatenates both pages. I mean, first it opens restricted page, and then concatenates it with members_area' page. The die() method didnt work even if I run it in the if statement. How to handle this problem ?
Thanks in advance.
Code:
<?php
class Site extends CI_Controller{
function __construct()
{
parent::__construct();
$this->is_logged_in();
}
function is_logged_in()
{
$is_logged_in = $this->session->userdata('is_logged_in');
if(!isset($is_logged_in) || $is_logged_in != TRUE)
{
$data['main_content'] = 'restricted_page';
$this->load->view('includes/template.php',$data);
// how to stop process here. because it goes to run the function of members_area() too.
}
}
function members_area()
{
$this->load->view('members_area');
}
}
?>