943,899 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 8206
  • PHP RSS
Feb 7th, 2008
0

unset $_SERVER['PHP_AUTH_USER']

Expand Post »
Hi guys,

is there anyway to unset $_SERVER['PHP_AUTH_USER'] than to close the browser?

I have tried

php Syntax (Toggle Plain Text)
  1. unset ($_SERVER['PHP_AUTH_USER'] );

or even

php Syntax (Toggle Plain Text)
  1. unset ($_SERVER);

it unset but after you have refreshed it the $_SERVER['PHP_AUTH_USER'] comes back again.

Hope to hear from you guys.Thanks
Reputation Points: 28
Solved Threads: 71
Posting Pro
ryan_vietnow is offline Offline
578 posts
since Aug 2007
Feb 7th, 2008
0

Re: unset $_SERVER['PHP_AUTH_USER']

As far as I understand, it's cached by the browsers in order to eliminate the need to constantly log in everytime you access/refresh a page. see Apache article regarding basic authentication (scroll down about half way through page).
Reputation Points: 14
Solved Threads: 14
Junior Poster in Training
johnsquibb is offline Offline
84 posts
since Nov 2007
Feb 7th, 2008
0

Re: unset $_SERVER['PHP_AUTH_USER']

Yeah,that it is meant to be but is there something to unset it for example I want to logout of the site so I would need that $_SERVER['PHP_AUTH_USER'] variable anymore?I mean can it work like sessions or cookies?
Reputation Points: 28
Solved Threads: 71
Posting Pro
ryan_vietnow is offline Offline
578 posts
since Aug 2007
Feb 7th, 2008
0

Re: unset $_SERVER['PHP_AUTH_USER']

Yeah,that it is meant to be but is there something to unset it for example I want to logout of the site so I would need that $_SERVER['PHP_AUTH_USER'] variable anymore?I mean can it work like sessions or cookies?

not as far as I can tell...there is a section in the php manual that explains forcing a new login prompt to be displayed in some browsers (see example # 3 here). -- but seems to be no way to unset the variable itself


is there a reason to not just use a session/cookie, login form, and a user/password database?
Reputation Points: 14
Solved Threads: 14
Junior Poster in Training
johnsquibb is offline Offline
84 posts
since Nov 2007
Feb 7th, 2008
0

Re: unset $_SERVER['PHP_AUTH_USER']

First of all the site I am editing has no database management and authentication username and password comes from third party sites not from the site.Second,I think sessions/cookie cannot handle great security on the site.If I push to handle this issues by applying database management,I will have to edit the whole site itself...

What do you think?
Reputation Points: 28
Solved Threads: 71
Posting Pro
ryan_vietnow is offline Offline
578 posts
since Aug 2007
Feb 7th, 2008
1

Re: unset $_SERVER['PHP_AUTH_USER']

not having database connectivity would definitely thwart setting up your own log in/out system...

as far as security goes, basic authentication is about the worst, as it sends unencrypted 'plain text' which anyone who might be sniffing on the network can surely grab. Does the third party connection come over a secure connection (https://) ?

sessions are definitely your best bet, I usually use them in conjunction with a username/encrypted password from a mysql database...
Reputation Points: 14
Solved Threads: 14
Junior Poster in Training
johnsquibb is offline Offline
84 posts
since Nov 2007
Feb 7th, 2008
0

Re: unset $_SERVER['PHP_AUTH_USER']

OK,thanks for your help and time...
Reputation Points: 28
Solved Threads: 71
Posting Pro
ryan_vietnow is offline Offline
578 posts
since Aug 2007
Feb 7th, 2008
0

Re: unset $_SERVER['PHP_AUTH_USER']

my pleasure...
Reputation Points: 14
Solved Threads: 14
Junior Poster in Training
johnsquibb is offline Offline
84 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: login form and MySQL connection/validation error
Next Thread in PHP Forum Timeline: Website Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC