When a user logs in to a website what method is the best to authenticate the session? For example does setting a variable in $_SESSION that is checked and if is set the user logged in, work? I was reading this tutorial and they have if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username'])) and if this returns true the user is shown the contents of the page. Is this how it’s done?
When a user logs in to a website what method is the best to
Share
Yup, that’s the general idea.
After setting
$_SESSION['LoggedIn']toTRUEelsewhere (on the login page) you’ll check the$_SESSION['LoggedIn']to see if it’sTRUEif so, display the content