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.

No Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: