Authentication Issue
Posted: Tue Jun 17, 2003 11:53 am
i was trying this example from the php manual and it always returned the phrase: 'Text to send if user hits Cancel button', i guess this is because i'm not asking for authentication, but how do i that???
thnx in advance
Code: Select all
<?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>";
}
?>thnx in advance