Codeigniter Session Storage

Codeigniter Session Storage


Codeigniter Session Storage
Codeigniter Session Storage
Codeigniter Session Storage is Very simpley and easly storage Login authentication  Username stored session. Codeigniter Login form
using this code:

$this->session->set_userdata() 

I just found that setting sess_encrypt_cookie to FALSE fixed the chrome logout issue.

Session Storage Config settings following Code.

$config['sess_encrypt_cookie'] = FALSE

$config['sess_match_useragent'] = FALSE;

$config['sess_expiration'] = 8600;


$this->session->set_userdata('user_session', $user_session_data);

$autoload['libraries'] = array("session");

$this->load->library('session');

Model

 function Login($email,$pass){
         $this->db->where('username' ,$email);
         $this->db->where('password',$pass);
         $query=$this->db->get('users');  
     if ($query->num_rows == 1) {        
    return true;  
     }    
     return FALSE;
    }

Controller:

   function varification(){
            $this->load->model('login_model');
    $email=$this->input->post('email');
    $pass=$this->input->post('pass');
    $success=$this->login_model->Login($email,$pass);
    if ($success) {
                 $data = array(
                       'user_name' => $rows->username,
                       'logged_in' => TRUE,
                      'validated' => true
                 );
                $this->session->set_userdata($data);
                redirect ('site/index');
    } else{ // incorrect id or password
             redirect ('site/login');
            }
    }
Codeigniter Session Storage Dev2Tricks 5 of 5
Codeigniter Session Storage Codeigniter Session Storage Codeigniter Session Storage is Very simpley and easly storage Login authen...

Share this

Related Posts

Previous
Next Post »