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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.