Simple Php script to load different pages for different days

5 replies
Please I want to make a php script which pulls up a page, and after a specified date, pulls up another script,
e.g my sales page contains a countdown timer that expires on a specified date, and after that date, a new page should be pulled up.

I did the script below:

PHP Code:
date_default_timezone_set("Africa/Lagos");
$date=date("d F Y");

if (
$date <= '31 December 2011')
{
include 
'pagedecember.html';
}
else
include 
'pagejanuary.html'

Please any suggestions on making this work?
Thanks.
#days #load #pages #php #script #simple
  • Profile picture of the author KirkMcD
    You are comparing strings, not dates.
    {{ DiscussionBoard.errors[5395956].message }}
    • Profile picture of the author upscholar200
      Originally Posted by KirkMcD View Post

      You are comparing strings, not dates.
      I'm confused? Im sorry I'm really new to php and all
      {{ DiscussionBoard.errors[5395971].message }}
  • Profile picture of the author IM-software
    Oops

    <?peeheytchpee
    date_default_timezone_set("Africa/Lagos");
    $dates = date('Y-m-d');

    if ($dates < '2012-01-01') include ('pagedecember.html');
    else include ('pagejanuary.html');
    ?>
    {{ DiscussionBoard.errors[5396184].message }}
  • Profile picture of the author upscholar200
    Thanks a million :-)
    {{ DiscussionBoard.errors[5396318].message }}
  • Profile picture of the author gaetanoc
    A more flexible solution that you might find more useful - depending on future needs

    PHP Code:

    switch () 
        { 
        case (==
    'Dec'): 
        
    //dec
            
    break; 
        case (==
    'Jan' || =='Feb' || =='Mar'): 
        
    //Q1
            
    break; 

        default :

        break;
        
        } 
    Signature
    An experienced technical programmer wants to JV with you


    I will build any kind of software, bots, web applications, desktop applications, mobile applications - you will handle marketing and sales.
    {{ DiscussionBoard.errors[5396622].message }}

Trending Topics