The following script is supposed to take in a date formated YYYY-MM-DD and output an image. It is also designed to display an error image if the date inputed is before the start date defined in the script or after the current date. The problem is that it doesn't seem to be outputting anything so I'm posting to see if anyone notices a problem with it.
<?php
$var = $_GET['date'];
//get date components for the input date
$datecomponents = $var;
$datecomponentsyear = $datecomponents;
$datecomponentsmonth = $datecomponents;
$datecomponentsday = $datecomponents;
$datecomponentsyear = mb_substr($datecomponentsyear,0,4);
$datecomponentsmonth = mb_substr($datecomponentsmonth,5,2);
$datecomponentsday = mb_substr($datecomponentsday,8,2);
//get date components for today's date
$upperlimit = date(DATE_ATOM);
$upperlimit = mb_substr($datecomponentsyear,0,10);
$upperlimityear = $upperlimit;
$upperlimitmonth = $upperlimit;
$upperlimitday = $upperlimit;
$upperlimityear = mb_substr($upperlimityear,0,4);
$upperlimitmonth = mb_substr($upperlimitmonth,5,2);
$upperlimitday = mb_substr($upperlimitday,8,2);
//date components for date of first comic
$lowerlimityear=2012;
$lowerlimitmonth=09;
$lowerlimitday=01;
/*image security feature: prevents the display of a comic before the date of the first comic or after today's date. The script assumes that there is a comic with a correctly formatted date available for every day from the start date to the present date. */
if($lowerlimityear>$datecomponentsyear){ $var=bad-date;}
if($lowerlimityear==$datecomponentsyear){
if($lowerlimitmonth>$datecomponentmonth){ $var=bad-date;}
if($lowerlimitmonth==$datecomponentsmonth){ if($lowerlimitday>$datecomponentsday){ $var=bad-date; }}
}
//Begin upper date verification
if($upperlimityear<$datecomponentsyear){ $var=bad-date; }
if($upperlimityear==$datecomponentsyear){
if($upperlimitmonth<$datecomponentmonth){ $var=bad-date;}
if($upperlimitmonth==$datecomponentsmonth){ if($upperlimitday<$datecomponentsday){ $var=bad-date; }}
}
$imagepath="daily/$var.gif";
$image=imagecreatefromgif($imagepath);
header('Content-Type: image/gif');
imagejpeg($image);
?>