this is the function i want to execute with a 30 minute interval between each execution:
$realm = 'Restricted area';
$users = array('admin' => 'admin', 'guest' => 'guest');
$username = validate_digest($realm,$users);
function send_digest($realm) {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Digest realm="'.$realm.'",qop="auth",nonce="'.md5(uniqid()).'",opaque="'.md5($realm).'"');
die('You need to enter a valid username and password');}
function validate_digest($realm, $users) {
// Fail if no digest has been provided by the client
unset($_SERVER['PHP_AUTH_DIGEST']);
unset($digest);
unset($digest_info);
unset($request_digest);
if (!isset($_SERVER['PHP_AUTH_DIGEST'])) {send_digest($realm);}
// Fail if digest can't be parsed
$username = parse_digest($_SERVER['PHP_AUTH_DIGEST'], $realm, $users);
if ($username === false) {send_digest($realm);}
// Valid username was specified in the digest
return $username;
}
I was planning on either using ajax or javascript but i don't really know how to work with either of those programming languages.