dropfaith Posted September 30, 2008 Share Posted September 30, 2008 So i have a set of links on http://www.lawrenceguide.org/user/index.php that i want to hide until the person is logged in so basically if the session stats logged in display links if not logged in display:none im new to php so i have little idea on how sessions work and if statements Link to comment https://forums.phpfreaks.com/topic/126514-solved-hiding-links-via-php/ Share on other sites More sharing options...
F1Fan Posted September 30, 2008 Share Posted September 30, 2008 Do you want to just hide the links when not logged in, prevent people from going to those links when they're not logged in, or both? Link to comment https://forums.phpfreaks.com/topic/126514-solved-hiding-links-via-php/#findComment-654273 Share on other sites More sharing options...
dropfaith Posted September 30, 2008 Author Share Posted September 30, 2008 the links dont actually go anywhere so i just need to hide them they are javascript to display content for each user.. if you need to see what im saying log in with but just hiding them will work as theres no content to disply without the session active anyways username: phpfreaks password: phpfreaks Link to comment https://forums.phpfreaks.com/topic/126514-solved-hiding-links-via-php/#findComment-654276 Share on other sites More sharing options...
F1Fan Posted September 30, 2008 Share Posted September 30, 2008 I don't need to log in. Right before you print out the links, just add an IF statement that looks for a $_SESSION variable that is only set if they are logged in. Link to comment https://forums.phpfreaks.com/topic/126514-solved-hiding-links-via-php/#findComment-654284 Share on other sites More sharing options...
dropfaith Posted September 30, 2008 Author Share Posted September 30, 2008 im sure this is wrong i havent checked it cause i cant get onto ftp from where im at but like this? <?php if (isset($_SESSION["username"])) { echo "LINKS WOULD BE ECHOED OUT HERE"; } else { echo ""; } ?> Link to comment https://forums.phpfreaks.com/topic/126514-solved-hiding-links-via-php/#findComment-654289 Share on other sites More sharing options...
DarkWater Posted September 30, 2008 Share Posted September 30, 2008 You don't need the else at all. Link to comment https://forums.phpfreaks.com/topic/126514-solved-hiding-links-via-php/#findComment-654303 Share on other sites More sharing options...
F1Fan Posted September 30, 2008 Share Posted September 30, 2008 DW's right. Just do this: <?php if (isset($_SESSION["username"])){ ?> PUT YOUR LINKS HERE... <?php } ?> Link to comment https://forums.phpfreaks.com/topic/126514-solved-hiding-links-via-php/#findComment-654321 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.