PHP / JS Count Down Clock Help?!?

I am trying to install a weekly Countdown Clock on my index.php page. The problem is that when the computer clock hits 12am the clock resets back to 7 days and does not continue. it will count down for one day but that is all. The JS and PHP are in the head tag. Can you please review the code and let me know what need to change?

here is the site:

ecwvideos.com/index.php

Thank you.

[php]<?php
function getImagesFromDir($path) {
$images = array();
if ( $img_dir = @opendir($path) ) {
while ( false !== ($img_file = readdir($img_dir)) ) {
// checks for gif, jpg, png
if ( preg_match("/(.gif|.jpg|.png)$/", $img_file) ) {
$images[] = $img_file;
}
}
closedir($img_dir);
}
return $images;
}

function getRandomFromArray($ar) {
mt_srand( (double)microtime() * 1000000 ); // php 4.2+ not needed
$num = array_rand($ar);
return $ar[$num];
}
function getRandomFromArray2($ar2) {
mt_srand( (double)microtime() * 100000 ); // php 4.2+ not needed
$num2 = array_rand($ar2);
return $ar2[$num2];
}

/////////////////////////////////////////////////////////////////////
// This is the only portion of the code you may need to change.
// Indicate the location of your images

$root = $_SERVER[‘DOCUMENT_ROOT’];
// use if specifying path from root
//$root = $_SERVER[‘DOCUMENT_ROOT’];

$path = ‘/ca/images/rand/’;

// End of user modified section
/////////////////////////////////////////////////////////////////////

// Obtain list of images from directory
$imgList = getImagesFromDir($root . $path);
$img = getRandomFromArray($imgList);
$img2 = getRandomFromArray($imgList);
if ($img == $img2) {
//echo ’ this is the same image’;
$img2 = getRandomFromArray($imgList);
}

$filelink = basename($img, “.jpg”);
$filelink2 = basename($img2, “.jpg”);

?>

[/php]

Please any help :o

Sponsor our Newsletter | Privacy Policy | Terms of Service