Thanks to everyone who participated.
As said, I will release the source, it's not impressive, but it's nice to filter out most of the open proxies.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php 	function is_proxy($ip) { 		if (file_exists("safe/".$ip)) { 			return false; 		} elseif (file_exists("unsafe/".$ip)) { 			return true; 		} 		$raw=file_get_contents("http://en.m.wikipedia.org/wiki/Special:BlockList?limit=1&wpTarget=".$ip,false,stream_context_create(array('http'=>array('method'=>"GET",'header'=>"User-Agent: PHP\r\n")))); 		if (strpos($raw,"The requested IP address or username is not blocked.")) { 			fclose(fopen("safe/".$ip, 'w')); 			return false; 		} 		fclose(fopen("unsafe/".$ip, 'w')); 		return true; 	} 	if (is_proxy($_SERVER["REMOTE_ADDR"])) { 		echo "You have been detected as an open proxy, if you believe this is an error please contact the site administrator."; 	} else { 		echo "Welcome! Site content will be shown here."; 	} ?>
If you are a proxy it should indicate that you aren't allowed to use this website, and if not it should show a welcome message.
1× editiert, zuletzt 10.03.12 22:29:23