working with PHP_AUTH_USER

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

working with PHP_AUTH_USER

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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...)
Post Reply