Forum Moderators: coopster

Message Too Old, No Replies

Redirect from nav bar depending on logged in or not.

nav bar redirection depending on logged in or not

         

mudboy68

5:13 pm on Dec 13, 2008 (gmt 0)

10+ Year Member



Hi All

Yes I'm a green Horn.

Having a bit of an issue with setting navigation from my Nav bar.

Essentialy what I am trying to accomplish is: I have a members link on my Nav bar.
( nav bar segment for members section )
<?

if ($current_section == "Members Only") { ?>
<div><a href="/members/"><img src="/images/members-on.gif" width="78" height="36" alt=" Members" title=" Members" border="0" /></a></div>
<? } else

{ ?>
<div><a href="/members/"><img src="/images/members-off.gif" width="78" height="36" alt="Members" title=" Members" border="0" /></a></div>
<? } ?>

The above works great.

Now i need to add the ability for this portion of my nav bar or header menu to be able to tell if a member is logged in and redirect to a members landing page and not to the members sign up and log in page as it does now when they click the members button in the nav bar.

I was going to use something like this but not sure where in the above code it would go to be effective and I already have an if statement there.

(code I was planning on using)

<?php if ($user->id) {
<a href="/members/members.php">;
} else {
<a href="/members/">;
}
?>

Any help would be appreciated.

Cheers

Mud

sdlas

8:42 pm on Dec 13, 2008 (gmt 0)

10+ Year Member



mudboy68 welcome to Webmaster World !
well man u can use cookies
and check for the value if the user is logged the members area nav will show up
and if not the nav become the login nav bar
i hope i helped if not ask what u like

mudboy68

8:50 pm on Dec 13, 2008 (gmt 0)

10+ Year Member



Not sure on how I would go about using cookies can you elaborate?

Cheers

Mud

sdlas

8:57 pm on Dec 13, 2008 (gmt 0)

10+ Year Member



these links may help you
[w3schools.com...]
or
[php.net...]
so you set a cookie at login it many contain the password
and check for it's exsitance and it's value