DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Kalatravas has posted 29 posts at DZone. View Full User Profile

Detecting A Proxy Server With PHP

  • submit to reddit


// use this script to detect whether or not a user is using a 

//proxy server to connect to your website.

echo "<font size=3><B>Proxy Detector</B></font><P>";
if(isset($HTTP_X_FORWARDED_FOR)) {


	// proxy detected...


	<b>Proxy Detected...</b><br>

	Your Actual IP Address: 

	<i><?= $HTTP_X_FORWARDED_FOR ?></i><br>

	Your Proxy Server: 

	<i><?= $HTTP_VIA ?></i>

        <BR> You Proxy I.P address: <?= $REMOTE_ADDR ?><br>


} else 	{ 

	// no proxy detected



	<b>No Proxy Detected</b><br>


	Your Actual IP Address:

	<i><?= $REMOTE_ADDR ?></i><br>