CodeIgniter Forums
Sessions not working properly on live server - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Sessions not working properly on live server (/thread-63597.html)



Sessions not working properly on live server - webmachine - 11-17-2015

I am building my CI application locally using XAMPP and all was well, so I decided to upload it to my hosting provider's server to demo it to my client.

I had problems with SESSIONS. I checked and fixed file and directory permissions, tried setting $config['sess_save_path'] to a cache directory with no luck, so I switched to database sessions and set up a ci_sessions table in my database. That got me as far as my login form (the index method in my Users.php controller), but when I logged in, I got the message 'No input file specified'.

Here is my login method from my Users.php controller:

PHP Code:
public function login() {
        
        
$this->form_validation->set_rules('email''Email Address''trim|required|valid_email');
        
$this->form_validation->set_rules('password''Password''trim|required|min_length[3]');
        
        if (
$this->form_validation->run() == FALSE) {
            
            
$data = array(
                    
'errors' => validation_errors()
                    );
            
$this->session->set_flashdata($data);        

            
redirect('users');
            
        } else {
            
            
$email $this->input->post('email');
            
$password $this->input->post('password');
            
            
$user_id $this->user_model->login_user($email$password);
                    
            if (
$user_id) {
                
$_SESSION['user_id'] = $user_id;
                
$_SESSION['logged_in'] = true;
                
$_SESSION['user_role'] = $this->user_model->get_user_role($user_id);
                
                
$this->session->set_flashdata('login_success''You are now logged in');
                
                if (
$_SESSION['user_role']->role_id == '1') {
                    
                    
redirect('admin/administrators');
                    
                } elseif (
$_SESSION['user_role']->role_id == '2') {
                    
                    
redirect('careplanners');
                    
                } elseif (
$_SESSION['user_role']->role_id == '3') {
                    
                    
redirect('coordinators');
                    
                }
                
            } else {
                
                
$this->session->set_flashdata('login_failure''That is an incorrect email/password combination. Please try again.');
                
                
redirect('users');

            }
            
        }
        
    } 

Why is this no longer working for me?


RE: Sessions not working properly on live server - Bhavesh - 11-17-2015

Hi

Change $config['sess_save_path'] = NULL; to $config['sess_save_path'] = '' in config.php file

if error not resolved than please paste here your error or attach screen shot for error.

So I can help you


RE: Sessions not working properly on live server - kenjis - 11-17-2015

You should check your server configuration.

This is an example. I don't know it helps you or not:
https://wiki.magento.com/display/m1wiki/No+input+file+specified