My Home Page
My Favorite things about Angelfire.
My Favorite Web Sites
Angelfire - Free Home Pages
Free Web Building Help
Angelfire HTML Library
HTML Gear - free polls, guestbooks, and more!
//**************************************
// for :Count Down
//**************************************
PHP CountDown created by Daniel Olfelt ©2003
//**************************************
// Name: Count Down
// Description:The purpose of this code is to have a date and find how many days there are until that date.
// By: Dan O Man
//
//
// Inputs:There are two variables. They should look something like these:
$countdown_names=array("header","End of School","My Birthday");
$countdown_dates=array("My Dates","6-5","8-13-1986");
//
// Returns:FORMAT:
- My Dates
End of School: 23 days (6-5-2003)
My Birthday: 64 days (8-13-1986)
//
//Assumes:None
//
//Side Effects:None
//This code is copyrighted and has limited warranties.
//Please see http://www.1PHPStreet.com/xq/ASP/txtCodeId.1038/lngWId.8/qx/vb/scripts/ShowCode.htm
//for details.
//**************************************
- My Dates
End of School: 23 days (6-5-2003)
My Birthday: 64 days (8-13-1986)
*/
/* Finds whether the date has already passed,
and if so, add another year */
for($i=0;$i<=count($countdown_names)-1;$i++) {
if($countdown_dates[$i] != "subhead") {
if($countdown_dates[$i] != "header") {
$split_count = split("-", $countdown_dates[$i]);
if($split_count[0] <= date("n") && $split_count[1] < date("j")) {
$year=date("Y") + 1;
} elseif($split_count[0] < date("n")) {
$year=date("Y") + 1;
} else {
$year=date("Y");
}
/* Finds the amount of days left */
$hours_left = number_format((mktime(0,0,0,$split_count[0],$split_count[1],$year) - time())/3600, 2);
if ($hours_left > 24) {
$daysLeft = ceil($hours_left/24);
}
$hours_left = (mktime(0,0,0,$split_count[0],$split_count[1],$year) - time())/3600;
if ($hours_left > 168) {
$daysLeft = ceil($hours_left/24);
} else {
$daysLeft = ceil($hours_left/24);
}
/* This is the Format for the actual dates */
print "".$countdown_names[$i].": ".$daysLeft;
if($daysLeft != 1) {
print " days";
} else {
print " day";
}
/* Prints the actual dates if they exist */
print " (".$countdown_dates[$i];
if(!$split_count[2]) {
print "-".$year.")";
} else {
print ")";
}
print "
";
} else {
/* Alter this to change the Header FONT/SIZE/ETC. */
print "
";
print $countdown_names[$i];
print "
";
}
} else {
/* Alter this to change the subheader FONT/SIZE/ETC. */
print "";
print $countdown_names[$i];
print "
";
}
}
?>