Cookie not working in codeigniter 4. Need helper |
(04-19-2020, 02:12 PM)Leo Wrote: Hi, can you post your code? Some guy on the forum was trying to set a cookie with a negative timestamp. Here is the my code for setting the cookie if ($remember === 1) { set_cookie(array( 'name' => getConfig('auth_cookie_id'), 'value' => $this->_user->enc_key, 'expire' => \time() + getConfig('auth_cookie_expiry'), 'httponly' => FALSE )); // store encrypted key in cookie set_cookie(array( 'name' => getConfig('auth_cookie_key'), 'value' => $enkey, 'expire' => \time() + getConfig('auth_cookie_expiry'), 'httponly' => FALSE )); } else { // set what will be stored in the session $data = array( getConfig('auth_session_id') => $this->_user->enc_key, getConfig('auth_session_key') => $enkey ); // store data in the session session()->set($data); } Here, is where i try to get the cookie data if (get_cookie(getConfig('auth_cookie_id'), TRUE) && get_cookie(getConfig('auth_cookie_key'), TRUE)) { // store cookie informations in variables $encryptedUserIDs = get_cookie(getConfig('auth_cookie_id'), TRUE); echo $enckey = get_cookie(getConfig('auth_cookie_key'), TRUE); $validate_using = 'cookie'; } else { // store session informations in variables $encryptedUserIDs = session()->get(getConfig('auth_session_id')); $enckey = session()->get(getConfig('auth_session_key')); $validate_using = 'session'; } |
Messages In This Thread |
Cookie not working in codeigniter 4. Need helper - by Chivinsdev - 04-19-2020, 08:46 AM
RE: Cookie not working in codeigniter 4. Need helper - by Leo - 04-19-2020, 02:12 PM
RE: Cookie not working in codeigniter 4. Need helper - by Chivinsdev - 04-20-2020, 01:35 PM
RE: Cookie not working in codeigniter 4. Need helper - by Leo - 04-20-2020, 03:18 PM
RE: Cookie not working in codeigniter 4. Need helper - by Chivinsdev - 04-20-2020, 03:37 PM
RE: Cookie not working in codeigniter 4. Need helper - by seunex - 04-20-2020, 10:08 PM
RE: Cookie not working in codeigniter 4. Need helper - by Leo - 04-20-2020, 10:26 PM
RE: Cookie not working in codeigniter 4. Need helper - by seunex - 04-21-2020, 01:55 AM
RE: Cookie not working in codeigniter 4. Need helper - by Leo - 04-21-2020, 05:15 AM
|