Helpful Information
 
 
Category: PHP
Please!! HELP ME!!

Yo!
I need a countdown-script in PHP!!
It have to be easy to configurate!!!!
I hope someone can help me..

(I know that everything I writes not is correct english...
Thats because I'm a 12 year old boy from Norway...
And I'm not THAT good in English...)

-RiiWeN

what do you mean by countdown? does that mean the page will only be accesible a certain number of times or does that mean evry time you go to that page you need a small box which has a countdown timer? if it is the latter then a mod should throw thi over to javascript programming because thats the easiest way aof making one

That I meant was;
I want to count down to for example 15th of July...
I got a script like this;

<?

$dato = "20020715";
$mld = "dag igjen";
$mld2 = "dager igjen";
function daysbetween($start, $target) {
$start = ereg_replace("-", "", ereg_replace("/", "", $start));
$target = ereg_replace("-", "", ereg_replace("/", "", $target));
$from = mktime(0,0,0, substr($start, 4, 2), substr($start, 6, 2), substr($start, 0, 4));
$to = mktime(0,0,0, substr($target, 4, 2), substr($target, 6, 2), substr($target, 0, 4));
$daysbetween = ($to - $from) / 86400;
return $daysbetween;
}

$start = date("Ymd");
$target = "$dato";
round(daysbetween($start,$target), 0);
$igjen = ($target-$start);

echo ($igjen == 1) ? "$igjen $mld" : "$igjen $mld2";

?>

But it doesn't work...
What's wrong??
I'm verry sorry about the script is in Norwegian...:(
Transelation:
Dag(er) igjen - Day(s) left
Dato - Date
$igjen $mld - $again $mld

Somebody that understand???
I'll again tell you that I'm NOT VERY GOOD IN ENGLISH!!

-RiiWeN

Change these lines



$target = "$dato";
round(daysbetween($start,$target), 0);
$igjen = ($target-$start);


to



$target = "$dato";
$igjen = round(daysbetween($start,$target), 0);


and that should do the trick.

Alright..!!!
Thank you a lot!!!!
Are you sure if it works??
Hope so.
I'll try it.
IT WORKED!!!
THANK YOU!!

-RiiWeN










privacy (GDPR)