I kindly ask you to help me with this script. I'm a newbie in php's.
I will post below the 3 scripts that are included for the function I need; there is a countdown which I need to get it refresh automatically!
Please consider! Thank you!
###index.php###
Code: Select all
<?php
include("countdown.php");
countdown2012,02,23,10,0,0,"setup");
?>Code: Select all
<?php
// LI-Countdown by LI-Scripts
// Version: 1.0
// Date: 12 Aug 2006
// All rights reserved 2006 LI-Scripts
// DO NOT COPY OR DISTRIBUTE THIS SCRIPT UNDER YOUR OWN NAME
// VISIT OUR WEBSITE FOR UPDATED VERSIONS
// REPORT ANY BUGS, SUGGESTIONS OR QUESTIONS TO:
// http://www.liscripts.net/support.php
// Setup the variables below
// Time difference with UTC in hours. If you are west of UTC time, put a minus in front of the hours
$utc_diff = 0;
// Choose a style in which you want the countdown timer to be displayed
$style = 1;
// Enter "year" and "years" in your language
$year_text = "year";
$years_text = "years";
// Enter "day" and "days" in your language
$day_text = "day";
$days_text = "days";
// Enter "hour" and "hours" in your language
$hour_text = "hour";
$hours_text = "hours";
// Enter "minute" and "minutes" in your language
$min_text = "min";
$mins_text = "mins";
// Enter "second" and "seconds" in your language
$sec_text = "sec";
$secs_text = "secs";
// The message that will show up if the countdown is complete
$msg_complete = "Time over!";
// End of variables setup
?>Code: Select all
<?php
// LI-Countdown by LI-Scripts
// Version: 1.0
// Date: 12 Aug 2006
// All rights reserved 2006 LI-Scripts
// DO NOT COPY OR DISTRIBUTE THIS SCRIPT UNDER YOUR OWN NAME
// VISIT OUR WEBSITE FOR UPDATED VERSIONS
// REPORT ANY BUGS, SUGGESTIONS OR QUESTIONS TO:
// http://www.liscripts.net/support.php
// DO NOT CHANGE ANYTHING BELOW
function countdown($year,$month,$day,$hour,$min,$sec,$setup) {
require("$setup.php");
$future_time = mktime($hour,$min,$sec,$month,$day,$year);
$curr_time = time();
$utcdiff = date('Z', $curr_time);
$user_time = $curr_time - $utcdiff + ($utc_diff * 3600);
$time_diff = $future_time - $user_time;
switch($style) {
// Style 1
case 1:
$n_years = intval($time_diff/31536000);
$sec_rem = $time_diff%31536000;
$n_days = intval($sec_rem/86400);
$sec_rem = $sec_rem%86400;
$n_hours = intval($sec_rem/3600);
$sec_rem = $sec_rem%3600;
$n_mins = intval($sec_rem/60);
$n_secs = $sec_rem%60;
switch($n_years) {
case 0:
$layout = "";
$prev_empty = 1;
break;
case 1:
$layout = $n_years . " $year_text ";
$prev_empty = 0;
break;
default:
$layout = $n_years . " $years_text ";
$prev_empty = 0;
break;
}
switch($n_days) {
case 0:
if($prev_empty == 1) {
$layout = "";
$prev_empty = 1;
}
else {
$layout .= $n_days . " $days_text ";
$prev_empty = 0;
}
break;
case 1:
$layout .= $n_days . " $day_text ";
$prev_empty = 0;
break;
default:
$layout .= $n_days . " $days_text ";
$prev_empty = 0;
break;
}
switch($n_hours) {
case 0:
if($prev_empty == 1) {
$layout = "";
$prev_empty = 1;
}
else {
$layout .= $n_hours . " $hours_text ";
$prev_empty = 0;
}
break;
case 1:
$layout .= $n_hours . " $hour_text ";
break;
default:
$layout .= $n_hours . " $hours_text ";
break;
}
switch($n_mins) {
case 0:
if($prev_empty == 1) {
$layout = "";
$prev_empty = 1;
}
else {
$layout .= $n_mins . " $mins_text ";
$prev_empty = 0;
}
break;
case 1:
$layout .= $n_mins . " $min_text ";
break;
default:
$layout .= $n_mins . " $mins_text ";
break;
}
switch($n_secs) {
case 0:
if($prev_empty == 1) {
$layout = "";
$prev_empty = 1;
}
else {
$layout .= $n_secs . " $secs_text ";
$prev_empty = 0;
}
break;
case 1:
$layout .= $n_secs . " $sec_text ";
break;
default:
$layout .= $n_secs . " $secs_text ";
break;
}
if($layout == "" || $n_secs < 0) {
echo "$msg_complete";
}
else {
echo $layout;
}
break;
}
// End function
}
?>xComi9