New Posts
Live Radio
Welcome guest, is this your first visit?
  • Login:
BettingPartners.com - Exclusive Affiliate Network for Bodog
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    MPC
    MPC is offline
    Senior Member
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    Canada Eh?
    Posts
    1,377
    Blog Entries
    20
    Feedback Score
    8 (100%)

    Default php code to unpublish html string after a specific date

    I'm wondering if anyone could post the PHP code I would need to do the following logic:

    If current date is less or equal to August 01 2010 + 120 days, then post this HTML code, else post nothing.



    I'm looking to setup an automatic link expiry thingy.

  2. #2
    #!/usr/bin/mikebrad
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    USA
    Posts
    697
    Feedback Score
    8 (100%)

    Default

    Sorry if this isn't helpful but it was the fastest thing I could put together (I'm a little rusty).

    I wrote a quick function that you can put anywhere you like on the page / site / whatever and whenever you call that function, it will automatically check the html you enter for whatever parameters you set.

    Here's the function:

    PHP Code:
    <?php
    function check_expiration ($month$day$year$purchasedays$html) {
        
    $today time();
        
    $date mktime(0,0,0,$month,$day,$year);
        
    $purchasetime "+" $purchasedays " days";
        
    $expire strtotime($purchasetime,$date);
        if (
    $today $expire) {
            echo 
    $html;
        }
    }
    ?>
    And to call the function, just paste this code where your html should go:

    PHP Code:
    <?php check_expiration(8,1,2010,120,'HTML GOES HERE'); ?>
    The first three numbers would be the purchase date (or start date) of the link in the format month,day,year.
    The fourth number is the number of days to display the html
    And the fifth spot is where the actual html goes

    Like I said, I'm not sure if this is helpful or not, but it was the best way I could come up with doing it without having to repeat all kinds of code over and over and over again.

  3. #3
    MPC
    MPC is offline
    Senior Member
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    Canada Eh?
    Posts
    1,377
    Blog Entries
    20
    Feedback Score
    8 (100%)

    Default

    Thanks Mike, that sounds like it's exactly what I wanted. I'll play around with it this weekend. I'm sure others would be interested in this too.


 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Powered by vBulletin® Version 4.1.5
Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.
SEO by vBSEO 3.6.0
Affiliate Program Consultant