View Full Version : Based on Today's Date, send to this page

01-08-2008, 03:21 PM
I'd like a very small script that would determine the date, and if the date falls between 2 dates, then the user would be forwarded to one page, and if it falls between another 2 dates, then they will be forwarded to another page.

I think this should be fairly simple, but i'm still learning PHP. Thanks :thumbsup:

01-08-2008, 03:33 PM
Specific dates (including year), or any year, like Jan 1 to April 15th?

Here's today's date:


$year would be 2008
$month would be 01
$day would be 08

See the manual:

... and the if statement ...
You have a logic problem ... what if it doesn't fall between either dates?

This is sort of the idea ... you should write your own script and then
come back to the forum for help with problems. You wouldn't learn much
if we wrote the script for you.

//get today's date
//do your calculations here ... all of the math
// ... math stuff
//$date1 is true if it falls between 1st 2 dates.
//$date2 is true if it falls between 2nd 2 dates.

//where it goes if it doesn't fall between either date.
$url = "http://www.mysite.com/nodates.html";

$url = "http://www.mysite.com/date1_page.html";
$url = "http://www.mysite.com/date2_page.html";
header ("location: $url");

01-08-2008, 04:20 PM
Yeah I want to write my own script. I just needed a kick in the right direction, which you certainly provided! Thanks very much!!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum