Jump to content


Photo

How to display a hyperlink depending on session value [RESOLVED]


  • Please log in to reply
3 replies to this topic

#1 AdRock

AdRock
  • Members
  • PipPipPip
  • Advanced Member
  • 911 posts

Posted 25 August 2006 - 09:45 PM

I am trying to display a hyperlink on if the $_SESSION['user_level'] is 3

If the user is logged in and the session not started the link doesn't appear.  Also if the user level is 0, 1, 2 the link doesn't appear

I tried using something like i used in the my login
<?
if(isset($_SESSION["username"])) {
    echo "<a class='one' href='/logout'>Logout</a>";
} else {
    echo "<a class='one' href='/login'>Login</a>";
}
?>

I tried using if(isset($_SESSION["username"]=3)) but it threw up an error
If your topic has been solved, please mark the topic as SOLVED.

This helps others from identifying which topics need help still

#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 25 August 2006 - 09:48 PM

try this
if ($_SESSION['userlevel'] == 3) {
   echo '<a href="somepage.php">Userlevel 3</a>';
}

hope this helps

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 25 August 2006 - 09:49 PM

if($_SESSION["username"]==3)
{
echo("link");
}
 

Orio.
Think you're smarty?

(Gone until 20 to November)

#4 AdRock

AdRock
  • Members
  • PipPipPip
  • Advanced Member
  • 911 posts

Posted 25 August 2006 - 09:57 PM

Yep...that worked fine...thanks dudes
If your topic has been solved, please mark the topic as SOLVED.

This helps others from identifying which topics need help still




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users