PHP Check if Logged In


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?


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

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