[FX.php List] How do I hide a set of links?

Bob Patin bob at patin.com
Sat Jul 14 16:48:22 MDT 2007


Jon,

You won't need it with session variables; what I would do is, in the  
login procedure, retrieve the field that determines the user type.  
Store that in a session variable like this:

$_SESSION['usertype'] = $findData['usertype'][0];

and then you can use it on all your pages of your site.

I "turn on and off" table rows all the time using IF statements, so  
that I can customize a page's display depending on different  
situations. Your scenario is a typical case where I'd use an IF  
statement like that.

Bob


On Jul 14, 2007, at 5:41 PM, Jon Montgomery wrote:

> Alex and Bob,
>     Thanks for the code.  Both of you said what I had tried.  So at  
> least I
> was on the right track.
>     Now tell me about the [0] that is sometimes used after  
> variables?  I was
> using  print_r($_SESSION) to make sure my username was set.  It was  
> but in
> the print out on the web page, each array had the [0] listed.  So I  
> tried it
> with the code you guys gave me.  And it works.
>     Now tell me how have I missed this before?  When do I use it  
> and when do
> I not use it?
>
>     Anyway, thanks a bunch!
>
> Jon
>
>
> On 7/14/07 5:25 PM, "Alex Gates" <alex at gandrpublishing.com> wrote:
>
>> Hi Jon -
>>
>> how about:
>>
>> <?php if($_SESSION['user'] == "manager"){?>
>> <a href="http://www.....">Link for managers only</a>
>> <?php } ?>
>>
>> be sure to start your session at the top of the page, too -  
>> session_start();
>>
>> Jon Montgomery wrote:
>>> I am using session data at login.  On my following pages, how do  
>>> I "hide"
>>> certain page links from the "users" and show them to the "managers"?
>>>
>>> I have tried some code, but am unable to make it work.  Also have  
>>> searched
>>> php.net and get no where.
>>>
>>> Any help will be greatly appreciated.
>>>
>>> Jon Montgomery
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list