The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

How would i place the log out link in every pages just when the user has logged in?

It depends how you implement your authentication system. Is there a session variable telling if the user is logged in? If so, then check if the variable is set and if it is then display a log out link. If it's not then display a log in link.

I am not sure if this is anymore any help but ill post it anyway in case op wanted to see how the link is handled using eg. GET method.

PHP Code:

// The link and when clicked it will set variable called $_GET['logout']echo '<a href="http://www.yourserver.com/'. $_SERVER['SCRIPT_NAME'] .'?logout">Logout</a>';

// And then you check if $_GET['logout'] is set or not and if yes you set your // logout/auth variable to something that you use to check if user is logged or not.if (isset($_GET['logout'])){$_SESSION['logged'] = false;}

$_SERVER['SCRIPT_NAME'] references to the page you are at the current moment. And CSS has nothing to do with making logout/login script in php.

The logout link will only show if the user is logged in, just place the top bit of code on each page/template you want the logout link to be displayed.

I put the echo in tamplate, it shows up even user didnt log in. Though i have set the condition like this and put it on the top of template.
<?php session_start(); ?>
<?php if(isset($_SESSION['email')) {} ?>