unset $_SERVER['PHP_AUTH_USER']

Reply

Join Date: Aug 2007
Posts: 569
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

unset $_SERVER['PHP_AUTH_USER']

 
0
  #1
Feb 7th, 2008
Hi guys,

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

I have tried

  1. unset ($_SERVER['PHP_AUTH_USER'] );

or even

  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
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 84
Reputation: johnsquibb is an unknown quantity at this point 
Solved Threads: 14
johnsquibb's Avatar
johnsquibb johnsquibb is offline Offline
Junior Poster in Training

Re: unset $_SERVER['PHP_AUTH_USER']

 
0
  #2
Feb 7th, 2008
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).
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 569
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: unset $_SERVER['PHP_AUTH_USER']

 
0
  #3
Feb 7th, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 84
Reputation: johnsquibb is an unknown quantity at this point 
Solved Threads: 14
johnsquibb's Avatar
johnsquibb johnsquibb is offline Offline
Junior Poster in Training

Re: unset $_SERVER['PHP_AUTH_USER']

 
0
  #4
Feb 7th, 2008
Originally Posted by ryan_vietnow View Post
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?
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 569
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: unset $_SERVER['PHP_AUTH_USER']

 
0
  #5
Feb 7th, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 84
Reputation: johnsquibb is an unknown quantity at this point 
Solved Threads: 14
johnsquibb's Avatar
johnsquibb johnsquibb is offline Offline
Junior Poster in Training

Re: unset $_SERVER['PHP_AUTH_USER']

 
1
  #6
Feb 7th, 2008
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...
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 569
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: unset $_SERVER['PHP_AUTH_USER']

 
0
  #7
Feb 7th, 2008
OK,thanks for your help and time...
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 84
Reputation: johnsquibb is an unknown quantity at this point 
Solved Threads: 14
johnsquibb's Avatar
johnsquibb johnsquibb is offline Offline
Junior Poster in Training

Re: unset $_SERVER['PHP_AUTH_USER']

 
0
  #8
Feb 7th, 2008
my pleasure...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC