Checking for Proxy Connections

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Zorth
Forum Commoner
Posts: 76
Joined: Fri Feb 20, 2004 8:00 pm

Checking for Proxy Connections

Post by Zorth »

Hey all,

Is there a way to see if the person connecting to a page is connecting with a proxy server? Would be usefull to get rid of spammers on my forums who connect using them.

Thanks.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Code: Select all

#something like this..
<?
if(isset($HTTP_X_FORWARDED_FOR))
{
	if ($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>
	
	<?
} 
?>
You also might wanna take a look @ this.

http://www.php.net/getenv
Zorth
Forum Commoner
Posts: 76
Joined: Fri Feb 20, 2004 8:00 pm

Post by Zorth »

I am hearing that there are some proxies that block out the variables
HTTP_X_FORWARDED_FOR, HTTP_VIA and HTTP_PROXY_CONNECTION

Are there ways to track proxy connections from proxies that don't send these?

Thanks.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

if they don't send that information, there is almost no way for the server to tell if they are proxied..
Zorth
Forum Commoner
Posts: 76
Joined: Fri Feb 20, 2004 8:00 pm

Post by Zorth »

Well I suppose most proxies that don't send that kind of information are legit anyways, right?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

from what I remember, not sending that information if you are a proxy, classifies you as non-conforming.. however, there's nothing stopping someone from doing it..
Post Reply