HTTP authorization header problems (host: godaddy)

Hey php fans,

I was wondering if anyone had difficulty with using http authorization headers while using godaddy as a host provider?

Examples of its usage show that you (the programmer) can code it to a chosen username and password, and the rest is taken care of (in terms of the actual security etc).

However, when I have tried to use it, the username and password I have inputted does not work; instead, it recycles the page looking for the correct information.

Also, it looks to access a folder(?) or server(?) with the name of the account I have with godaddy.

Frankly, I am just looking to see if anyone else has this problem who has a website hosted by godaddy, and if so, what they did to fix it or make it work.

Thanks.

The code:
[php]<?php
$username = ‘alien’;
$password = ‘abduction’;

$auth = 0;

if (!isset($_SERVER[‘PHP_AUTH_USER’]) || !isset($_SERVER[‘PHP_AUTH_PW’]) ||
($_SERVER[‘PHP_AUTH_USER’] != $username) || ($_SERVER[‘PHP_AUTH_PW’] != $password))
{
$auth = 1;
header(‘HTTP/1.1 401 Unauthorized’);
header(‘WWW-Authenticate: Basic realm=“Alien Abduction”’);
exit (‘

Alien Abduction

Sorry, you must enter a valid user name and password to access the Administrators page.’);
}

else if ($PHP_AUTH_USER == ‘$username’ && $PHP_AUTH_PW == ‘$passwor’)
{
$auth != 1;
echo ‘

You are authorized!

’;

}

?>[/php]

Go daddy does not allow it.

Use your local host for that chapter. Head First is a good series.

Thanks for the reply.

I kind of figured that…

So, when you say using localhost, you mean to make a manual login/pass page for it? or is there a header that godaddy WILL allow?

Just learning how to implement security etc, and beyond making a login page, am unaware of any other ways in doing it.

And yes, I have learned a hell of lot in the short amount of time in reading it, and am just craving for more!

Sponsor our Newsletter | Privacy Policy | Terms of Service