Advertisement
Guest User

Untitled

a guest
Sep 15th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <body>
  3. <div id=time></div>
  4.  
  5.  
  6. <script type="text/javascript">
  7. window.onload = function()
  8. {
  9.     idElement = "time";
  10.     document.getElementById(idElement).innerHTML = "<?php countdown(21,00,00,9,15,2012) ?>" ;
  11.     setInterval("document.getElementById(idElement).innerHTML = '<?php countdown(21,00,00,9,15,2012) ?>'", 1000);
  12. };
  13. </script>
  14.  
  15.  
  16.  
  17. <?php
  18. function countdown($godzina,$minuta,$sekunda,$miesiac,$dzien,$rok)
  19. {
  20. $target = mktime($godzina,$minuta,$sekunda,$miesiac,$dzien,$rok);
  21. $now = time() ;
  22. $sekundy =($target-$now) ;
  23. //$sekundy =(int) ($sekundy) ;
  24.  
  25.  
  26. $check=0;
  27. if ($sekundy>0)
  28. {
  29.     if ($check==0)
  30.     {
  31.         if ($sekundy<=10000)
  32.         {
  33.         // zmien klase
  34.         $check=1;
  35.         }
  36.     }
  37.     $hours=floor($sekundy/3600);
  38.     $minutes=floor(($sekundy/60)-($hours*60));
  39.     $seconds=floor(($sekundy)-($hours*3600)-($minutes*60));
  40.    
  41.    
  42.      if($hours < 10)
  43.      $hours='0'.$hours;
  44.      
  45.      if($minutes < 10)
  46.      $minutes='0'.$minutes;
  47.      
  48.      if ($seconds < 10)
  49.      $seconds='0'.$seconds;
  50.      
  51.            
  52.            
  53.            
  54.     $all= $hours . " : " . $minutes . " : " . $seconds;
  55.     echo $all;
  56. }
  57. else
  58. {
  59. echo "Aukcja zakończona!";
  60. }
  61. }
  62. ?>
  63.  
  64.  
  65.  
  66. </body>
  67. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement