Jump to content

Archived

This topic is now archived and is closed to further replies.

Malcolmhire2001

Dynamic Login/Logout link

Recommended Posts

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

Share this post


Link to post
Share on other sites
Just a simple if/else should do the trick:
[code]<?php
if(isset($_SESSION['username'])) {
    echo "Logout";
} else {
    echo "Login";
}
?>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.