Welcome Guest, Not a member yet? Register   Sign In
different cookie handling IE vs. firefox/chrome/safari
#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.


Messages In This Thread
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-02-2012, 03:33 PM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-02-2012, 10:29 PM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-03-2012, 01:06 AM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-03-2012, 02:58 AM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-03-2012, 01:46 PM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-04-2012, 11:18 PM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-05-2012, 09:39 AM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-05-2012, 11:59 AM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-05-2012, 12:40 PM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-05-2012, 04:03 PM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-05-2012, 04:55 PM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-05-2012, 05:19 PM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-05-2012, 07:19 PM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-05-2012, 10:22 PM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-06-2012, 03:37 AM
different cookie handling IE vs. firefox/chrome/safari - by El Forum - 07-06-2012, 07:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB