Hello vbforums,

I am having errors with basic php authentication.

In this example i have used hard coding for username and password.

I've done database & flat file authentication in the past, but i cant seem to see the error in this code.

In fact i've taken it straight from a book.

The code...

PHP Code:
<?php
if (($_SERVER['PHP_AUTH_USER'] !='username') || ($_SERVER['PHP_AUTH_PW'] !='password'))

    {

    
header('WWW-Authenticate: Basic Realm="Members Area"');
    
header('HTTP/1.0 401 Unauthorized');
        echo(
'This is a members only area!');
        die;
    
    }
    
    
//Members stuff here

    
echo('You have reached the members area!');
?>
Maybe my php version is not up to date.

Any help would be appreciated!