17 Sep
Posted by admin as PHP Matters
If you run a website and you have various advertisers in it you probably want a script to end the appearance of a certain advertise on a certain day. If this day is a year far and you have more that one or multiple cases like this its a headache to remember all this days and keep reminders about them. Their is a solution out of this running a simple two lines script. All you have to do is enter your dates and let it handle all the rest.
<?php
//—Lets say that i want to end the appearance of an advertisment in my site in 1/1/10. Then i go ahead and put the numbers below
$enddate = 1;
$endmonth = 1;
$endyear = 10;//—Then I compose the script that it will do my job, and I tell it if dates are below my limit then show the advertise that I have put in the file.php, if not then do not show them
if (!( date(“y”)>($endyear+1) || (date(“n”)>$endmonth && date(“y”)==$endyear) || (date(“j”)>$enddate && date(“n”)==$endmonth && date(“y”)==$endyear) )) {include (“file.php”);}
?>
Rember that your advertisment should be in the file.php ofcourse it can be a .txt .html or anything else just change the include (“file.php”) so that is the same with your file.
RSS feed for comments on this post · TrackBack URI
Leave a reply
You must be logged in to post a comment.