http://www.php.net/manual/en/features.http-auth.php
und wie mach ich das jetzt, dass er zugriff gewährt, wenn ich den richtigen user und passwort angegeben habe???
[edit]
sorry... geht schon!
hatte das gestern probiert, da is es nicht gegangen, jetzt gehts:
PHP-Code:
<?php
//http://at.php.net/manual/en/features.http-auth.php
function login_error()
{
echo "error - login process failed.";
}
if (!isset($PHP_AUTH_USER))
{
header("WWW-Authenticate: Basic realm=\"Mosaic Authorization process\"");
header("HTTP/1.0 401 Unauthorized");
//Result if user hits cancel button
login_error();
}
else
{
//check the login and password
if($_SERVER['PHP_AUTH_USER']=="user" && md5($_SERVER['PHP_AUTH_PW'])=="pw(md5-verschlüsselt)")
{
//User is logged
echo "logged in...";
}
else
{
//This re-asks three times the login and password.
header( "WWW-Authenticate: Basic realm=\"Test Authentication System\"");
header("HTTP/1.0 401 Unauthorized");
//Result if user does not give good login and pass
login_error();
}
}
?>