Code to rotate affiliate link in script?

Discussion in 'PHP' started by makingfastcash22, Oct 7, 2008.

  1. #1
    I have a script that I want to add some code to randomly add a charities affiliate id say 20% of the time randomly. 80% of the time a another affiliate id.

    How can this be done?

    Any help would be appreciated.

    Thanks
     
    makingfastcash22, Oct 7, 2008 IP
  2. gzav

    gzav Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <?php
    $affiliate_id = 0;
    srand(time());
    $random = rand() % 10;
    if($random <= 2)
      $affilliate_id = charity;
    else
      $affiliate_id = other_affiliate_id;
    ?>
    Code (markup):
    That would proably work
     
    gzav, Oct 7, 2008 IP
  3. makingfastcash22

    makingfastcash22 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the reply.

    I am not a programmer, but I will not study the config file and the function files of this script and see what I can figure out.

    Thanks again :)
     
    makingfastcash22, Oct 7, 2008 IP
  4. makingfastcash22

    makingfastcash22 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    is there a way to do this in htaccess.

    But instead of knowing the affiliate id of the users, hows about using some type of wild card to replace for example a clickbank id or amazom id?

    If this can be done via htaccess and done on a random basis that might work better.


    Any help much appreciated.
     
    makingfastcash22, Mar 8, 2009 IP