PX : code

RSA Patent Countdown by Jason Costomiris
Download this code


<?php
  
/***********************************************************************
   Sample usage:
   $foo = new rsaclock;
   $clock = $foo->countdown(date("U"));
   printf("Status: %s, %s days, %s hours, %s minutes, %s seconds left.\n",
          $clock[status], $clock[days], $clock[hours], 
          $clock[min], $clock[sec]);
  ************************************************************************/

  
Class rsaclock {
    function 
countdown($now){
      
$rsa mktime(0009202000);
      
$diff $rsa $now;

      switch(
$diff) {
        case 
"$diff > 0":
          
$time["status"] = "valid";
          break;
        case 
"0":
          
$time["status"] = "just expired";
          break;
        case 
"$diff < 0":
          
$time["status"] = "expired";
          break;
      }
      
      
$time["days"] = floor($diff 86400);
      
$diff $diff 86400;
      
      
$time["hours"] = floor($diff 3600);
      
$diff $diff 3600;

      
$time["min"] = floor($diff 60);
      
$time["sec"] = $diff 60;
      
      return 
$time;
    }
  }
?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.