How to block blank referrer in PHProxy?

PHProxy is a webproxy written in PHP to bypass firewalls and other proxy restrictions through a web interface very similar to the popular CGIProxy.

The server that this script runs on simply acts as a medium that retrives resources for you. The only IP address shown will be the server’s IP address so basically it is indirect browsing. The only catch is that the server has to have access to those otherwise inaccessible resources. The PHProxy needs less cpu power and ram than the older CGIProxy (programmed in pearl) on the server it is running and so since about 2 years it is more popular.

We’ll block and redirect blank referrer traffic to the front page.

In index.php file, find the following line:
//
// OPEN SOCKET TO SERVER
//

Add the following code just above it:
if ($_SERVER['HTTP_REFERER'] == '') {
header("Location: http://".$_SERVER['SERVER_NAME']);
die();
}

The lines will be look like this:
if ($_SERVER['HTTP_REFERER'] == '') {
header("Location: http://".$_SERVER['SERVER_NAME']);
die();
}

//
// OPEN SOCKET TO SERVER
//

This code, will redirect the traffic to your front page. This will also prevent search engines robot from indexing the linked page. Thus reduce the risk of your webproxy getting abused.

Tagged with 
About sepedatua
I am nothing special, of this I am sure. I am a common man with common thoughts and I’ve led a common life. There are no monuments dedicated to me and my name will soon be forgotten, but I’ve loved another with all my heart and soul, and to me, this has always been enough.

Leave a Reply