What is the netid?
The username/account login
Thanks, but i can't make it work. I use $this->rememberme->setCookie('admin') with the username "admin" and when i try to call $this->rememberme->verifyCookie() it always came false
Are there any entries in your ci_cookies table?
Yes, there is! only orig_page_request it's empty, the other are all filled
If you could help, i may share my code. =)
Sure!
I'm using hard code user id, just to test and make it works.
my config.php
$config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_expire_on_close'] = TRUE; $config['sess_encrypt_cookie'] = FALSE; $config['sess_use_database'] = FALSE; $config['sess_table_name'] = ''; $config['sess_match_ip'] = FALSE; $config['sess_match_useragent'] = TRUE; $config['sess_time_to_update'] = 300;
My control
//if the user check the remember-me field $this->rememberme->setCookie('admin');
any time in the application, if i call $this->rememberme->verifyCookie() it returns empty.
Of course i also tried with the config below ( the same that you posted in READE.me)
$config['sess_expire_on_close'] = TRUE; $config['sess_encrypt_cookie'] = TRUE; $config['sess_use_database'] = TRUE; $config['sess_table_name'] = 'ci_sessions';
But unfortunately i can't make it works.
If i var_dump the verifyCookie() i got:
array(2) { ["PHPSESSID"]=> string(26) "g60o309cr44ak0p0hfffl5j1s2" ["ci_cookie"]=> string(334) "a:5:{s:10:"session_id";s:32:"5168fc3dd00ff7f444de39e672b32cd8";s:10:"ip_address";s:9:"127.0.0.1";s:10:"user_agent";s:120:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.155 Safari/537.22";s:13:"last_activity";i:1362662779;s:9:"user_data";s:0:"";}b5cd5cd11fcc94eb9abb4b51ee294ed2" } bool(false)
Did you ever get this working? I have the same issue as you.
I have a remember_me checkbox on my login page. When it logs the user in for the first time, a record is created in the ci_cookies table, with the appropriate netid (my user id) defined.
The cookie in my browser matches the php_session_id in the database record.
I have an is_logged_in() function that fires on every page load of the app (except the sign in page). I've added the following code to the beginning of this function:
$cookie_user = $this->rememberme->verifyCookie();
var_dump($cookie_user);
die();
It returns bool(false) everytime.
in the verifyCookie() method of the rememberme.php file, it seems to return the false from the first if statement
function verifyCookie() {
if (!$this->CI->input->cookie('rmtoken_' . str_replace('.', '_', $_SERVER['SERVER_NAME']))) {
return false;
}
...
I don't see any cookie that starts with rmtoken_ in my browser.
a var_dump() of my $_COOKIE looks like this:
array(5) {
["PHPSESSID"]=> string(32) "4cbcf753869de4eced840f258b651a86"
["__utma"]=> string(53) "80799637.267410568.1376059335.1376059335.1376059335.1"
["__utmb"]=> string(26) "80799637.6.9.1376059887550"
["__utmc"]=> string(8) "80799637"
["__utmz"]=> string(69) "80799637.1376059335.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)"
}
Any assistance would be greatly appreciated!
Cheers, Graham.
function setCookie($netid = "", $nocookie = false)
what is $netid? why are you setting $nocookie = false initially? what is the meaning of $nocookie variable ?