Reaper0167 Posted July 25, 2009 Share Posted July 25, 2009 what i'm looking to do is if the user is logged in (auth and id), then a rollover is displayed, if the user is not logged in, a inactive link is displayed. with the way i have it below, doesn't it say that if the user is logged in, show the rollover and if the user is not logged in, then show the inactive link. For some reason the isset needs the ! for it to work the way I want. I have had couple of cases that the isset has worked backwards for me. Why is that? <?php if ( (isset($_SESSION['auth'])) or (isset($_SESSION['id'])) ) { ?> <a href="http://www.somewhere.com" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('post button','','images/navbar_roll_slice_r1_c10.jpg',1)"><img src="images/navbar_slice_r1_c10.jpg" name="post button" width="130" height="23" border="0" id="post button" /></a> <?php } else { ?> <img src="images/navbar_inactive_slice_r1_c2.jpg" width="130" height="23" /> <?php } ?> Quote Link to comment Share on other sites More sharing options...
.josh Posted July 25, 2009 Share Posted July 25, 2009 isset($var) vs. !isset($var) works as intended. There's no "bug" in them that causes them to work in reverse. If you had to do the opposite to make something work, it's because something else in your script was messed up. Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 25, 2009 Share Posted July 25, 2009 Could the problem be that you should be using an AND in the comparrison instead of an OR. You state in your post what i'm looking to do is if the user is logged in (auth and id),... So, do both values have to be set for the user to be considered logged in? If so, you should be using AND instead of OR. 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.