Re: iis HTTP auth scripted in PHP4

From: Date: Mon, 13 Nov 2000 19:58:43 +0000
Subject: Re: iis HTTP auth scripted in PHP4
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-3820@lists.php.net to get a copy of this message
Hello Martin, These functions are not supported for the IIS (even the browser prompts you to type in a PW, but the script never gets it). But it's really easy to set the rights/permissions in the Win-explorer, but don't forget to set the "Basic Authentication" in the MMC, if a user should be able to type in his user/pw. Cu, Thomas Martin McWhorter wrote: > Hello, > > I am trying to script HTTP authentication in PHP4 using iis4 (pronounced > two-S-four) as the web server. > > I have followed a couple of examples (mostly in php3) but have had no > success. > > This is one that I have translated from php3 to four... but I still have > no luck. As well in my php.ini I turned global variables on (so that > $PHP_AUTH_USER and $PHP_AUTH_PW get passed back to the script) but still > I get no luck. > > I get the Logon Validation prompt from the browser, but it never gets > past that. > > Anyone have any success. > > I am running php-4.0.2 in isapi mode (needed for http Auth done by php > -- the 4.0.3 bin would not work in isapi) in iis I have only anonymous > authentication enabled to allow PHP to authenticate.. > > Here is my code -- well that i stole from an example: > > <?php > if ($PHP_AUTH_USER == "" && $PHP_AUTH_PW == "" && > ereg("^Basic ", > $HTTP_SERVER_VARS["HTTP_AUTHORIZATION"])) { > list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(":", > base64_decode(substr($HTTP_AUTHORIZATION, 6))); > echo $PHP_AUTH_USER, $PHP_AUTH_PW; > } > $authenticated = 0; > if ($PHP_AUTH_USER != "" || $PHP_AUTH_PW != "") { > //put your authentication here (e.g. database lookup) > $authenticated = ($PHP_AUTH_USER == "test" && $PHP_AUTH_PW = > "123"); > } > // $authenticated = "true"; > > if(!$authenticated) { > header("WWW-Authenticate: Basic realm=\"Job Address Database\""); > if (ereg("Microsoft", $HTTP_SERVER_VARS["SERVER_SOFTWARE"])) > header("Status: 401 Unauthorized"); > } else { > header("HTTP/1.0 401 Unauthorized"); > echo "Access denied"; > exit; > } > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.windows (#3820) next »