Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
Using a php function with a 30 minute interval between each execution

The function i want to execute with a 30 minute interval between each execution is the validate_digest($realm, $users):

$realm = 'Restricted area';
$users = array('admin' => 'admin', 'guest' => 'guest');
$username = validate_digest($realm,$users);
$ati = ($_SERVER['REQUEST_TIME'] % (30*60));

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) {
       unset($_SERVER['PHP_AUTH_DIGEST']);
       unset($digest);
       unset($digest_info);
       unset($request_digest);

     if (!isset($_SERVER['PHP_AUTH_DIGEST'])) {send_digest($realm);}
     $username = parse_digest($_SERVER['PHP_AUTH_DIGEST'], $realm, $users);
     if ($username === false) {send_digest($realm);}
     return $username;
      }
function parse_digest($digest, $realm, $users) {

     $digest_info = array();

     foreach (array('username','uri','nonce','cnonce','response') as $part) {
     if (preg_match('/'.$part.'=([\'"]?)(.*?)\1/', $digest, $match)) {
        // The part was found, save it for calculation
         $digest_info[$part] = $match[2];
     }else{
        return false;
     }
    }


   if (preg_match('/qop=auth(,|$)/', $digest)) {
      $digest_info['qop'] = 'auth';
   }else{
      return false;
   }

   if (preg_match('/nc=([0-9a-f]{8})(,|$)/', $digest, $match)) {
      $digest_info['nc'] = $match[1];
   }else{
      return false;
   }

   $A1 = $digest_info['username'] . ':' . $realm . ':' . $users[$digest_info['username']];
   $A2 = $_SERVER['REQUEST_METHOD'] . ':' . $digest_info['uri'];
   $request_digest = md5(implode(':', array(md5($A1), $digest_info['nonce'],
                  $digest_info['nc'],$digest_info['cnonce'], $digest_info['qop'], md5($A2))));

   if ($request_digest != $digest_info['response']) {
      return false;
   }
   if (!isset($_SERVER['PHP_AUTH_DIGEST'])) {send_digest($realm);}
 }

I was planning on either using Ajax, JavaScript or JQuery but i don't really know how to work with either of those programming languages.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

you need to schedule a cronjob or you can use an online service like https://cron-job.org/en/

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!