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

help with redirect script pertaining to referer

Discussion in 'Black Hat SEO' started by turbotec, Sep 8, 2008.

  1. turbotec

    turbotec Junior Member

    Joined:
    Apr 5, 2008
    Messages:
    181
    Likes Received:
    15
    so I am using this script to redirect users if they have a blank referrer:

    Code:
    ?php
    	$referer = $_SERVER['HTTP_REFERER'];
    	if($referer == "")
    	{
    		echo '<meta http-equiv="refresh" content="0;url=http://www.yahoo.com">';
    	}
    	else
    	{
    		echo '<meta http-equiv="refresh" content="0;url=http://www.google.com">';	
    	}
    ?>
    
    

    NOW here is my question. this code above sends users to www. yahoo.com IF the referrer is blank. how can I get it to redirect if and only if the Referrer is www.ABC123.com/index.htm

    I tried putting in www.ABC123.com/index.htm inbetween the "" in the above code, but it only goes to the 'else' page even when the real referrer is www.ABC123.com/index.htm
     
  2. BozoClown

    BozoClown Junior Member

    Joined:
    Jan 4, 2009
    Messages:
    150
    Likes Received:
    108
    Try this

    PHP:
    <?php
        $referer 
    $_SERVER['HTTP_REFERER'];
        if(
    strstr($referer,"ABC123.com/index.htm"))
        {
            echo 
    '<meta http-equiv="refresh" content="0;url=http://www.yahoo.com">';
        }
        else
        {
            echo 
    '<meta http-equiv="refresh" content="0;url=http://www.google.com">';    
        }
    ?>
     
    • Thanks Thanks x 1
  3. Diabolik

    Diabolik Newbie

    Joined:
    Apr 11, 2011
    Messages:
    4
    Likes Received:
    1
    Could this be used as a "key" to a page that you don't want the network to see?

    Like let's say this redirects to a page you want to keep hidden - the only way to the "bad page" is by passing through this "key page" - if anybody tries to enter any other way, another page is presented and looks clean.

    I know it can be done with different domains and such, but I'd rather a self contained script that can be kept in one folder.

    Is this possible and who can code it?

     
  4. BozoClown

    BozoClown Junior Member

    Joined:
    Jan 4, 2009
    Messages:
    150
    Likes Received:
    108
    Late Reply. Yes it is possible.
     
  5. BozoClown

    BozoClown Junior Member

    Joined:
    Jan 4, 2009
    Messages:
    150
    Likes Received:
    108
    hehehe, I figured it would look so after the browser ate my more helpful comment when I tried to edit it, so I manually quoted him added "late reply" and 3 other words :). I'm actually doing the cookie drop and also a javascript redirect that would keep the referer. The cookie drop method is a little more subtle than the javascript redirect.