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
It's too late but i was facing same problem luckily i solve this problem by change little bit on configurations as below.
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = TRUE; // change this
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = TRUE; // change this
$config['sess_match_useragent'] = TRUE; // change this
$config['sess_time_to_update'] = 300;
Hope this would work for you too.
Same issue with me.
Please check have you load session library in controller.
$this->load->library('session');
I have the exact same problem and here's what I do.
First, go to file system/libraries/Session/Session.php
.
Comment session_start();
on line 140
.
On function _configure
, comment few lines under // Security is king
// ini_set('session.use_trans_sid', 0);
// ini_set('session.use_strict_mode', 1);
// ini_set('session.use_cookies', 1);
// ini_set('session.use_only_cookies', 1);
// ini_set('session.hash_function', 1);
// ini_set('session.hash_bits_per_character', 4);
Second, go to file index.php
on your root project.
Put, session_start();
below <?php
Hope this helps.
First, you must make sure that there are no special characters in the session items like '\n' or '\v'. Those characters may lead your string to break in the middle. Try trim() for help.
If that's no use, maybe it's some encoding problem. Try to encrypt the session item before you set it, and decrypt it when you need to use it.
Please check your links and make sure they are written correctly. When writing absolute URLs, make sure you add the 'www' part. This was the problem in my case. I hope this helps someone.
Good: header("Location: http://www.yourdomain.com/controller/page");
Bad (breaks your session): header("Location: http://yourdomain.com/controller/page");
In my case, after some tests (with https and http in localhost) the error comes for that issue and not having properly set the $config['cookie_secure'], so you can try changing in config.php:
$config['cookie_secure'] = FALSE; // if is not under https, or true if you use https
Cheers!