• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
different cookie handling IE vs. firefox/chrome/safari

#11
[eluser]InsiteFX[/eluser]
Read this:
PHP Net - setcookie

#12
[eluser]Aken[/eluser]
This line from the PHP docs is worth noting, also:

Quote:Because setting a cookie with a value of FALSE will try to delete the cookie, you should not use boolean values. Instead, use 0 for FALSE and 1 for TRUE.

Cookies hold string values, nothing else, so you always need to assume a cookie value is a string.

#13
[eluser]jakelehner[/eluser]
Have you tried doing:

Code:
redirect('stream', 'refresh');

Based on what InsiteFX said, the plain redirect (which does a header redirect) may not be causing IE to see the redirect as a new page reload, meaning the cookie may not be available yet.

Also, is there any particular reason you don't just use the CI Session class?

#14
[eluser]InsiteFX[/eluser]
A summing that you have an Auth Library just add this to use database sessions.
Code:
// -----------------------------------------------------------------------

/**
  * logged_in()
  *
  * Check to see if a user is logged in.
  *
  * Look in the session and return the 'logged_in' field.
  *
  * @access public
  * @return bool
  */
public function logged_in()
{
  return ($this->_ci->session->userdata('logged_in') == TRUE) ? TRUE : FALSE;
}

Create an auth_helper in ./application/helpers and autoload it.
Code:
// ------------------------------------------------------------------------

/**
* logged_in()
*
* @access public
* @return bool
*/
if ( ! function_exists('logged_in'))
{
function logged_in()
{
  $_ci = get_instance();
  return ($_ci->auth->logged_in() == TRUE) ? TRUE : FALSE;
}
}

Then you can check if the user is logged like this.
Code:
if (logged_in())
{
    // code for user is logged in.
}
else
{
    // code for user is not logged in.
}

You will need to set the logged_in field in the session user_data when they log in.

#15
[eluser]kbroich[/eluser]
[quote author="jakelehner" date="1341541144"]Have you tried doing:

Code:
redirect('stream', 'refresh');

Based on what InsiteFX said, the plain redirect (which does a header redirect) may not be causing IE to see the redirect as a new page reload, meaning the cookie may not be available yet.

Also, is there any particular reason you don't just use the CI Session class?
[/quote]

Yeah I tried it with refresh to no avail. The session class is what I will look into next.

#16
[eluser]jakelehner[/eluser]
I've had good luck with the session class. You'll use it pretty much the same as you're using your cookie now, except on login you'll set UserData, and to verify login you'll read UserData.

I also store user information (name, email, etc etc) as well for quick access.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.