Jump to content

isn't this backwards?


Reaper0167

Recommended Posts

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
    }
?>

Link to comment
https://forums.phpfreaks.com/topic/167419-isnt-this-backwards/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/167419-isnt-this-backwards/#findComment-882812
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.