Re: [PHPLIB] Authentication question From: Michael Chaney (mdchaney <email protected>)
Date: 04/17/00

>I have the following problem.
>I'd like to use the function is_authenticated() to see if a user is already
logged in. I use the >following code fragement:

>page_open(array("sess" => "Example_Session" , "auth" => "Example_Auth"));
>$uid = $auth->is_authenticated();

>When the user is already logged in I get the user id and this is ok.
>Now if the user is not logged in, I get the login screen, but I donīt want
this to happen. I just want >the is_authenticated function to return a
false, like it is said in the manual.
>Maybe somebody how to make this work.

The "is_authenticated" method isn't hosing you up here. The login form is
shown because of your page_open, which happens to include an auth object.
You should probably look for information about using "nobody" as your
default uid.

As an aside, is_authenticated presents a slight problem. It will return the
word "form" if you abort a login process, i.e. hit a protected page while
not logged in, then move off the login form without logging in. Best bet is
to check that is_authenticated() is not empty and doesn't return "form".
Better yet would be to write a wrapper.

Michael

--
Michael Darrin Chaney
mdchaney <email protected>
http://www.michaelchaney.com

- PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>. To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in the body, not the subject, of your message.