[phplib] (fwd) Re: [phplib] logout link only when logged in From: Adi Sieker (adi <email protected>)
Date: 03/23/01

On Fri, 23 Mar 2001 09:23:33 -0000, "Matt Williams"
<matt <email protected>> wrote:

>A session is authenticated if it contains
>
>if($auth->auth["uid"] != false and time() < $auth->auth["exp"])
>{
> echo '<a href="logout.php">Logout</a>';
>}
>or change false to "nobody" if you're using default authentication
Yes, this is simple, but on the pages that don't need authentication I
don't have the $auth object, as it's not needed there.

>From the answers I got, it sounds like I will have to work with
default auth and permissions.
On the pages that need a real login I do something like this:
$auth->login_if($auth->auth["uid"] == "nobody");

And then I can you your suggestion to display the logout link.
if($auth->auth["uid"] != "nobody" && time() < $auth->auth["exp"]) {
   echo '<a href="logout.php">Logout</a>';
}

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>