Hi all,
I needed to setup some links and pages to expire after the end of 2005, and here is a snippet of the code I used. I was wondering, was this the best/most efficient way fo achieving this?
//set the end date and time
$end_date = "2006-1-01 00:00:00";
// adjust for server time difference
$hourdiff = "3";
$timeadjust = ($hourdiff * 60 * 60);
$date = date("Y-n-d H:i:s",time() + $timeadjust);
// Test to see if the offer has expired, if yes, then redirect
if ($date >= $end_date) {
header("Location: http://www.xyz.com/offerended.php"); /* Redirect browser */
exit;/* Make sure that code below does not get executed when we redirect. */
} else {
echo " ";
}
// The rest of my HTML code followed this...
The reason I ask, is to always try to take the best approach.
Thanks in advance,
Don