Menu
I’m looking to have a user class, where I can register users, log them in and out etc.
My methods will be
logInUser()
RegisterUser()
ValidateEmail()
LogoutUser()
getUserFromCookie($oken, $id)
I’ll have a property such as isLoggedIn with a method of similar name
My question is on my page, I can call $User = new User();
From there I would do $User->getUserFromCookie($_COOKIE[‘userToken’], $_COOKIE[‘userId’]);
If the user token and Id matches I’ll get the user details from my db. Otherwise I don’t want to create a user object.
How can I do a if statement? such as if($User->isLoggedIn() === true) { when I’ve not set that property?