Skip to content

Instantly share code, notes, and snippets.

Created May 20, 2015 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/fcf4c2f110e6da045333 to your computer and use it in GitHub Desktop.
Save anonymous/fcf4c2f110e6da045333 to your computer and use it in GitHub Desktop.
Hide referrers with Keitaro TDS. Just place file hide_referrer.php with code below to application/redirects/
<?php
/**
* @redirectName HIDE REFERER
* @redirectWeight 100
*/
class hide_referrer_redirect extends AbstractRedirect2
{
public function go(Stream $stream, Visitor $visitor)
{
$this->setContent($this->_gethideRedirect($stream, $visitor));
}
private function _gethideRedirect(Stream $stream, Visitor $visitor)
{
$code = '<script>
function go() {
window.frames[0].document.body.innerHTML = \'<form target="_parent" method="post" action="' . $stream->getUrlWithParams($visitor) . '"></form>\';
window.frames[0].document.forms[0].submit()
}
</script>
<iframe onload="window.setTimeout(\'go()\', 99)" src="about:blank" style="visibility:hidden"></iframe>';
return $code ;
}
public function goDebug(Stream $stream, Visitor $visitor)
{
return "Redirecting to: " . $stream->getUrlWithParams($visitor);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment