EllisLab text mark
Advanced Search
     
Tank Auth is_logged_in() problem
Posted: 20 June 2012 10:59 AM
Joined: 2012-06-20
1 posts

I have this problem, when user logs out, he can still go back to previous page using browsers go back button. For some reason, if it is index method then everything is working fine.

Any ideas how can I fix this problem?

Thanks!

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class 
Site extends CI_Controller
{
 
function __construct()
 
{
    parent
::__construct();

    
$this->load->helper('url');
    
$this->load->library('tank_auth');
    
$this->load->library('form_validation');
 
}

 
// Working fine
 
function index()
 
{
    
if (!$this->tank_auth->is_logged_in()) {
       redirect
('/login/');   
    
else {
       $this
->load->view('welcome_message');
    
}
 }
 
 
// id_logged_in() not working if user use browsers go back button
 
function test()
 
{
    
if (!$this->tank_auth->is_logged_in()) {
       redirect
('/login/');   
    
else {
       $this
->load->view('welcome_message');
    
}
 }

UPDATE!
I find this: http://www.robertmullaney.com/2011/08/13/disable-browser-cache-easily-with-codeigniter/
Now all I need to do is just add $this->output->nocache(); to my constructor.

If there is better solution, please let me know.
Thanks!

 
Posted: 20 July 2012 08:09 PM   [ # 1 ]   [ Rating: 0 ]
Joined: 2012-02-15
6 posts

I am having the same problem, after I log out I can hit the back button and am logged in again.

How did you fix this problem?

Is there something we can do in our controllers to destroy the session after we click log out?

Thanks