Re: $PHP_AUTH_USER
| From: | morten | Date: | Mon, 12 Nov 2001 17:12:54 +0000 |
| Subject: | Re: $PHP_AUTH_USER | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-10362@lists.php.net to get a copy of this message | ||
Hi,
Yes the first one worked, but now I'm having trouble withe this one.
How come? All these headers and $ have been a bit buggy...
<?php
if ((!isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW))) {
header( 'WWW-Authenticate: Basic realm="Private"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Authorization Required.';
exit;
} else {
echo "You entered $PHP_AUTH_USER for a username.<BR>";
echo "You entered $PHP_AUTH_PW for a password.<BR>";
}
?>
Morten
"Morten" <morten@achtung.dk> skrev i en meddelelse
news:20011112082015.37219.qmail@pb1.pair.com...
> Hi Ross,
>
> Thanks a LOT. It worked when I shifted to the LoadModule script.
>
> In all the danish sites where they wrote about php/apache they use the old
> script. How come if it is not working with headers?
>
> Morten
>
> "Ross Fleming" <r.fleming@totalise.co.uk> skrev i en meddelelse
> news:MABBLJAPGGBPMIPHMAGBEENACDAA.r.fleming@totalise.co.uk...
> > You haven't installed it as an apache module. I double checked. To see
> if
> > I'm right, just create a php script with this in it:
> > <?
> > getallheaders();
> > ?>
> >
> > If it says "call to undefined function" when u view it in explorer then
do
> > the following.
> >
> > Copy php4ts.dll to windows/system or winnt/system32 or whatever one is
> > applicable.
> >
> > Edit your httpd.conf and delete:
> > ScriptAlias /php/ "c:/php/"
> > AddType application/x-httpd-php .php
> > Action application/x-httpd-php "/php/php.exe"
> > wherever it might be and type this in its place:
> >
> > LoadModule php4_module c:/php/sapi/php4apache.dll
> > AddType application/x-httpd-php .php
> >
> > making sure of course, that c:/php is where you've got php installed.
> >
> > Restart apache and hey presto..
> >
> > Ross
> >
> > -----Original Message-----
> > From: Ross Fleming [mailto:r.fleming@totalise.co.uk]
> > Sent: 11 November 2001 22:14
> > To: Morten [Achtung]; r.fleming@clara.co.uk; php-windows@lists.php.net
> > Subject: RE: [PHP-WIN] $PHP_AUTH_USER
> >
> >
> > OK, having run the same script, I'm getting a 500 as well, still not
sure
> > why, but I know the cause. Take out
> > header("HTTP/1.0 401 Unauthorized");
> > and it works. I really don't know why this doesn't work though, so
> anyone,
> > know why
> >
> > header("HTTP/1.0 401 Unauthorised"); causes an internal server error?..
> >
> >
> > Ross
> >
> > -----Original Message-----
> > From: Morten [Achtung] [mailto:morten@achtung.dk]
> > Sent: 11 November 2001 17:35
> > To: r.fleming@clara.co.uk; php-windows@lists.php.net
> > Subject: SV: [PHP-WIN] $PHP_AUTH_USER
> >
> >
> > I am not running it as a CGI script.
> > It's install on my computer together with Apache.
> >
> > I tried several script's but the don't work. Do I have to work
> > with the php.ini file or?
> >
> > Morten
> >
> > -----Oprindelig meddelelse-----
> > Fra: Ross Fleming [mailto:r.fleming@totalise.co.uk]
> > Sendt: 11. november 2001 17:24
> > Til: morten; php-windows@lists.php.net
> > Emne: RE: [PHP-WIN] $PHP_AUTH_USER
> >
> >
> > How are you using PHP with the webserver? If you're running it as a CGI
> > script then you can't access those variables
> >
> > Ross
> >
> > -----Original Message-----
> > From: morten [mailto:morten@achtung.dk]
> > Sent: 11 November 2001 14:55
> > To: php-windows@lists.php.net
> > Subject: [PHP-WIN] $PHP_AUTH_USER
> >
> >
> > Hi,
> >
> > I am trying to find out how to use $PHP_AUTH_USER. The problem is
> > that I don't progress because of an 'Internal Server Error'. I tried
> > this
> > script
> > from php.net:
> >
> > <?php
> > if(!isset($PHP_AUTH_USER)) {
> > header("WWW-Authenticate: Basic realm=\"My Realm\"");
> > header("HTTP/1.0 401 Unauthorized");
> > echo "Text to send if user hits Cancel button\n";
> > exit;
> > } else {
> > echo "<p>Hello $PHP_AUTH_USER.</p>";
> > echo "<p>You entered $PHP_AUTH_PW as your password.</p>";
> > }
> > ?>
> >
> > But the only answer is this: Internal Server Error. Is it the php.ini
> > file
> > that's not
> > configured well, or..?
> >
> > Morten
> >
> >
> >
> > --
> > 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
> >
> >
> >
> >
> >
> >
> >
> > --
> > 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
> >
> >
> >
>
>