You are here: Re: [PHP] HTTP User Authentication Problems « PHP « IT news, forums, messages
Re: [PHP] HTTP User Authentication Problems

Posted by "Rahul S. Johari" on 12/06/05 18:13

Ave,

Steve, I did a phpinfo() on my webhost and as it turns out, they are using a
CGI binary version, much to my surprise and dismay.

Anyhow... Do I have any alternatives for an http authentication kind of
authentication ?

Thanks,

Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180

Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: rahul@informed-sources.com
http://www.informed-sources.com

On 12/6/05 9:50 AM, "Steve McGill" <steve@bluearena.com> wrote:

> Hi Rahul,
>
> Try doing a print_r($_SERVER) to see if the variables are being set.
>
> If they aren't, take a look at the phpinfo(); -> chances are your host is
> using a CGI binary version of PHP to use together with a security wrapper
> like suPHP or phpSuExec, which might throw away the variables that you
> require.
>
> Steve
>
> ""Rahul S. Johari"" <rjohari@nycap.rr.com> schreef in bericht
> news:BFBAFEC2.111E9%rjohari@nycap.rr.com...
>
> Ave,
>
> I¹m trying to run this very simple HTTP user authentication script:
>
> <?php
> if (!isset($_SERVER['PHP_AUTH_USER'])) {
> header('WWW-Authenticate: Basic realm="Private"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Unauthorized';
> exit;
> } else {
>
> if(($_SERVER['PHP_AUTH_USER']=="try") &&
> ($_SERVER['PHP_AUTH_PW']=="try")) {
> ?>
>
> <HTML>
> <HEAD></HEAD>
> <BODY>
> My Stuff Goes Here!
> </BODY>
> </HTML>
>
>
> <?
> }
> else {
> echo "Access Denied";
> }
> }
> ?>
>
> The problem is, this script runs perfectly fine on my localhost machine at
> home, however it¹s not working on my web server (purchased webhosting). When
> I open this page on my web site, it does bring up the popup box asking for
> Username & Password ­ the problem is, even if I type the correct user/pass,
> it won¹t accept it. It keeps asking me for user/pass again and again and
> finally brings up the ³Unauthorized² text on the page.
>
> Why won¹t it allow the correct user/pass to login? I don¹t understand.
>
> The only difference between the PHP on my localhost and the PHP on my
> webhost server is that my local machine is running PHP 5 and the webhost
> server is running PHP 4.4.1

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация