gatekeeper script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CrazyJimmy
Forum Commoner
Posts: 34
Joined: Tue Nov 19, 2002 1:40 pm

gatekeeper script

Post by CrazyJimmy »

Hello,

I have bits of my site that only can be viewed if members have logged in.
I use the following script at the top of each page to make sure they are logged in. The script appears to work fine, just wondered if i am doing it the best way and checking enough.

Code: Select all

<?php
session_start();
IF (!isset($_SESSION['username'])) {
echo "You are not logged in or session has expired";
exit;
}



?>
User avatar
BigE
Site Admin
Posts: 139
Joined: Fri Apr 19, 2002 9:49 am
Location: Missouri, USA
Contact:

Post by BigE »

Looks good... you might also want to try empty() in that case. Otherwise everything looks good to me.
Post Reply