Can I attach a php script ?
<?php // a sample for digest authentication $realm="php-users"; $uri = $_SERVER['REQUEST_URI']; $nonce = time();
$username = "taro"; $password = "secret";
function auth_func() {
global $realm, $nonce; header('HTTP/1.0 401 Unauthorized');
header("WWW-authenticate: Digest realm=\"$realm\" nonce=\"$nonce\"");
die('password or user name is invalid.');
}if (empty($_SERVER['PHP_AUTH_USER'])) {
auth_func();
} else {
$username = $_SERVER['PHP_AUTH_USER'];
$response = $_SERVER['PHP_AUTH_PW'];
$nonce = $_SERVER['PHP_AUTH_NONCE']; // response based on RFC2617
$a1 = md5("$username:$realm:$password");
$a2 = md5("GET:$uri");
$response0 = md5("$a1:$nonce:$a2"); print "response1:$response<br />";
print "response0:$response0<br />";
print "nonce:$nonce</br>";
if ($response == $response0) {
print "authenticated.<br />";
} else {
print "not authenticated.<br />";
}
}
?>-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
