Hi all, I have created three pages, a homepage, a login page and a register page. I have a div id for header, right, left and footer on each page. When the user is logged in, it returns them currently to the homepage where at the top of the page it has two small links saying "Login" and "Register" as a href links. So far I have created a successful register and login pages, but now I am trying to work out how to on the homepage div id header, how the login and register page links are displayed when no-one is logged in (i.e no session), but when they are logged in they should not be able to see the links to the login and register pages. If anyone can help i'd very much be thankful. Thanks
Normally when you use sessions you would set a variable that indicates that someone is logged in. I often set something like this. $_SESSION['userid'] = $userId; PHP: Then in your div's you can do something like this // stuff to display or everyone echo '<a href="">Home</a><a href="">About</a>'; if (isset($_SESSION['userid'])) { // stuff to display when logged in echo '<a href="">Account</a><a href="">Logout</a>'; } else { // stuff to display when not logged in echo '<a href="">Register</a><a href="">Login</a>'; } PHP: hope this helps.