newbie basic realm protection - why don't the input usr/pass stick?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone

I am hacking my way through something unrelated to this post.. but needed to stop and (real quick) pass-protect a page to use it to run some quick (*admin-only*) scripts on a shared host. ..and I see now how poor is my understanding of what seems like basic stuff. As a start for my quick understanding to pass protect a page, I used the "Example #6 Basic HTTP Authentication example", from here:
http://www.php.net/manual/en/features.http-auth.php
..which is just this:

<?php
if (!isset($_SERVER['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';
    exit;
} else {
    echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</ p>";
}
?>

..and no matter what i type in the authentication dialogue that pops up.. then after I submit it.. it just keeps looping forever popping up the dialogue.. I.e. I never get past the authenticate dialogue to see this line executed:
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";

What am I missing?

Thanks for your bothering to help with this,

------------
Govinda


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux