EASY: Re-write PHP Code $10

Discussion in 'Programming' started by lylaster, Nov 26, 2008.

  1. #1
    Hi.

    I have a php code that split tests two landing pages, I'd like for someone to rewrite it so that it split tests 4 landing pages.

    PM if you can do this. I pay with paypal. Thanks!

    <?php
    $handle = fopen("visitors.txt", "r");
    $nr = fread($handle, 128);
    fclose($handle);

    if($nr == 1){
    $handle = fopen("visitors.txt", "w");
    fwrite($handle, "2");
    fclose($handle);
    header("Location: http://www.yahoo.com");
    } else {
    $handle = fopen("visitors.txt", "w");
    fwrite($handle, "1");
    fclose($handle);
    header("Location: http://www.msn.com");
    }


    ?>
     
    lylaster, Nov 26, 2008 IP
  2. NetworkTown.Net

    NetworkTown.Net Well-Known Member

    Messages:
    2,022
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    165
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    PM me if you would like this done.
     
    NetworkTown.Net, Nov 26, 2008 IP
  3. elahi9999

    elahi9999 Well-Known Member

    Messages:
    121
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    <?php
    $handle = fopen("visitors.txt", "r");
    $nr = fread($handle, 128);
    fclose($handle);

    if($nr == 1){
    $handle = fopen("visitors.txt", "w");
    fwrite($handle, "2");
    fclose($handle);
    header("Location: http://www.yahoo1.com");
    }
    if($nr == 2){
    $handle = fopen("visitors.txt", "w");
    fwrite($handle, "3");
    fclose($handle);
    header("Location: http://www.yahoo2.com");
    }
    if($nr == 3){
    $handle = fopen("visitors.txt", "w");
    fwrite($handle, "4");
    fclose($handle);
    header("Location: http://www.yahoo3.com");
    } if($nr == 4){
    $handle = fopen("visitors.txt", "w");
    fwrite($handle, "1");
    fclose($handle);
    header("Location: http://www.yahoo4.com");
    }


    ?>
     
    elahi9999, Nov 26, 2008 IP