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

redirect to random page

Discussion in 'Cloaking and Content Generators' started by lilla, Jan 24, 2008.

  1. lilla

    lilla Newbie

    Joined:
    Jan 3, 2008
    Messages:
    17
    Likes Received:
    15
    I know how to redirect a domain to one other page.
    But, how can I perform a redirect randomly to one of the 5 pages (my 5 affiliates offers)?
    Practically I would to do an affiliate link rotation on redirect.
    In that way I can see which of these aff.-s have the best performances for me.
    Some help?
    Thanks
    Lilla
     
  2. caretaker2007

    caretaker2007 Power Member

    Joined:
    Dec 20, 2007
    Messages:
    720
    Likes Received:
    454
    Occupation:
    To create income streams
    Location:
    In a 6 by 3 plot
    Home Page:
    Use php to pick a random link out a flat file hotscripts.com has several you can use for free. Just choose the one that is right for you.
     
  3. Entrepreneur

    Entrepreneur Regular Member

    Joined:
    Oct 12, 2007
    Messages:
    438
    Likes Received:
    379
    Here you go, this script will do it, as i use it to rotate through a list of homepages. It's super simple and a readme is contained within the zip file. Rep me if it's what you're looking for please.

    http://www.mediafire.com/?7ibgllnesiw
     
    • Thanks Thanks x 1
  4. ajaj

    ajaj Registered Member

    Joined:
    Jan 6, 2008
    Messages:
    59
    Likes Received:
    9
    Thanks OP for the question and I repped Barry scott for a helpful answer.
    Can someone give me a scenario where this would successfully be used.

    For example, would this re-direct be coming from c*raiglist or some similar site and redirecting the user to one of the 5 auctions on that topic on ebay or are you redirecting them to landing pages or stuff like that.

    I have little idea on all this and I am learning. So someone kindly explain a scenerio. Much appreciated. :)
     
  5. SmallStorm

    SmallStorm Junior Member

    Joined:
    Dec 4, 2007
    Messages:
    141
    Likes Received:
    64
    Hi lilla,

    If you want to send a percentage of traffic to various urls, you can use Traffic Splitter. I use it to send traffic to same-theme clickbank products to see what sells better. It's a free script from hxxp://smarterscripts.com/

    You can download it here: hxxp://smarterscripts.com/php/free-scripts/traffic-splitter/view

    HTH,

    Chris
     
    • Thanks Thanks x 1
  6. lilla

    lilla Newbie

    Joined:
    Jan 3, 2008
    Messages:
    17
    Likes Received:
    15
    Barry Scott, SmallStorm thanks for the helpful answers. rep given for both.
    It's exactly what I'm looking for.
    I will try these days with my new site.
     
  7. euroman

    euroman Junior Member

    Joined:
    Dec 19, 2007
    Messages:
    188
    Likes Received:
    22
    Occupation:
    Self Employed
    Location:
    Never Land
    Great stuff...

    Thats what I have been looking for...

    Thanks a lot.
     
  8. seikooc

    seikooc Regular Member

    Joined:
    Aug 11, 2008
    Messages:
    268
    Likes Received:
    132
    Occupation:
    BH Implementation
    Location:
    Blackhat World
    Awesome share Barry Scott.... Do you know how to protect the link created that redirects to the several sites from robots? Also how would you go about protecting the .txt file that contain the links?

    I am kinda new to some of these methods:confused: and I was thinking if there is a way to cloak the page that rotates the links and forbid robots from it as well as the .txt file, then that would be great.

    Thanks again for the share...
     
  9. lozzzer

    lozzzer Regular Member

    Joined:
    Nov 14, 2008
    Messages:
    211
    Likes Received:
    37
    Location:
    BHW
    PHP:
    <?

    $aff1 "http://www.google11.com";
    $aff2 "http://www.google22.com";
    $aff3 "http://www.google33.com";
    $aff4 "http://www.google44.com";
    $aff5 "http://www.google55.com";




    $the_array = array( "$aff1""$aff2""$aff3""$aff4""$aff5);

    $random_aff rand(04);

    echo 
    "<meta http-equiv="refresh" content="0;url=$the_array[$random_aff]">";

    ?>
     
  10. seikooc

    seikooc Regular Member

    Joined:
    Aug 11, 2008
    Messages:
    268
    Likes Received:
    132
    Occupation:
    BH Implementation
    Location:
    Blackhat World
    I got an error code on Line 16..... Looks good though if it initiates..
     
  11. lozzzer

    lozzzer Regular Member

    Joined:
    Nov 14, 2008
    Messages:
    211
    Likes Received:
    37
    Location:
    BHW
    ahhh Sorry guys I just typed in rush and did not check my code, following is fixed one and should work perfectly...i have checked it this time
    PHP:
    <?
    $aff1 "http://www.google11.com";

    $aff2 "http://www.google22.com";

    $aff3 "http://www.google33.com";

    $aff4 "http://www.google44.com";

    $aff5 "http://www.google55.com";


    $the_array = array( "$aff1""$aff2""$aff3""$aff4""$aff5);
    $random_aff rand(04);

    echo 
    "<meta http-equiv="refresh" content="0;url=$the_array[$random_aff]">";
    ?>

     
  12. seikooc

    seikooc Regular Member

    Joined:
    Aug 11, 2008
    Messages:
    268
    Likes Received:
    132
    Occupation:
    BH Implementation
    Location:
    Blackhat World
    I tried it again and I get an error code: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/mysiteusernname/public_html/subsite.com/newrotator.php on line 18 .....

    Is this script supposed to be called using <?php include("newrotator.php"); ?>

    I am lost.... Sorry.
     
  13. lozzzer

    lozzzer Regular Member

    Joined:
    Nov 14, 2008
    Messages:
    211
    Likes Received:
    37
    Location:
    BHW
    fuck man....i thought tht was my fault but its not these PHP tag thing of the forum is messing up the code....now i have replace the meta refresh with php redirect..hope tht will work
    Code:
    <?
    
    $aff1 = "http://www.google11.com";
    
    $aff2 = "http://www.google22.com";
    
    $aff3 = "http://www.google33.com";
    
    $aff4 = "http://www.google44.com";
    
    $aff5 = "http://www.google55.com";
    
    
    
    
    
    $the_array = array( "$aff1", "$aff2", "$aff3", "$aff4", "$aff5" );
    
    $random_aff = rand(0, 4);
    
    header("Location: $the_array[$random_aff]"); /* Redirect browser */
    
    
    
    
    
    ?>
    
     
    • Thanks Thanks x 3
  14. booman

    booman Regular Member

    Joined:
    Mar 6, 2007
    Messages:
    478
    Likes Received:
    87
    Location:
    USA
    Here's one that works with meta refresh, but checks the referrer first. If the referrer is blank it sends your surfer to one of your affiliate offers, if not it sends them to another url of your choice. Personally I'd send them back to the page that sent them here so that you can get the referrer blanked and send them off to your offer.

    Code:
    <?php
    
    $offers = array(
    "http://www.url1.com",
    "http://www.url2.com",
    "http://www.url3.com",
    "http://www.url4.com"
    );
    
    $referer = $_SERVER['HTTP_REFERER']; 
    if($referer == "") {
        $url = $offers[rand(0, count($offers) - 1)];
        echo "<meta http-equiv="refresh" content="0;url=$url">";
    }
    else
    {
        echo "<meta http-equiv="refresh" content="0;url=http://www.firstpage.com">"; 
    } 
    ?>
    
     
  15. drkenneth

    drkenneth Executive VIP

    Joined:
    Nov 13, 2008
    Messages:
    285
    Likes Received:
    176
    Occupation:
    Developer/Entrepreneur
    Location:
    USA
    Not going to work sorry. Your problem is the following lines:
    Code:
    echo "<meta http-equiv="refresh" content="0;url=$url">";
     AND
    echo "<meta http-equiv="refresh" content="0;url=http://www.firstpage.com">"; 
    
    The double quotes in double quotes fucks everything to high hell. Can't use single quotes in front of single quotes. Either need to put backslashes in front of all the internal quotes, or use single quotes instead for all the internal ones. (They are interchangeable in the rendered HTML)

    This should work:
    Code:
    echo "<meta http-equiv='refresh' content='0;url=$url'>";
    AND
    echo "<meta http-equiv='refresh' content='0;url=http://www.firstpage.com'>"; 
    
    This forum filters out backslashes, so if you had them in there booman I'm sorry, but the forum got rid of them, haha. (Just making sure anyone who doesn't realize is aware :D)
     
    • Thanks Thanks x 1
    Last edited: Dec 14, 2008
  16. richjerkoff

    richjerkoff Junior Member

    Joined:
    Apr 7, 2008
    Messages:
    159
    Likes Received:
    79
    Location:
    UK
    Thanks for all the code guys. I wanted to do something to test out different sales pages too,
     
  17. easyadwriter

    easyadwriter BANNED BANNED

    Joined:
    Dec 3, 2008
    Messages:
    37
    Likes Received:
    0
    dam I just cant seem to find the code that'll work for me, I just want to paste the code on my index.html page. I need it to redirect the traffic to rotated links.
    like this code kinda does, but has browser problems. I just paste this in my index page and off we go, not sure why these other codes dont work? html is not some thing I know a lot about..
    <script language="JavaScript1.2">



    var ie=document.all&&navigator.userAgent.indexOf("Oper a")==-1
    var dom=document.getElementById&&navigator.userAgent.i ndexOf("Opera")==-1

    //Specify IFRAME display attributes
    var iframeprops='width=930 height=930 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="yes"'

    //Specify random URLs to display inside iframe
    var randomcontent=new Array()
    randomcontent[0]="http://login.url.com/ez/"
    randomcontent[1]="http://login.url.com/ez/"
    randomcontent[2]="http://login.url.com/ez/"
    randomcontent[3]="http://login.url.com/ez/"
    randomcontent[4]="http://login.url.com/ez/"
    randomcontent[5]="http://login.url.com/ez/"
    randomcontent[6]="http://login.url.com/ez/"
    randomcontent[7]="http://login.url.com/ez/"
    randomcontent[8]="http://login.url.com/ez/"
    randomcontent[9]="http://login.url.com/ez/"
    randomcontent[10]="http://login.url.com/ez"
    randomcontent[11]="http://login.url.com/ez"
    randomcontent[12]="http://login.url.com/ez"
    randomcontent[13]="http://login.url.com/ez"
    randomcontent[14]="http://login.url.com/ez"
    randomcontent[15]="http://login.url.com/ez"
    randomcontent[16]="http://login.url.com/ez"
    randomcontent[17]="http://login.url.com/ez"
    randomcontent[18]="http://login.url.com/ez"




    //No need to edit after here
    if (ie||dom)
    document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')

    function random_iframe(){
    if (ie||dom){
    var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
    iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)]
    }
    }

    window.onload=random_iframe

    </script>
     
  18. 10kay

    10kay Registered Member

    Joined:
    Oct 13, 2007
    Messages:
    87
    Likes Received:
    38
    this works nicely for me ... but is there a way to edit below to
    have the aff links run consecutively ? aff1 then aff2 .... aff5 then loops
    back to aff1?

    appreciate any help. thanks.

     
  19. devil777

    devil777 Newbie

    Joined:
    Nov 14, 2008
    Messages:
    14
    Likes Received:
    2
    Why would you want to do that? If you want to do that then php should write a small txt like file as a database. Otherwise if you have mysql installed you can store the sequence in a mysql database.