Hướng dẫn how to set php_auth_user
PHP_AUTH_USER is empty. And system using the Windows login credentials. How can I change it. I wanna use the username and password entered by the user
Jonas 113k96 gold badges299 silver badges371 bronze badges asked Aug 25, 2010 at 12:45
1 See HTTP Authentication with PHP
And the description of inidices in
answered Aug 25, 2010 at 12:47
GordonGordon 307k72 gold badges525 silver badges550 bronze badges 2 If you're running PHP under IIS and using Windows Authentication you shoud find the username under one (or more) of these:
Forget about the password - when PHP starts the user has already been authorized and the script is not supposed to need it. You can use Windows Authentication to log into SQL server as the user: look at the documentaion for fastcgi.impersonate. This works as long as IIS and SQL Server are on the same system. If you keep your database elsewhere... well, you may google for Double Hop issue if you want the gory details, but the short story is that it doesn't work. I've lost a month waiting for a customer to give up and allow a plain user/pass login into his database. answered Aug 25, 2010 at 21:42
djndjn 3,94222 silver badges21 bronze badges As this came up when searching for IIS and auth_user missing, I probably found an explanation why : if you set the folder permissions to everyone : read and execute, the $_SERVER['_USER'] get no value. answered Feb 11, 2014 at 7:53
nxd4nnxd4n 211 bronze badge On JodoHost use Also, if you want to see all the Server Variables, make a small PHP Test page and put the PHP Code below in it. If you've logged in as a user, you'll see which field has your user name. Also, put this test file into the directory that is protected by .htaccess: PHP CODE:
Brad Koch 18.2k18 gold badges107 silver badges135 bronze badges answered Oct 14, 2012 at 2:22
2 It is possible to use the header() function to send an An example script fragment which would force client authentication on a page is as follows: Example #1 Basic HTTP Authentication example Hello echo " You entered {$_SERVER['PHP_AUTH_PW']} as your password.";} ?> Example #2 Digest HTTP Authentication example This example shows you how to implement a simple Digest HTTP authentication script. For more information read the » RFC 2617.
$_SERVER['PHP_AUTH_DIGEST'])) {
Instead of simply printing out PHP_AUTH_USER and PHP_AUTH_PW, as done in the above example, you may want to check the username and password for validity. Perhaps by sending a query to a database, or by looking up the user in a dbm file. Watch out for buggy
Internet Explorer browsers out there. They seem very picky about the order of the headers. Sending the WWW-Authenticate header before the
Note, however, that the above does not prevent someone who controls a non-authenticated URL from stealing passwords from authenticated URLs on the same server. Both Netscape Navigator and Internet Explorer will clear the local browser window's authentication cache for the realm upon receiving a server response of 401. This can effectively "log out" a user, forcing them to re-enter their username and password. Some people use this to "time out" logins, or provide a "log-out" button. Example #3 HTTP Authentication example forcing a new name/password
$_SERVER['PHP_AUTH_USER']) || This behavior is not required by the In order to get HTTP Authentication to work using IIS server with the CGI version of PHP you must edit your IIS configuration "
derkontrollfreak+9hy5l at gmail dot com ¶ 8 years ago
kazakevichilya at gmail dot com ¶ 10 years ago
webmaster at kratia dot com ¶ 15 years ago
= array ("mario" => "carbonell"); jake22 at gmail dot com ¶ 6 years ago
Yuriy ¶ 13 years ago
Carlos ¶ 4 years ago
john_2232 at gmail dot com ¶ 6 years ago
$parts; bitman at bitworks dot de ¶ 1 year ago
Louis ¶ 16 years ago
$_POST['logout'] == "logout") { Ome Ko ¶ 12 years ago
Anonymous ¶ 13 years ago
$matches as $m) {
admin at isprohosting dot com ¶ 15 years ago
Nicolas Merlet - admin(at)merletn.org ¶ 15 years ago
xsanychx at mail dot ru ¶ 9 years ago
$_SERVER['PHP_AUTH_PW']!= $pass || $_SERVER['PHP_AUTH_USER'] != $login)|| !$_SERVER['PHP_AUTH_USER'])
gbelyh at gmail dot com ¶ 15 years ago
Robb_Bean at gmx dot net ¶ 8 years ago
vog at notjusthosting dot com ¶ 10 years ago
charly at towebs dot com ¶ 17 years ago
'PHP_AUTH_USER =' . $_SERVER['PHP_AUTH_USER'] . ' roychri at php dot net ¶ 15 years ago
SlamJam ¶ 15 years ago
You are authorized!
spam at angstzustaen dot de ¶ 1 year ago
ceo at l-i-e dot com ¶ 11 years ago
emmanuel dot keller at net2000 dot ch ¶ 19 years ago
dan223 at gmail dot com ¶ 6 years ago
sergio dot carvalho at gmail dot com ¶ 7 years ago
Lars Stecken ¶ 14 years ago
sjeffrey at inquesis dot com ¶ 20 years ago
patrick dot moire at socopa dot fr ¶ 2 years ago
} else { h3ndrik ¶ 10 years ago
Ollie L ¶ 11 years ago
najprogramato at post dot sk ¶ 18 years ago
djreficul at yahoo dot com ¶ 16 years ago
marco dot moser at oltrefersina dot it ¶ 16 years ago
snagnever at gmail dot com ¶ 17 years ago
jason ¶ 18 years ago
kembl at example dot com ¶ 16 years ago
nuno at mail dot ideianet dot pt ¶ 18 years ago
rob at theblip dot com ¶ 18 years ago
s dot i dot g at gmx dot com ¶ 13 years ago
$_GET['logout']))
idbobby at rambler dot ru ¶ 12 years ago
= 'My realm'; web at kwi dot dk ¶ 16 years ago
siberion at hotmail dot com ¶ 17 years ago
Paul ¶ 18 years ago
steuber at aego dot de ¶ 18 years ago
Whatabrain ¶ 15 years ago
|