Create limited time offer page using PHP
I was experimenting useless data when I accidentally came across this useful tip, then I decided to share it with the Internet folks. It’s yet another date() related topic, however, date() function is a great real life tool. Its watch, it’s warning, it’s reminder, it’s past, its present, its future, it’s nothing, and it’s everything.
The following script creates a limited time offer page, which gives the visitors the ability to access that page for a certain time, then when it’s time to end that offer, the page dies, goes to underworld and sympathetic one will replace it.
No further description is needed, just see it, as it’s too little to descripe.
The Script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | <?php // start date $isValid = time(); // end date $expires = mktime(0, 0, 0, 04, 16, 2008); // If the start date is less than the end date if($isValid < $expires){ // show the offers page ?> <html> <head> <title>Limited Time Offer!</title> </head> <body> <h3>Welcome</h3> <p>This is limited time offer page.</p> </body> </html> <?php } else{ // the limited time offer has expired // show expire page ?> <html> <head> <title>Limited Time Offer Has Expired</title> </head> <body> <h3>Sorry - Limitted time offer has expired!</h3> </body> </html> <?php } ?> |
That’s the end of what I meant. Test it yourself.
Popularity: 22% [?]


Leave a Reply