phreak3r Posted January 15, 2018 Share Posted January 15, 2018 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! Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted January 15, 2018 Solution Share Posted January 15, 2018 logout stuff login stuff Quote Link to comment Share on other sites More sharing options...
phreak3r Posted January 15, 2018 Author Share Posted January 15, 2018 <?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. Quote Link to comment Share on other sites More sharing options...
requinix Posted January 15, 2018 Share Posted January 15, 2018 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. 1 Quote Link to comment Share on other sites More sharing options...
phreak3r Posted January 15, 2018 Author Share Posted January 15, 2018 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. Quote Link to comment Share on other sites More sharing options...
phpmillion Posted January 15, 2018 Share Posted January 15, 2018 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) Quote Link to comment Share on other sites More sharing options...
phreak3r Posted January 15, 2018 Author Share Posted January 15, 2018 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.