array ( "password" => RESULT_OF_CRYPT_OF_YOUR_PASSWORD_HERE, "domain" => THE_EVERYDNS_DOMAIN, /* The following two are optional. If they are not set, the original username and password are forwarded to the everydns service. */ "outuser" => THE_EVERYDNS_USERNAME, "outpass"=> THE_EVERYDNS_PASSWORD, )); if(!isset($_SERVER['PHP_AUTH_USER'])) { header("WWW-Authenticate: Basic realm=\"dyndns\""); header("HTTP/1.0 401 Unauthorized"); echo("Hi."); exit; } $in_u = $_SERVER['PHP_AUTH_USER'] ; $in_p = $_SERVER['PHP_AUTH_PW']; $data = $users[$in_u]; if (!isset($data) || strcmp($data['password'], crypt($in_p,$data['password']))) { header("WWW-Authenticate: Basic realm=\"dyndns\""); header("HTTP/1.0 401 Unauthorized"); echo ("The password you entered is wrong."); exit; } if(!array_key_exists("myip", $_GET)) $myip = $_SERVER['REMOTE_ADDR']; else $myip = $_GET['myip']; $oldip = gethostbyname($data['domain']); $url = sprintf("http://%s:%s@dyn.everydns.net/index.php?ver=0.1&ip=%s&domain=%s", isset($data['outuser']) ? $data['outuser'] : $in_u, isset($data['outpass']) ? $data['outpass'] : $in_p, $myip, $data['domain']); $v = array(); preg_match( '/Exit code: (\d+)/i' , ($z=file_get_contents($url)), $v); switch($v[1]) { case "0": // OK! echo("good $myip"); break; case "2": // Bad authentication echo("badauth"); break; case "3": // Version check fail - should never happen. echo ("nohost"); break; case "5": // Too fast! echo("nochg $oldip"); break; case "7": echo("nohost"); break; default: echo("nohost"); // Disaster! } ?>