Header and Authentification

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I want use the header authentification (HTTP/PHP module), and i've a
big problem for to get the varaibles 'PHP_AUTH-*".

This is my source code :
function authentificate() {
    header('WWW-Authenticate: Basic realm="My Realm"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Texte utilisé si le visiteur utilise le bouton

$sql = new MyDB();

$userauth =

                  if ($userauth == ($_SERVER['PHP_AUTH_USER'])) ##
Don't work
                  (or if ("maxx" == ($_SERVER['PHP_AUTH_USER'])) ##
                        echo "c bon";
                        print_r ($_SERVER);

The window popup authentification don't open and i am going directly on
my page. When i replace "$userauth" by "maxx" for example, the window
popup authentification open with no problem and i can login myself.

Re: Header and Authentification

maxx wrote:
Quoted text here. Click to load it

Way too little information for anyone to help you.  For instance - what is  
"MyDB"?  What is the function call "getAuthUser"?  What is the function call  

None of these are standard PHP calls.  If they come from a package you're using,  
I suggest you follow up with whomever supports that package.  Otherwise, we need  
to know a lot more about what's happening.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline