1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Redirecting Help Pls

Discussion in 'Cloaking and Content Generators' started by OnFire25, Sep 29, 2008.

  1. OnFire25

    OnFire25 Registered Member

    Joined:
    Mar 24, 2008
    Messages:
    60
    Likes Received:
    212
    For split testing is it possible to create a page that will randomly select one page to display to a visitor.

    Nothing blackhat here I know but I have an idea based on c0nversi0nPr0fit that I haven't seen anywhere else.

    As c0nversi0nPr0fit only allows tracking of 3 versions of a landing page I am trying to create an index.php that will randomly select from index1.html, index2.html and index3.html.

    I have used the following code :

    Code:
    <?php
     $pageid =  rand(1, 3);
     if ($pageid == 1){$location = "http://www.google.com";}
     else if ($pageid == 2){$location = "http://www.yahoo.com";}
     else if ($pageid == 3){$location = "http://www.msn.com";}
     echo "<a href=$location>$location</a>";
    ?>  
    and this echo does display a random pagelink in text but I can not work out how to get it to open the selected/displayed location.

    As you can guess I am not a php coder

    So happy for any workable suggestions


    Thanx
     
  2. MiLiTARYiV

    MiLiTARYiV Senior Member

    Joined:
    Jan 9, 2008
    Messages:
    959
    Likes Received:
    595
    Occupation:
    Webmaster
    Location:
    The Office
    There is. I read about how to do that in the Beating Adwords book but can not remember how
     
  3. BozoClown

    BozoClown Junior Member

    Joined:
    Jan 4, 2009
    Messages:
    150
    Likes Received:
    106
    Here you go

    Code:
    <?php
     $pageid =  rand(1, 3);
     if ($pageid == 1){$location = "http://www.google.com";}
     else if ($pageid == 2){$location = "http://www.yahoo.com";}
     else if ($pageid == 3){$location = "http://www.msn.com";}
     echo "<meta http-equiv="refresh" content="0;url=$location">";
    ?>
    
     
    • Thanks Thanks x 1
  4. OnFire25

    OnFire25 Registered Member

    Joined:
    Mar 24, 2008
    Messages:
    60
    Likes Received:
    212
    Hi Bozo,

    Thanks for the code - slight problem when I upload this to my host using PHP version 5.2.6 I get the following error

    Code:
    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/xxxxxxxxxxx/public_html/xxxxxxxxxxx/index.php on line 6
    
    
    
    
    Any thoughts on this ?


    Thanx
     
    Last edited: Sep 29, 2008
  5. BozoClown

    BozoClown Junior Member

    Joined:
    Jan 4, 2009
    Messages:
    150
    Likes Received:
    106
    Oops I forgot to escape the quotations
    Code:
    <?php
     $pageid =  rand(1, 3);
     if ($pageid == 1){$location = "http://www.google.com";}
     else if ($pageid == 2){$location = "http://www.yahoo.com";}
     else if ($pageid == 3){$location = "http://www.msn.com";}
     echo "<meta http-equiv=\"refresh\" content=\"0;url=$location\">";
    ?>
    
    That should work.
     
    • Thanks Thanks x 1
  6. OnFire25

    OnFire25 Registered Member

    Joined:
    Mar 24, 2008
    Messages:
    60
    Likes Received:
    212
    Thanx

    that works.

    Now all I need to get working is some javascript in this to get the split testing results.

    the code is
    <script language="javascript" src="http://www.xxxxxxxxxx.com/tracker.php?uid=9&cid=12"></script> which is supposed to track visitors is there any special codes that are needed because I have tried this and the mysql is not being updated so I guess that how I have entered the code is wrong

    Truely grateful for the support and help
     
  7. BozoClown

    BozoClown Junior Member

    Joined:
    Jan 4, 2009
    Messages:
    150
    Likes Received:
    106
    Make sure you have set up the database right and are actually updating it with php. mysql usually displays errors when you have a problem. You have to write the code that updates it on every visit or make user the script is doing that for you.
     
  8. bhnoobz

    bhnoobz BANNED BANNED

    Joined:
    Jul 26, 2008
    Messages:
    395
    Likes Received:
    107
    lol that's a really messy way to do something simple...
    What happens if you want to add more sites? More variables and elsfis? :(
    Code:
    <?php
    $redirects = array(
            "http://www.site1.com",
            "http://www.site2.com",
            "http://www.site3.com",
            "http://www.site4.com",
            "http://www.site5.com"
    );
    
    header("Location: " . $redirects[mt_rand()%count($redirects)] ."");
    ?>
    
    
     
    • Thanks Thanks x 1
    Last edited: Sep 30, 2008
  9. OnFire25

    OnFire25 Registered Member

    Joined:
    Mar 24, 2008
    Messages:
    60
    Likes Received:
    212
    Hi bhnoobz

    Purrrrrrrrfect thanx for K I S S ing it for a non coder.

    Have you any suggestions about getting the javascript into the php code have been tryng but it is not updating the mhsql database so I have f***ked it up somewhere.

    What I am doing is taking a ppc tool and attempting to reuse it as a split testing tool - I do like to look outside the box.

    Appreciate your time and suggestions