I've got a simple login system I need completing.
Users can login at [login to view URL], which is processed at [login to view URL] (based on the members table in my database (sql dump attached, along with all other necessary files).
TASKS:
Task 1) The [login to view URL] page may need to be tweaked to start a session.
Task 2) I'd like to display a user's status on all pages. I've set up the page [login to view URL] to show what I want here. The relevant code (which will obviously need to be altered) shows the logic I want:
<?php
if (logged_in && $member_display_name != "")
{
echo "Logged in as " . $member_display_name . ". <br/>
<a href=\"[login to view URL]\">Log Out</a>";
}
if (logged_in && $member_display_name == "")
{
echo "Logged in as " . $member_firstname . " " . $member_lastname . ". <br/>
<a href=\"[login to view URL]\">Log Out</a>";
}
else "<a href=\"[login to view URL]\">Log In</a> or <a href=\"[login to view URL]\">Join Up Now</a> "
?>
Task 3). There are a few pages on my site that I do not want people to be able to access unless they've logged in. If they try to go to one of these pages when they are not logged in, I'd like them to be redirected to [login to view URL]
This code can be put on the page entitled [login to view URL], which currently begins with the code:
<?php
if (NOT LOGGED IN)
{
/// redirect to [login to view URL] //// }
else
{
//// continue opening page ////
}
?>
Task 4. Logging out. Task 2 includes code that displays a link to [login to view URL] for users who are logged in. [login to view URL] needs to contain the code to destroy the session and log the user out.