JohnsonDaniel
Regular Member
- May 16, 2008
- 389
- 1,398
My latest share is a self-hosted referer blanking script 
I'd like to ask for something in exchange though...
Please, if you are grateful or you find a use for it, and you feel driven to thank me, do NOT post a "thanking post", just hit the button, it's what it's there for.
Otoh, if you have contributions to the code, test results, or anything else, of interest to the users of my script, then you are encouraged to post, and I'd be grateful if you would
So, on to the script...
Instructions:
1. Save the following file as index.php.
2. Upload it to a folder on your hosting space.
3. Send traffic for which you want to blank the referer to:
http://whereveryouuploaded/?http://theLinkyouwanttoSendthemto
If you uploaded to mydomain.com, then replace "whereveryouuploaded" with mydomain.com.
If you uploaded to a folder named "x" on mydomain.com, then replace "whereveryouuploaded" with mydomain.com/x
NOTES:
1. At the moment, Opera cannot be blanked, so this script includes a fallback url. It will catch any traffic for which the referer has not been successfully removed, and dump that traffic there.
It's currently set to g*o*o*g*l*e, you can change it to wherever YOU want to dump your non-blanked traffic.
2. Although Opera does not get blanked, it only transfers the script's location, NOT the original referer, so, if you don't mind disclosing the script's location, feel free to remove the fallback function from the code.
3. This script will pass parameters and values in the destination link, including dynamically appended ones, such as those generated by Content Lock Pro and Prosper202.
NO-ONE has openly shared a referer blanking script before, since the days of DMR's. You are NOT allowed to sell this, nor are you allowed to remove the attribution in the source code. If you use this within your script or software, please respect the attribution, and leave my name, and "Content Lock Pro" intact.
Respect for the above paragraph will encourage me to continue sharing, if I find it is ignored the gravy train will reach its final stop.
Thanks for understanding
I'd like to ask for something in exchange though...
Please, if you are grateful or you find a use for it, and you feel driven to thank me, do NOT post a "thanking post", just hit the button, it's what it's there for.
Otoh, if you have contributions to the code, test results, or anything else, of interest to the users of my script, then you are encouraged to post, and I'd be grateful if you would
So, on to the script...
Instructions:
1. Save the following file as index.php.
2. Upload it to a folder on your hosting space.
3. Send traffic for which you want to blank the referer to:
http://whereveryouuploaded/?http://theLinkyouwanttoSendthemto
If you uploaded to mydomain.com, then replace "whereveryouuploaded" with mydomain.com.
If you uploaded to a folder named "x" on mydomain.com, then replace "whereveryouuploaded" with mydomain.com/x
NOTES:
1. At the moment, Opera cannot be blanked, so this script includes a fallback url. It will catch any traffic for which the referer has not been successfully removed, and dump that traffic there.
It's currently set to g*o*o*g*l*e, you can change it to wherever YOU want to dump your non-blanked traffic.
2. Although Opera does not get blanked, it only transfers the script's location, NOT the original referer, so, if you don't mind disclosing the script's location, feel free to remove the fallback function from the code.
3. This script will pass parameters and values in the destination link, including dynamically appended ones, such as those generated by Content Lock Pro and Prosper202.
NO-ONE has openly shared a referer blanking script before, since the days of DMR's. You are NOT allowed to sell this, nor are you allowed to remove the attribution in the source code. If you use this within your script or software, please respect the attribution, and leave my name, and "Content Lock Pro" intact.
Respect for the above paragraph will encourage me to continue sharing, if I find it is ignored the gravy train will reach its final stop.
Thanks for understanding
PHP:
<?php
/*
JohnsonDaniel's Referer Blanking Script
Content Lock Pro, Next Generation Content Locker, Treble your Income from Locking.
Website: http://ContentLockPro.com
Email: http://scr.im/clpro
URL Construction:
http://scriptdomain.com/folder/?http://destinationlink.com?parameters=values
*/
// Extract URI minus http://scriptdomain.com
$req_url = $_SERVER['REQUEST_URI'];
function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; }
function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); }
$full_url = selfURL();
// Extract the urls which we need
$script_name = $_SERVER['SCRIPT_NAME'];
$current_file = basename(__FILE__);
$dir = str_replace($current_file,'',$script_name);
$dir .= '?';
$offer = str_replace($dir,'',$req_url);
$offer = remove_attempt($offer);
$fallback = 'http://www.google.com/';
if (!isset($_REQUEST['attempt'])) $_REQUEST['attempt'] = 0;
switch ($_REQUEST['attempt']) {
case 0:
echo method0($offer,$full_url);
break;
case 1:
echo method1($offer,$full_url);
break;
case 2:
echo method2($offer,$full_url);
break;
case 3:
echo method3($offer,$fallback);
break;
default:
echo method0($offer,$full_url);
}
function method0($offer,$full_url) {
$txt = '';
$referer = '';
if (isset($_SERVER['HTTP_REFERER'])) $referer = $_SERVER['HTTP_REFERER'];
if ($referer == '' ) {
// If blank redirect
header('Location: '.$offer);
} else {
// Use method 0 to blank -> works mostly for IE and FF
$txt = '<meta http-equiv="refresh" content="0; url='.$full_url.'&attempt=1">';
}
return $txt;
}
function method1($offer,$full_url) {
$txt = '';
$referer = '';
if (isset($_SERVER['HTTP_REFERER'])) $referer = $_SERVER['HTTP_REFERER'];
if ($referer == '' ) {
// If blank redirect
header('Location: '.$offer);
} else {
// Use method 1 to blank
$txt = '<script>
function go(){
window.frames[0].document.body.innerHTML=\'<form target="_parent" method="post" action="'.$full_url.'&attempt=2">';
$txt .= '</form>\';
window.frames[0].document.forms[0].submit()
}
</script>
<iframe onload="window.setTimeout(\'go()\', 99)" src="about:blank" style="visibility:hidden"></iframe>';
}
return $txt;
}
function method2($offer,$full_url) {
$txt = '';
$referer = '';
if (isset($_SERVER['HTTP_REFERER'])) $referer = $_SERVER['HTTP_REFERER'];
if ($referer == '' ) {
// If blank redirect
header('Location: '.$offer);
} else {
// Use method 2 to blank
$txt = '<iframe src="javascript:parent.location=\''.$full_url.'&attempt=3\'" style="visibility:hidden"></iframe>';
}
return $txt;
}
function method3($offer,$fallback) { // All methods tried
$referer = '';
if (isset($_SERVER['HTTP_REFERER'])) $referer = $_SERVER['HTTP_REFERER'];
if ($referer == '' ) {
// If blank redirect
header('Location: '.$offer);
} else {
// No methods remaining -> send to fallback
header('Location: '.$fallback);
}
return $txt;
}
function remove_attempt($url) {
$i = strpos($url,'&attempt=');
if ($i > 0 ) $url = substr($url,0,$i);
return $url;
}
function create_parameters($url) {
$p1 = strpos ($url, '?');
$p = array();
if ($p1 > 0 ) {
$url_no_par = substr ($url , 0, $p1);
$p1 = $p1 + 1;
$url_par = substr ($url , $p1);
$paryval = explode ('&', $url_par);
foreach ($paryval as $value) {
$p[] = explode ('=',$value);
}
}
return $p;
}
?>
Last edited: