A very simple example of this is in my index page I have
<?php
session_start();
if($_SESSION['username'])
{
echo "<h3>Welcome ".$_SESSION['username'];
}
else
echo "<a href='RegLog.php'>Login or Register</a>"
?>
what I want is a way of determining if the user has logged in before the session is started, if they havn't logged in, then "Login or Register" will be displayed, if they have logged in, then "welcome $_SESSION['username'] will be displayed.
I suppose it is a simple if statement that is needed, however I can't for the life of me figure it out.
When I visit other pages (not index.php) it works fine as they already know that the user has logged in, its just the initial page that the user is redirected back to upon logging in that i'm having difficulty with!

New Topic/Question
Reply



MultiQuote




|