Welcome Guest, Not a member yet? Register   Sign In
logout
#1

[eluser]sree777[/eluser]
After logout while i click back button the page goes to last page.
function logout()
{
$this->session->unset_userdata('admin_id');
$this->session->unset_userdata('logged_in');
$this->session->unset_userdata('username');
$this->session->unset_userdata();
$this->session->sess_destroy();
redirect('login/','refresh');
//$this->index();
}
The page is refreshing but i can go to the last page i had taken...

how can i solve this problem
#2

[eluser]mario simaremare[/eluser]
i got the same problem, i've invoked the session->session_destroy() but there are still some session items 'alive'. how to remove all the session while someone logout?
#3

[eluser]mario simaremare[/eluser]
well, i create this:
function _clear_session(){
$this->_remove_session($this->session->all_userdata());
$this->session->sess_destroy();
}
then all sessions are going dead!
#4

[eluser]Unknown[/eluser]
your code is fine. don't worry about using the back button of the browser, you can't go anywhere else after that, you are logged out.
#5

[eluser]jbtx[/eluser]
try putting this in your controller's constructor


Code:
$this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
        $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
        $this->output->set_header('Pragma: no-cache');
        $this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
#6

[eluser]Unknown[/eluser]
[quote author="dimin" date="1322731899"][quote author="jbtx" date="1285062026"]try putting this in your controller's constructor


Code:
$this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
        $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
        $this->output->set_header('Pragma: no-cache');
        $this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
[/quote]

Great solution, it works...
Smile[/quote]


hi sir
it is great solution but when i put it into constructor of controller this work fine but some time ago every thing is go down.

plz help me to repair me site http://glms.microinn.edu.pk/

thanks in advance
#7

[eluser]DaddyBear[/eluser]
Hi

Google Chrome says the following
Quote:The web page at http://glms.microinn.edu.pk/index.php/sessions/login has resulted in too many redirects.

In my controller (using CI 2.1.0) I have the following:

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

class Admin extends CI_Controller {
    
    public function __construct() {
        parent::__construct();
        
        $this->load->model('Admin_model', 'Admin');
        $this->load->model('Pages_model', 'Pages');
        $this->load->model('Categories_model', 'Categories');
        $this->load->model('Products_model', 'Products');
        $this->load->model('Users_model', 'Users');
        $this->load->model('Orders_model', 'Orders');
        
        $this->load->library('pagination');
        
        $this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
        $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
        $this->output->set_header('Pragma: no-cache');
        $this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    }

Then the usual functions under that, public function index() { etc.

Check all your functions though, you might simply have a redirect function that keeps calling itself and creates an infinite loop.

Hope this helps.
#8

[eluser]José Neto[/eluser]
[quote author="dimin" date="1322731899"][quote author="jbtx" date="1285062026"]try putting this in your controller's constructor


Code:
$this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
        $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
        $this->output->set_header('Pragma: no-cache');
        $this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
[/quote]

Great solution, it works...
Smile[/quote]

Work fine to me!

Thanks
#9

[eluser]DaddyBear[/eluser]
Thought I would add one more bit to this.

Although
Code:
$this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
$this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
$this->output->set_header('Pragma: no-cache');
$this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
works fine, I find that with pagination, after clicking the Next button, if you then use the browser back button you get a page expired message (in FireFox).

Now I only use the following 2 lines and get rid of the must-revalidate bit and it works fine.

Code:
$this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
$this->output->set_header("Cache-Control: no-store, no-cache");

Hope this helps someone.
#10

[eluser]EdemOne[/eluser]
[quote author="PhilTem" date="1326803239"]I don't know exactly how to fix it, but I always use this code for logout-scripts

Code:
$this->CI->session->sess_destroy();
$this->CI->session->sess_create();

because sometimes sess_destroy() is enough to safely destroy the session. Calling sess_create() to create a new session with a new session-id and new, blank userdata works better (at least for me it does Wink )[/quote]


Thanks it has worked for me.




Theme © iAndrew 2016 - Forum software by © MyBB