The next step in our project is to create the logo dot P HP page create a new document and save the
file as logout dot P. HP in your perfect cup directory.
Now insert the following block of code
here.
We've cleared each session that we'd initially created and this is done using the UNset function so
that the log in session variable f name and l name are all cleared once they're cleared we redirect
the user back to the index dot p p page.
We also pass along a variable called logout with the value set to true and you'll see why we do this
in just a moment.
Make sure you save any changes you made to this file and open your index DRP HP page.
We want to create an alert notifying the user that they've been successfully logged out of the system
and I'll show you an example on the completed Web site.
This is the message we want to display and you'll see that it's position directly underneath the address.
Here is the variable logout with the value set to true.
So in order to do this you're going to insert the following block of code directly under the address.
Here we first check to see if the variable logout is contained within our U.R.L. using the get method
if the variable is found.
We check to see if the value of the logout variable is equal to true and if the value is equal to true
we display our alert message stating that the user has been logged out of the system.
So I'm just gonna test this out now and when to refresh the blog that BHP page.
So now it's asking me to log in and I'll just log in using one of the test accounts
so we've been authenticated and it says Welcome Joel.
And here's the logout link.
So when you click logout and you can see that we have been logged out and here's the success message
I'll try to go back to the blog just to verify that we had been logged out.
So it did work because now it's asking me to log back in and so at this point you can go ahead and test
out the log in function.