Welcome Guest, Not a member yet? Register   Sign In
Codeignitger session issue
#1

[eluser]behnampmdg3[/eluser]
Hi;

In Fire fox it doesn't log me out! What is going on?

Thanks


Log in
Code:
$newdata = array('member_id'  => $data['member_details'][0]->id, 'logged_in' => TRUE);
     $this->session->set_userdata('logged_data', $newdata);

Log Out
Code:
class Log_out extends CI_Controller {

public function index()
  {
   $this->session->sess_destroy();
   redirect(base_url('log_in'), 'location', 301);
  }
  
}
#2

[eluser]zegulas[/eluser]
Try enabling the profiler and check the session's part in that.

Code:
public function index()
{
    $this->session->sess_destroy();
    $this->output->enable_profiler(TRUE);
    //redirect(base_url('log_in'), 'location', 301);
}
#3

[eluser]behnampmdg3[/eluser]
[quote author="zegulas" date="1387686643"]Try enabling the profiler and check the session's part in that.

Code:
public function index()
{
    $this->session->sess_destroy();
    $this->output->enable_profiler(TRUE);
    //redirect(base_url('log_in'), 'location', 301);
}
[/quote]



On my computer it deos NOT destroy it!!!!

logged_data Array ( [member_id] => 34 [logged_in] => 1 )
#4

[eluser]zegulas[/eluser]
show the code where you are calling logout.

if possible, paste all the related code..
#5

[eluser]behnampmdg3[/eluser]
[quote author="zegulas" date="1387700888"]show the code where you are calling logout.

if possible, paste all the related code..[/quote]I call log_out with a simple link!

Code:
class Log_out extends CI_Controller {

public function index()
  {
   $this->session->sess_destroy();
   redirect(base_url('log_in'), 'location', 301);
  }
  
}
#6

[eluser]behnampmdg3[/eluser]
Anyone?
#7

[eluser]Karman de Lange[/eluser]
FF permanent cache the standard redirect command.. sometimes not even ctrl-f5 reloads the page so you will always see the previous "cached" version of the page (the logged in one)

Try clearing your browser cache and using following custom redirect, it should prevent caching unless intentional ;-)

Code:
function my_redirect($path, $cache = false, $permanent = false) {


        if (!$cache)
        {
            header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
            header("Pragma: no-cache");
            header("Expires: " . gmdate('D, d M Y H:i:s') . ' GMT');
            header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        } else
        {
            header("Cache-Control:  must-revalidate,proxy-revalidate,private");
            header("Expires: " . gmdate('D, d M Y H:i:s', (strtotime("30 minute"))) . ' GMT');
            header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        }

        $host = $_SERVER['HTTP_HOST'];
        $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
        //$extra = 'login';
        if ($permanent)
        {
            header('HTTP/1.1 301 Moved Permanently');
        }
        header("Location: http://$host$uri/$path");
        exit;
    }
#8

[eluser]InsiteFX[/eluser]
Code:
redirect(base_url('log_in'), 'refresh');




Theme © iAndrew 2016 - Forum software by © MyBB