Hey everyone. I'm coding a simple members area for my website, but i need Alittle help.
Basically I want it to be something like /path/membersindex.php and /path/subpage.php etc.
So on every page i want there to be the code below to check if the person is logged in, and if they're not it shows a logged in screen.
So far I got:
Really what I want help with is if theres a more conventional way to do the above. Like have something like:
Thanks
Basically I want it to be something like /path/membersindex.php and /path/subpage.php etc.
So on every page i want there to be the code below to check if the person is logged in, and if they're not it shows a logged in screen.
So far I got:
PHP:
<?php
if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username']))
{
//content here
}
else
{
//put the login form here
}
<?>
Really what I want help with is if theres a more conventional way to do the above. Like have something like:
PHP:
<?php
require "sessioncheck.php"; //checks if user is logged in, if they aren't, the page displays a login screen.
//rest of the page content here
Thanks