Sv: [phplib] login before logout From: Klaus Seidenfaden (ks <email protected>)
Date: 05/04/01

This turned into a "think aloud" session, but I think I finally got the right idea. Read on...

-----Oprindelig meddelelse-----
Fra: darcy w. christ <darcy <email protected>>

>(...) However, i ocaasionally logout after my auth has been
>terminated because i've gone past my lifetime. So, when i try to
>logout, it first asks me to log in. Not very user friendly. Anyway, i
>suppose i need to do a test to see if i am in fact logged in, before
>trying to log out. i'm just not sure how to approach this problem. Has
>anyone resolved this. i appreciate the suggestions.

I just ran through the auth code. It seems that the expiry is detected in is_authenticated(), causing the function to return a value of false. So, on your logout page, try checking the return value of $au... - Ah, now I see the chicken/egg situation! Ok, so how about subclassing Auth, providing an alternative is_authenticated() like... Nah. Hmmm. ... AH! This should work: On your logout page, don't page_open() with the auth feature, but only with sess. Then check if there is an $auth session variable. If not, fine - you weren't logged in in the first place. If there is, do an $auth->logout() right away. No need to check for expiry. How does that sound?

-- Klaus.

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