Jump to content

Changing navbar if user is logged on or not


phreak3r

Recommended Posts

Hi there PHPFreaks, phreak3r is back for the second time today! I have been trying to figure out how to implement a minor change here.

When the user is not logged in, the nav bar will display Register/Login, that has already been accomplished. When the user is logged in, the nav bar should display logout.

I am trying to figure out how to best go about doing that. Suggestions are greatly appreciated, thank you!

Link to comment
Share on other sites

<?php if (user is logged in) { ?>
logout stuff
<?php } else { ?>
login stuff
<?php } ?>

 

Yes, I have done that, but at the top of each page I include a header file with Register|Login in the navbar. I want to figure out how to dynamically change it when the user is logged in. The process of checking if the user is logged in or not takes place in another file separate from the header file. What you've provided me above is already in my script.

Link to comment
Share on other sites

I assume either you're asking for a way to violate causality, or you're waiting for someone to tell you that you have to rearrange your code.

Ahaha, quite the comedian, I assume so. Well, thank you!? Sorry for taking up valuable space with this thread, feel free to delete it.

Link to comment
Share on other sites

Yes, I have done that, but at the top of each page I include a header file with Register|Login in the navbar. I want to figure out how to dynamically change it when the user is logged in. The process of checking if the user is logged in or not takes place in another file separate from the header file. What you've provided me above is already in my script.

 

In this case, simply repeat the same logic in your header file (you can do if logged_in... else... stuff an unlimited number of times in different files)

Link to comment
Share on other sites

In this case, simply repeat the same logic in your header file (you can do if logged_in... else... stuff an unlimited number of times in different files)

 

Thanks, but 'tis this is no longer an issue, I've done it dynamically. Thank you for the help though!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.