please help me with refresh and referral ....

Discussion in 'PHP' started by xbegin, Nov 5, 2008.

  1. #1
    Hello
    i used redirect php code and also i used meta refresh tags ,
    But whenever i use these for redirect page1 to paged2 , page2 can't find his referral link(page1) always !! for example if i send 20 hits on redirect page1 to page2 , page2 states shows 20 hits but it shows only 8 hits from page1 .

    i want a php code for reload page who can transfer referral link to new page always and exactly , please help me
     
    xbegin, Nov 5, 2008 IP
  2. money4leads

    money4leads Well-Known Member

    Messages:
    117
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #2
    I don't understand what you mean.
    please show the code you are using , I may help then
     
    money4leads, Nov 5, 2008 IP
  3. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I used
    <META HTTP-EQUIV="Refresh" CONTENT="10;URL=http://www.site.com">
    Code (markup):
    And also
    
    <?php
    header( 'Location: http://www.site.com/new_page.html' ) ;
    ?>
    
    Code (markup):
    But when page redirect to site.com , new site can't find referral link
     
    xbegin, Nov 5, 2008 IP
  4. dev_SeeInside

    dev_SeeInside Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you're using $_SERVER["HTTP_REFERER"], that's why. It's set by the browser, some browsers don't bother with it and some allow users to set it to whatever they want. So you can't go by that. Maybe try using a GET variable in the URL to tell you what page the referral came from, if it's a page on your own site.
     
    dev_SeeInside, Nov 5, 2008 IP
  5. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Of course new site isn't on my server , but it has powerful tracking script
    also i dont use $_SERVER["HTTP_REFERER"] on page
    my program knowledge is poor
    please write codes so i can copy paste them
    regards
     
    xbegin, Nov 5, 2008 IP
  6. dev_SeeInside

    dev_SeeInside Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    what script are you using? Is it a traffic trading script like TTT or STT or ePowerTrader?
     
    dev_SeeInside, Nov 5, 2008 IP
  7. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    no trade script , let me explain more
    redirect page is just a simple page for redirect my hits from it to site2
    I just force hits to this page and i want site2 shows his referral link that page
     
    xbegin, Nov 5, 2008 IP
  8. dev_SeeInside

    dev_SeeInside Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    what are you using to track the referral link though? It might not be picking up the referer. Try something more like this on your page1: (this is just an example)

    
    header("location:http://newsite.com/page2.php?ref=page1");
    
    PHP:
    and this on page2:

    
    if ($_GET["ref"] === "page1") { $referer = "page_1_url"; }
    else {
        // however you set the referer before
    }
    
    PHP:
     
    dev_SeeInside, Nov 5, 2008 IP
  9. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    But page2 isn't my own site
     
    xbegin, Nov 5, 2008 IP
  10. dev_SeeInside

    dev_SeeInside Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    page2 server doesn't give you a unique URL to send traffic to so that they can ensure you get credit for all referrals? It's not your fault, it's their tracking script. You should contact them and ask about it.
     
    dev_SeeInside, Nov 5, 2008 IP
  11. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    i contacted them , they told me their script can't identify referral link ! and they dont know why it happens ,
    when i send them hits directly by GBscript , their script identify referral link
    but when i try to send them via redirect page , he can't
    I think must be an easy program for do this function ..
     
    xbegin, Nov 5, 2008 IP
  12. Bind

    Bind Peon

    Messages:
    70
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #12
    then use a url jumper script and log the referrals for yourself.

    example:
    
    <?php>
    # aff.php
    #
    # link usage:
    #   <a href="./aff.php?aff=campaign1">Campaign Link</a>
    #
    # image-link usage:
    #   <a href="./aff.php?aff=campaign1"><img src="campaign_image_1.png"></a>
    #
    if (isset($_GET['aff']))
        {
            $affiliates = Array("campaign1,http://affiliates_website.com/?affiliate_id=12345",
                                "campaign2,http://affiliates_website.com/?affiliate_id=12346",
                                "campaign3,http://affiliates_website.com/?affiliate_id=12347",
                                "campaign4,http://affiliates_website.com/?affiliate_id=12348",
                                "campaign5,http://affiliates_website.com/?affiliate_id=12349",
                                "campaign6,http://affiliates_website.com/?affiliate_id=12340",);
            foreach ($affiliates as $this_affiliate)
                {
                    list($campaign_name,$affiliate_link) = explode(",",$this_affiliate);
                    if ($_GET['aff'] == $campaign_name)
                        {
                            #
                            # save the hit to your log, flatfile, or a database here,
                            # then redirect using header to the link
                            #
                            header("location: $affiliate_link");
                            exit;
                        }
                }
        }
    ?>
    PHP:
    i used an array because its easy to show all in one script, but you might want to use a database to house and administrate those campaign and campaing url values

    you can not 100% rely on the referrer as its a client-base data value that can be forged or stripped out, and sometimes the browser does not even pass it on depending on the visitors configuration and security/privacy software installed.
     
    Bind, Nov 5, 2008 IP
  13. dev_SeeInside

    dev_SeeInside Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #13
    try putting this in your page instead of the meta tag or PHP script, and see if it works better:

    
    <script>
    setTimeout("top.location.href = 'http://www.site.com/new_page.html'",5);
    </script>
    
    Code (markup):
     
    dev_SeeInside, Nov 5, 2008 IP
  14. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    xbegin, Nov 5, 2008 IP
  15. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Blind

    I did paste your codes to a file , but when it is online it shows nothing only a blank page
     
    xbegin, Nov 5, 2008 IP
  16. Bind

    Bind Peon

    Messages:
    70
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #16
    thats becasue you have to configure the $affiliates array with your referral links and campaign names.

    a blank page shows up because the 'aff' isnt set with a value in the query string used, which has to come from your links (hrefs).

    read the comments .. i have shown usage examples of link structures for it to work.

    you have to set it up and change your link structures (or create a test page with text and/or image links) for it to work properly.
     
    Bind, Nov 5, 2008 IP
  17. dev_SeeInside

    dev_SeeInside Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Try:

    
    header("location: http://www.site1.com/go.php?url=www.site2.com");
    
    PHP:

    Should work.
     
    dev_SeeInside, Nov 5, 2008 IP
  18. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    above short php code works ok

    but below code with 10sec delay dont works , how can fix it
    <?php
    header("Refresh: 10; URL=http://www.site.net/test.php");
    echo " "; // NN4 requires that we output something...
    exit();
    ?>
    Code (markup):
     
    xbegin, Nov 6, 2008 IP
  19. dev_SeeInside

    dev_SeeInside Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #19
    is there an error message, or same problem as before? If it's the same problem, just make sure to use the same URL when you do the redirect:

    
    header("Refresh: 10; URL=http://www.site1.com/go.php?url=www.site2.com");
    echo " "; // NN4 requires that we output something...
    exit();
    
    
    PHP:
     
    dev_SeeInside, Nov 6, 2008 IP
  20. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    When i decrese delay , stats go to be near to normal
    but i need 5-10sec delay for show my speacial text link on my redirect page before redirection
     
    xbegin, Nov 6, 2008 IP