Welcome Guest, Not a member yet? Register   Sign In
How to verify if a user is logged in?
#4

Since you set both 'username' and 'loginuser' in your session, you can use both or either of them to check if the user is logged in.

Here is a quick example using 'username' for the check
PHP Code:
// Check if username exists in session
if ($this->session->userdata('username') === NULL)
{
 
   // User is not logged in, redirect to login screen
}
else
{
 
   // User is logged in, allow access

Reply


Messages In This Thread
RE: How to verify if a user is logged in? - by silentium - 04-20-2015, 03:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB