removing the log-in box after signing in

When a user signs in to the website I want the sign in and sign-up buttons and boxes to disappear once they’ve signed in. Currently the sign-in box stay even when you’re on your profile page. Like the second image below:
Screen Shot 2015-03-15 at 15.12.38

Screen Shot 2015-03-15 at 15.13.56


To resolve this issue I need to change the code on the homepage (index.php) the php code for this page was like the image below:

Screen Shot 2015-03-15 at 15.14.56

Therefore, I enclosed the <div class =”login-box”> with the php code:

<?php if(!isset($_SESSION[“username”])) { ?>

<?php } ?>

This basically means if the username is not entered then show the <div class =”login-box”> otherwise if the username and password is entered then the login box will disappear.

Screen Shot 2015-03-15 at 15.15.06

Now when the user has signed in they are directed to their profile page and the <div class =”login-box”> is no longer shown.

Screen Shot 2015-03-15 at 15.12.50

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s