Index Page
The index page is perhaps the simplest page of all. All we are going to do with this page is simply test to see if a user is logged in, if they are logged in welcome them and give them the option to logout. If they are not logged in we are going to provide them with a default greeting and will be asking them to login to the site by providing options that link to the login page.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <?php /***************************** File: index.php Written by: Frost of Slunked.com Tutorial: User Registration and Login System ******************************/ require($_SERVER['DOCUMENT_ROOT'] . 'login/includes/config.php'); $sOutput .= '<div id="index-body">'; if (loggedIn()) { $sOutput .= '<h2>Welcome!</h2> Hello, ' . $_SESSION['username'] . ' how are you today?<br /> <h4>Would you like to <a href="login.php?action=logout">Logout?</a></h4>'; }else { $sOutput .= '<h2>Welcome to our site</h2><br /> <h4>Would you like to <a href="login.php">login</a>?</h4> <h4>Create a new <a href="register.php">account</a>?</h4>'; } $sOutput .= '</div>'; echo $sOutput; ?> |
Now that we have the final piece of the User Registration and Login System puzzle it is time for a brief overview.

Thanks!
Thanks, very useful for a beginning php scripter,
i’m gonna use it and expand with other fields!
Very useful and straight to the point! Thanks for this.. it got me up and running in the space of 10 minutes
codes send me
it is very useful,thanks a lot!