Welcome Guest, Not a member yet? Register   Sign In
IE browser not terminating session even after logging out?
#10

[eluser]novice32[/eluser]
WanWizard, thanks for helping me on this. I'm new to CI, so hopefully I'm not missing something totally.

At the time of logout, I don't create another "database session" record (with UserName value) unless the user logs in again. Also, as mentioned in my original thread, this doesn't happen in Firefox and Chrome, only IE. I assume it's browser specific.

Should I be loading a view instead of redirecting?

Here's my code:
Code:
/*** User controller *****/

    function Logout() {

        $this->session->unset_userdata('UserName');
        $this->session->sess_destroy();
        redirect('user/login');
    }

    
    function login() {

        //if user is logged in, redirect to application
        if ($this->_UserLoggedIn()) {
            redirect('secure/myapp');
        }

        $this->form_validation->set_rules('email', 'Email Address', 'required|valid_email');
        $this->form_validation->set_rules('password', 'Password', 'required');
        $this->form_validation->set_rules('email', 'email', 'callback__login_valid');
        $this->form_validation->set_error_delimiters('<p class="error">', '</p>');

        if ($this->form_validation->run() == false) {
          
            $data['UserName'] = $this->session->userdata('UserName');
            $data['content'] = $this->load->view('login', null, true);
            $this->load->view('template', $data);
        }
        else {

            //if we get here, login_valid is true (from set_rules)or returned true
            $email    = $this->input->post('email');
            $password = $this->input->post('password');

            .....
          
            $this->session->set_userdata('UserName',$email);            
            redirect('secure/myapp');

        }
    }
    
    
    
    /***** Secure controller *****/
    
    public function myapp() {
        if ($this->logged_in()) {
            $this->load->view('myapp');
        }
        else {
            redirect('user/login');

        }
    }
    
    public function logged_in() {
        return ($this->session->userdata('UserName')) ? true : false;
    }


Messages In This Thread
IE browser not terminating session even after logging out? - by El Forum - 05-17-2010, 06:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB