Date: 03/23/01
- Next message: Matt Williams: "RE: [phplib] logout link only when logged in"
- Previous message: Adi Sieker: "[phplib] logout link only when logged in"
- In reply to: Adi Sieker: "[phplib] logout link only when logged in"
- Next in thread: Matt Williams: "RE: [phplib] logout link only when logged in"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 23 Mar 2001, at 9:42, Adi Sieker wrote:
> Hi,
>
> I thought this would be a simple task but I can't seem to find an
> elegant way todo this, or I haven't gotten my head around the phplib
> enough yet.
> I want to display a logout link on all pages off my website when a
> user is authenticated. Also on pages that _don't_ require
> authentication. What is the most elegant way of doing this with
> phplib?
>
The "right" way is a relative concept, however IMVHO you should
use Default Auth for a site with mixed auth criteria (some page
protected, some not).
In such case, being that user that have not authenticated have not
privileges, a simple test on $perm will do the trick:
<? if ($perm->have_perm("user")) { ?>
<A HREF="<? $sess->purl("logout.html"); ?>">Click to
logout</A>
<? } else { ?>
<A HREF="<? $sess->purl("page.html?login=1"); ?>">Click to
login</A>
<? } ?>
The login var is a flag that when activated will trigger a loginform.
HTH, bye
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Fabrizio Ermini Alternate E-mail:
C.so Umberto, 7 faermini <email protected>
loc. Meleto Valdarno Mail on GSM: (keep it short!)
52020 Cavriglia (AR) faermini <email protected>
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Matt Williams: "RE: [phplib] logout link only when logged in"
- Previous message: Adi Sieker: "[phplib] logout link only when logged in"
- In reply to: Adi Sieker: "[phplib] logout link only when logged in"
- Next in thread: Matt Williams: "RE: [phplib] logout link only when logged in"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

