Page 1 of 1

working with PHP_AUTH_USER

Posted: Mon Apr 04, 2005 4:14 am
by pelegk2
i have 2 pages :
in 1 i ask for user name and pass:

Code: Select all

if (!isset($_SERVERї'PHP_AUTH_USER'])) {
    header('WWW-Authenticate: Basic realm=&quote;âéùú îðäì áìáã ìîòøëú äâéååï&quote;');
in the second pag i do :

Code: Select all

unset($_SERVERї'PHP_AUTH_USER']);
ater i login and go to the page withthe unset and then go to the page withthe login again it still remember the $_SERVER['PHP_AUTH_USER']) even though i did an unset to $_SERVER['PHP_AUTH_USER']))
why is that?
thnaks in advance

peleg

Posted: Mon Apr 04, 2005 5:40 am
by Chris Corbyn
I didn't know you could unset() the predefined $_SERVER vars :?

That's probably just my lack of experience of trying though.

Posted: Mon Apr 04, 2005 6:47 am
by timvw
It is the browser that stores the credentials and sends them with every request for the realm...


To realise a logout function, you could use a session variable... (be aware that even in this case the brower will keep sending the credentials...)