Jump to content


Photo

Dynamic Login/Logout link


  • Please log in to reply
2 replies to this topic

#1 Malcolmhire2001

Malcolmhire2001
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 23 May 2006 - 01:07 PM

hello i would like to create a duynamic Login/Logout link at the top of all my pages

so if the user is not logged in it displays a login link but if the user is logged in it displays a logout link

does anyone know how i would go about this?


thanks, Malcolm

#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 23 May 2006 - 01:17 PM

Just a simple if/else should do the trick:
<?php
if(isset($_SESSION['username'])) {
    echo "Logout";
} else {
    echo "Login";
}
?>


#3 Malcolmhire2001

Malcolmhire2001
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 23 May 2006 - 01:33 PM

thanks thats worked great

cheers




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users