If you are probably working with a standard log in form, you should decide which type of remembering system you would like. You can use session(based on browser open/close), and cookie (based on time), you can even use both in a creative way.
But it seems you hit a rock, have you declared session_start() ? additionally remove the “||”, and just use the cookie global var.
I also recommend using only session, as cookies are incredibly insecure due to the client being able to change their content.
To be accurate, anything is hackable , but for a secure login system , saving as less as possible data over the client side, is better. Cookies are stored on client side, while sessions are on the server-side.
You can read more about that just by googling “secure log in” , it will presumably result in neat ways to protect your system.
For example, if there is not Httponly set, then javascript can change the cookie value.