0

I'm trying to display a menu option only for certain session id's and for some reason it displays for ALL session id's ... not just the ones i have indicated. Not too sure why it's doing this, it all looks okay to me.

<?PHP 
if(isset($_SESSION['user_id']) && $_SESSION['user_id'] == 1 ||  68)
{?>
<li><span class="qmdivider qmdividery" ></span></li>
<li><a class="qmparent" href="javascript:void(0);">ADMIN</a> 

<ul style="width:150px;">
<li><a href="/admin/">Admin Home</a></li>
<li><span class="qmdivider qmdividerx" ></span></li>
<li><span class="qmtitle" >Hit Counter</span></li>
<li><a href="javascript:void(0);">Today&nbsp;<?=$hcount?></a></li>
<li><span class="qmdivider qmdividerx" ></span></li>
</ul></li> 
<? } ?>

Any ideas?

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by EvolutionFallen
1

Your problem is with the "|| 68": if(isset($_SESSION['user_id']) && $_SESSION['user_id'] == 1 || 68) . It should be:

if(isset($_SESSION['user_id']) && $_SESSION['user_id'] == 1 || $_SESSION['user_id'] == 68)

It's like you're asking if(68) , which will of course return true. You need to compare the 68 to $_SESSION

Also, you may want to add another set of parenthesis to group the last two logical operations together:

if(isset($_SESSION['user_id']) && ($_SESSION['user_id'] == 1 || $_SESSION['user_id'] == 68))

- EF

Edited by EvolutionFallen: n/a

0

Nice. I never thought about changing it over to that. I appreciate the help. You guys are the best.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.