Log in

View Full Version : Help!!!!!!!!



Kerssa
01-19-2007, 02:19 PM
Help me, I need a php script to close a link at a certain date. I hope you will understand my bad english.

thetestingsite
01-19-2007, 02:38 PM
By "close a link", do you mean to simply not show it on that certain date? If that's what you mean, try the following:



<?php

$closeDate = "2-14-2007";
/* Date you want the link not to be displayed. Format: Month-Day-Year (2-14-2007) */

if (date('n-j-Y') == $closeDate) {
//do not echo link
}

else {
echo '<a href="link.php">Test Link</a>'; //the link to be echoed
}
?>


Basically what the above does is compare the date you type into the $closeDate variable with the current date of the server. If the dates match, do not display the link. If they don't match, display a link.

Hope this helps.