PHP code to show if a user is logged in or not.

Status
Not open for further replies.

bostonro

Member
Messages
35
Reaction score
0
Points
6
Hi all,

Yet again another question, currently on my website (www.bostonrowingclub.x10.bx) I have the Pro Login software (script(s)) installed, I am wondering how I can show weather or not a user is logged in or not on all of my pages... I have changed most of them to .PHP

Thanks for your support,

BostonRo
 

hackeddw

New Member
Messages
5
Reaction score
0
Points
1
Are you wanting your users to see if they are logged in, or are you wanting to see which users are logged in?

If the former, you could set a cookie and check on each page if the cookie is set then run your code.
Something like this:
Code:
<?php
if(isset($_COOKIE['login_details']))
{
//code here
}
else
{
//ask user to sign in
}
?>


If the latter, you would need to use a database table or flat file. Flat file would be easier on resources, but it would be recommended not to store any identifying information in it, i.e. names. When a user logs in, it sets the database or file accordingly. When a user logs out, it removes that user from the database or file.
 
Status
Not open for further replies.
Top