Results 1 to 2 of 2

Thread: Help!!!!!!!!

  1. #1
    Join Date
    Jan 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help!!!!!!!!

    Help me, I need a php script to close a link at a certain date. I hope you will understand my bad english.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    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:

    Code:
    <?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.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •