WEB referer not being recorded after redirect?? HALP

Discussion in 'OT Technology' started by MSTRMOO, Sep 20, 2008.

  1. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
    so i've got something like this on one page
    lets call this page www.asd.com


    Code:
    <?php 
    
    if( $_SERVER[ 'HTTP_REFERER' ] == '' )
    {
        header("Location: http://www.website.com/");
    }
    else
    {
        echo 'Welcome';
    } 
    ?>
    so if there is no referer, the user gets redirected to www.website.com
    and on www.website.com i have


    Code:
    <?php 
    
    if( $_SERVER[ 'HTTP_REFERER' ] == 'http://www.asd.com/' )
    {
        header("Location: http://www.google.com/");
    }
    else
    {
        echo 'Welcome';
    } 
    ?>
    however, www.website.com does not go to google.com if the user was redirected from asd.com

    i posted the redirect link on OT to test the referer logs.. the referer is being recorded as offtopic and NOT asd.com.. why is that? im redirecting the user from asd.com to website.com.. so the referer on website.com should be asd.com no?
     
    Last edited: Sep 20, 2008
  2. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
    Last edited: Sep 20, 2008
  3. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
    heres a diagram

    external site ---->tracking site----->main site

    i want the main site to see the tracking site as the referer.. however.. currently it shows the external site as the referer
     
  4. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
    hmm.. noone? ok lets approach this a little differently...

    im sending traffic to www.asd.com, which then gets redirected to www.website.com IF the traffic has a referer... www.website.com also displays "WELCOME!" if the traffic came from www.asd.com... how would you go about doing this some other way other then what i showed above...
     
  5. maxxpower

    maxxpower OG Lauren Crew - Observer OT Supporter

    Joined:
    May 27, 2007
    Messages:
    26,348
    Likes Received:
    0
    sorry bro, im braindead today.
     
  6. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
  7. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
  8. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
  9. fishbulb

    fishbulb Active Member

    Joined:
    Oct 29, 2001
    Messages:
    6,848
    Likes Received:
    4
    Location:
    md
    Code:
    if(strpos($_SERVER[ 'HTTP_REFERER' ],'asd.com') != 0){
    
    // do forwarding here, referrer is asd.com
    
    }else{
    
    // referrer isn't asd.com
    
    }
    
     
  10. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
    umm wat is this supposto do? either i dont get the script, or you dont get the problem.. lol
     
  11. fishbulb

    fishbulb Active Member

    Joined:
    Oct 29, 2001
    Messages:
    6,848
    Likes Received:
    4
    Location:
    md
    The code I posted is to solve what you're trying to do in the 2nd code block in your original post. If you don't get it, google strpos. It's not rocket science.

    if you want to check for no referrer, use
    if($_SERVER[ 'HTTP_REFERER' ] == NULL)
     
  12. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
    ok i get it.. its checking for any occurence of asd.com in the http_referer string... the problem is though, asd.com was never recorded as the referer in the first place.. only the site that links INTO asd.com is recorded as a referer, the intermediate is not recorded.. so asd.com does not occur in http_referer..
     
  13. fishbulb

    fishbulb Active Member

    Joined:
    Oct 29, 2001
    Messages:
    6,848
    Likes Received:
    4
    Location:
    md
    I wasn't aware of that catch with referrers indicating the original server, not sure that there's anyway to do what you're trying to do in PHP without using URL arguments.

    An .htaccess solution may work if they don't have the same referrer treatment.
     
  14. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
    htaccess solution? this may be good aswell, but i wouldnt know where to start...
     
  15. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
    fuck.. why is this so complicated.. all i want to do is see if traffic is coming from asd.com and not some other site............................
     
  16. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
    maybe if i explain this a bit further someone might come up with another method...

    www.asd.com will load as a popup on someones computer, and will then redirect to www.website.com... so the referer WILL be blank since there is not actual link going into asd.com.. it just loads automaticly...

    so.. is there some way www.website.com can tell whether it was loaded in a popup (meaning the user didnt type in the address or click a link) or not, and base its next actions on that fact?
     
  17. crazybenf

    crazybenf Active Member

    Joined:
    Nov 14, 2001
    Messages:
    15,578
    Likes Received:
    2
    set a session var broseph.
     
  18. crazybenf

    crazybenf Active Member

    Joined:
    Nov 14, 2001
    Messages:
    15,578
    Likes Received:
    2
    nevermind, you're going across domains.


    use a javascript redirect :coold:
     
  19. MSTRMOO

    MSTRMOO Active Member

    Joined:
    Jul 19, 2005
    Messages:
    36,312
    Likes Received:
    0
    oh mother fucker.. that only took 2 seconds to do -_-. wow why didnt i think of this already.. thanks again man...
     
  20. crazybenf

    crazybenf Active Member

    Joined:
    Nov 14, 2001
    Messages:
    15,578
    Likes Received:
    2

Share This Page