Can any one find the bug?
Posted: Mon Nov 06, 2006 2:17 pm
I have written this script (Is hosted at http://www.shogans.com/sig/countdown2.php
However for some reason it allways counts to the thirtyith of the month. Can any one find the bug.
However for some reason it allways counts to the thirtyith of the month. Can any one find the bug.
Code: Select all
<?
// Settings
$month = 12;
$day = 08;
$year = 2006;
$target = mktime(0,0,0,$month,$day,$year);
$diff = $target - time();
// Found in google
$days = ($diff - ($diff % 86400)) / 86400;
$diff = $diff - ($days * 86400);
$hours = ($diff - ($diff % 3600)) / 3600;
$diff = $diff - ($hours * 3600);
$minutes = ($diff - ($diff % 60)) / 60;
$diff = $diff - ($minutes * 60);
$seconds = ($diff - ($diff % 1)) / 1;
//Png Stuff
header ("Content-type: image/png");
$imgname = "nintendowii.png";
//Image Creation
$img = @imagecreatefrompng ($imgname);
$white = imagecolorallocate ($img, 255, 255, 255);
//Text
imagestring ($img, 3, 210, 18, "$days day(s) $hours hour(s)", $white);
imagepng ($img);
imagedestroy ($img);
?>