Simple fake referer script

39ster

Junior Member
Joined
Dec 12, 2009
Messages
174
Reaction score
59
I made this little script to make fake referer simple. Name the file "fakereferer.php" and copy paste this script into the file:

Code:
<?php

function removeqsvar($url, $varname) {
    return preg_replace('/([?&])'.$varname.'=[^&]+(&|$)/','$1',$url);
}

if(isset($_GET["l"]))
{
    $url = $_GET["l"];
    setcookie("redirect", $url);
    $newRequest = removeqsvar($_SERVER["REQUEST_URI"], "l");
    
    if(substr($newRequest, -1) == "?") {
        $newRequest = substr($newRequest, 0, strlen($newRequest) - 1);
    }
    
    $redirectUrl = "http://" . $_SERVER["SERVER_NAME"] . $newRequest;
    header("location: $redirectUrl");
    exit();
} else if(isset($_COOKIE["redirect"]))
{
    $url = $_COOKIE["redirect"];
    setcookie("redirect", "");
    echo "<script>window.location.replace(\"$url\")</script>";
    exit();
}
?>

On your white hat site, put this at the top of the php page (after the "<?php" line) that will be used as the fake referer
Code:
include("fakereferer.php");

So if my white hat url is http://mywhitesite.com/index.php and i want to redirect a link through it, i would do this:

"http://mywhitesite.com/index.php?l=http%3A%2F%2Fgoogle.com%2F"

This will redirect me to http://google.com/ and make the referer "http://mywhitesite.com/index.php" (it removes the ?l=blahblah) part.

NOTE: The part after "?l=" must be encoded using this: http://meyerweb.com/eric/tools/dencoder/


So, if i was using Content Locker Pro, and i want to add an offer...let's say the url to the offer is http://admedia.com/?offerid=3747 then in CLP i would make the URL of the offer "http://mywhitesite.com/index.php?l=http%3A%2F%2Fadmedia.com%2F%3Fofferid%3D3747". When a user clicks this URL, it will appear as the traffic is coming from "http://mywhitesite.com/index.php"


If you don't add "?l=blahblah" it will just show the normal white hat site
 
Last edited:
is there a way to make the url look cleaner?
you mean like _http://example.com/?go=http://google.com
try with this code
Code:
<?php
if(isset($_GET["go"])){
  $url = $_GET["go"];
  header("location: $url");
  exit();
}
?>
 
hmm, cant get it to work. the link just goes to the white hat page and
"include("fakereferer.php");" shows up on it. im guessing i have it coded wrong?
 
include("fakereferer.php"); must be after the "<?php" line.
 
Is there a way to show the traffic coming from whitehat.com if you don't actually own the site? :)
So that if people click on the offer on my site, the referrer would show as whitehat.com.
 
I dont get the point of this...
If your getting said person to click your link to begin with, why would you even need to fake anything?

Or is this so you can click it yourself and pretend to be your own ref?
 
@Abh_Empire
no because you need to be able to upload this script onto the white hat site and include it into the page that you want to be the referer.

@gypsyr0ad
Because a lot of networks have rules about what content can be locked and your traffic sources. Some, such as peerfly, don't even allow incentive. They will ban you and take your unpaid earnings if you break their rules.
 
Last edited:
thanks for the share. im a little confused though...

Name the file "fakereferer.php" and copy paste this script into the file:

Code:
<?php

function removeqsvar($url, $varname) {
    return preg_replace('/([?&])'.$varname.'=[^&]+(&|$)/','$1',$url);
}

if(isset($_GET["l"]))
{
    $url = $_GET["l"];
    setcookie("redirect", $url);
    $newRequest = removeqsvar($_SERVER["REQUEST_URI"], "l");
    
    if(substr($newRequest, -1) == "?") {
        $newRequest = substr($newRequest, 0, strlen($newRequest) - 1);
    }
    
    $redirectUrl = "http://" . $_SERVER["SERVER_NAME"] . $newRequest;
    header("location: $redirectUrl");
    exit();
} else if(isset($_COOKIE["redirect"]))
{
    $url = $_COOKIE["redirect"];
    setcookie("redirect", "");
    echo "<script>window.location.replace(\"$url\")</script>";
    exit();
}
?>

...and put it where?

On your white hat site, put this at the top of the php page (after the "<?php" line) that will be used as the fake referer
Code:
include("fakereferer.php");

"<?php" - there is no such line on MY white hat page. yeah that line exists on that script, but again, where does that script go? the root folder and the white hat page?
 
Last edited:
In the same folder that the white hate page is in.

If there's no line for that, then your white hat page isn;t using PHP. Is the extension .html or .php?
 
In the same folder that the white hate page is in.

If there's no line for that, then your white hat page isn;t using PHP. Is the extension .html or .php?

my white hat pages are just hunky dory, my other fake referer script using php works just fine with them.

however, I did not have a "<?php" line anywhere so I just added...
Code:
<?php
include("fakereferer.php");
?>
...to the head of my white hat page & your script worked just fine!:D

thanks given
 
Back
Top