I\'m using codeigniter as a framework.
Firstly, I use localhost
but when I change to my IP address the login function doesn\'t work anymore. I found that th
From my experience, the problems can be:
You should add one thing to your autoload.php file.
$autoload['libraries'] = array('database','session');
this will solve your session re-direction problem
Session lost after redirect in Codeigniter
I found the problem too.
You still met the problem. Please notice the session’s direction of the codeigniter. When your browser visited your website and refresh a few time, the codeigniter generated more session files under the session direction of the codeigniter.
You remand load library session on your controller file.
Please refer the following config.php setting.
When you change the about setting, please remove or clear all offline data of your browser and all sessions file of the codeigniter. Then you try to do again. It is maybe repair the problem.
If you can't still repair the problem. You can download the codeigniter package from codeigniter.org again and then extract the package for testing environment.
I was shocked at first when I encountered this problem. It happened to me because my session data had an @ sign.
The solution is to simply encode the data using base64_encode.
Eg:
$Data = urlencode( base64_encode($Email) );
$this->session->set_userdata('Data', $Data);
And to reuse it, simply do this:
$Data = base64_decode( urldecode( $this->session->userdata('Data') ) );
Hope this helps.
NEW FINDING: This problem still persists on some browsers and devices. So this is not really a solution anymore. For example, it works on Samsung Android, MicroMAX Android but not on Huawei Android.
I solved this problem by configuring the $config['cookie_domain'] to localhost
$config['cookie_domain'] = "localhost";
i initially had that variable set to fully qualified domain name such as www.exampledomain.com but meanwhile i was using a local server.
The domain that your script is running under should be the same as the domain set under $config['cookie_domain] to avoid unexpected failure with codeigniter session class.
I had the same issue, in my case that was insufficient permissions for sessions folder.
Please check php.ini for session.save_path
and config.php for $config['sess_save_path']
and make sure the folder has 777 or 757 set as permissions.