Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the netid? #2

Open
sapienza opened this issue Mar 6, 2013 · 10 comments
Open

What is the netid? #2

sapienza opened this issue Mar 6, 2013 · 10 comments

Comments

@sapienza
Copy link

sapienza commented Mar 6, 2013

No description provided.

@joeauty
Copy link
Owner

joeauty commented Mar 6, 2013

The username/account login

@sapienza
Copy link
Author

sapienza commented Mar 6, 2013

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

@joeauty
Copy link
Owner

joeauty commented Mar 6, 2013

Are there any entries in your ci_cookies table?

@sapienza
Copy link
Author

sapienza commented Mar 6, 2013

Yes, there is! only orig_page_request it's empty, the other are all filled

@sapienza
Copy link
Author

sapienza commented Mar 6, 2013

If you could help, i may share my code. =)

@joeauty
Copy link
Owner

joeauty commented Mar 7, 2013

Sure!

@sapienza
Copy link
Author

sapienza commented Mar 7, 2013

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.

@sapienza
Copy link
Author

sapienza commented Mar 7, 2013

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)

@grahammccarthy
Copy link

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.

@chaitu111
Copy link

function setCookie($netid = "", $nocookie = false)

what is $netid?
why are you setting $nocookie = false initially?
what is the meaning of $nocookie variable ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants