I am using CodeIgniter.
After I logon to the member's and click logout, I could still view the member's page when I click the BACK button.
Question Does anyone know so that if the user has logged out, it could not access the Member's page even clicking of BACK button?
Please see my code below..
Thanks..
class Site extends CI_Controller{
function index()
{
if(!isset($this->session->userdata['is_loggged_in']))
$this->login();
else
$this->_template();
}
function login()
{
$data['main_content'] = 'login_form';
$data['page_title'] = 'Login - php';
$this->load->view('include/template' , $data);
}
function validate()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('username' , 'Username' , 'trim|required' );
$this->form_validation->set_rules('password' , 'Password' , 'trim|required' );
if($this->form_validation->run() == FALSE)
{
$this->login();
}
else
{
$this->load->model('member_model' , 'member');
$query = $this->member->checklogin();
//login successful , make sure no duplicate entry during registration
if($query->num_rows() == 1)
{
$data = array(
'is_loggged_in' => TRUE ,
'username' => $this->input->post('username'),
);
$this->session->set_userdata($data);
$this->_template();
}
else
{
$data = array(
'main_content' => 'login_form' ,
'page_title' => 'Error login' ,
'page_error' => 'Invalid Username or password. '
);
$this->load->view('include/template' , $data);
}
}
}
function _template()
{
$data = array(
'main_content' => 'include/default_inc',
'page_title' => 'Welcome home ran'
);
$this->load->view('include/template' , $data);
}
function logout()
{
$this->session->sess_destroy();
redirect('site/login');
exit;
}
}
/* end of controller site */