en simpel løsning
<?
ob_start();
$selfSecure = 1;
$shellUser = "dit brugernavn"; //Indtast brugernavnet
$shellPswd = "din kode"; // Indtast password
$adminEmail = "din@email.dk"; // Din email adresse
$fromEmail = $_SERVER[SERVER_ADMIN];
$Version = "MBK 2.0"; // skal IKKE ændres
if($selfSecure){
if (($_SERVER[PHP_AUTH_USER]!=$shellUser)||($_SERVER[PHP_AUTH_PW]!=$shellPswd)) {
Header('WWW-Authenticate: Basic realm="Log venligst ind :)"');
Header('HTTP/1.0 401 Unauthorized');
echo "<html>
<head>
<title>Error - Access Denied</title>
</head>
<h1>Access denied</h1>
A warning message has been sent to the webmaster. Your IP address has also been recorded
<hr>
<em>$Version</em>";
if(isset($_SERVER[PHP_AUTH_USER])){
$warnMsg ="
Somebody tried to access the script on:
http://".$_SERVER["HTTP_HOST"]."$_SERVER[PHP_SELF] using the wrong username and/or password:
Date: ".date("Y-m-d H:i:s")."
IP: ".$_SERVER["REMOTE_ADDR"]."
User Agent: ".$_SERVER["HTTP_USER_AGENT"]."
username used: $_SERVER[PHP_AUTH_USER]
password used: $_SERVER[PHP_AUTH_PW]
";
mail($adminEmail,"Unauthorized Access",$warnMsg,"From: $fromEmail\nX-Mailer:$Version AutoWarn System");
}
exit;
}
}