I have a script that use to work, but since my PHP has changed multiple times since it did work, I'm pretty sure that the problem. This script would automatically change the background image based on the season, but no longer does. Below is the script and my current php version. Any help would be greatly appreciated!
<?php
function current_season() {
// Location of the images
$images = array(
"spring" => "/images/backgrounds/spring_day.jpg",
"summer" => "/images/backgrounds/summer_day3.jpg",
"fall" => "/images/backgrounds/fall_day4.jpg",
"winter" => "/images/backgrounds/winter_day.jpg",
);
// What is today's date - number
date_default_timezone_set("America/New York");
$day = date("z");
// Days of spring
$spring_starts = date("z", strtotime("March 1"));
$spring_ends = date("z", strtotime("May 31"));
// Days of summer
$summer_starts = date("z", strtotime("June 1"));
$summer_ends = date("z", strtotime("August 31"));
// Days of autumn
$autumn_starts = date("z", strtotime("September 1"));
$autumn_ends = date("z", strtotime("November 30"));
// Days of winter
$winter_starts = date("z", strtotime("December 1"));
$winter_ends = date("z", strtotime("February 28"));
// If $day is between the days of spring, summer, fall, and winter
if( $day >= $spring_starts && $day <= $spring_ends ) :
$season = "spring";
elseif( $day >= $summer_starts && $day <= $summer_ends ) :
$season = "summer";
elseif( $day >= $autumn_starts && $day <= $autumn_ends ) :
$season = "fall";
elseif( $day >= $winter_starts && $day <= $winter_ends ) :
$season = "winter";
endif;
$image_path = $images[$season];
echo $image_path;
}
?>
[ You are not allowed to view attachments ]