PHP Check if Logged In


#1

Hello Community,
I wanted to know how I can check if a user is logged in.
I wanted to do it through a variable and then
on every page while he is logged in display his username.
Can somebody help?
Thanks.


#2

just a variable won’t do, you would need session:

http://php.net/manual/en/reserved.variables.session.php

But this has already been done before, don’t re-invent the wheel. Just find an example/tutorial and work through it