| 
		
			
			
				
			
			
				 
			
			
				
			
		 | 
		
			
			
				 
			
				
			
		 | 
	||||
| 
				Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.  You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us.  | 
		
		 
		![]()  | 
	
		
			
  | 	
	
	
		
		|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. | 
| 
		 | 
	Thread Tools | 
| 
			
			 | 
		#1 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jan 2004 
				Location: oddfuturewolfgangkillthemall!!!!!!! 
				
				
					Posts: 5,656
				 
				
				
				
				 | 
	
	
	
	
		
			
			 
				
				Anyone using the Maxmind geoip lookup?
			 
			This thing is just returning United States for every non-US IP I throw at it.. wtf? 
		
	
		
		
		
		
			
		
		
		
		
	
	<?php include_once("geoip.inc"); $open = geoip_open("GeoIP.dat", GEOIP_STANDARD); print geoip_country_code_by_addr($open, "62.41.77.63"); geoip_close($open); ?> Should return DE for Germany but it says US from everything..  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Registered User 
			
		
			
			
			Industry Role:  
				Join Date: May 2004 
				
				
				
					Posts: 7,760
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 I will have to check some older sites to get you the proper code. 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Aug 2009 
				Location: me at smellynose.com 
				
				
					Posts: 206
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Code: 
	$bad_country_codes = Array('CN', 'JP', 'TW');
require_once("geoip.inc");
$gi = geoip_open("/usr/share/GeoIP/GeoIP.dat", GEOIP_STANDARD);
$cc = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
if(in_array($cc, $bad_country_codes)) {
        exit;
}
Have you checked you're not giving it a US ip all the time? You can go to maxmind.com and enter the IP there and it will tell you the location of the IP so you will be able to see whether you've given it a US ip or your code is wrong. 
				__________________ 
		
		
		
		
	
	I'm a PHP developer - 594086663 - [email protected]  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 Confirmed User 
			
		
			
			
			Join Date: Oct 2002 
				Location: netherlands 
				
				
					Posts: 248
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 i blocked out the following countries also :  IR ID KR VE IN 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 Amateur Gynecologist 
			
		
			
			
			Industry Role:  
				Join Date: May 2009 
				Location: Medellin 
				
				
					Posts: 4,436
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 I just started using it recently, I wanted to block the Dominican Republic from some of my cascades but it keeps thinking the DR is Canada. 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 It's 42 
			
		
			
			
			Industry Role:  
				Join Date: Jun 2010 
				Location: Global 
				
				
					Posts: 18,083
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 I use the Perl Binary; 
		
	
		
		
		
		
		
	
	Code: 
	#!/usr/bin/perl
####################################
#geo_ip_no.cgi
#Specific geo target
#
#
#
#
####################################
use CGI::Carp qw/fatalsToBrowser/;
use CGI qw/:standard/;
$addr ="$ENV{'REMOTE_ADDR'}";
$browser = $ENV{'HTTP_USER_AGENT'};
$geoip_file =  "/usr/share/geo_ip/GeoIP.dat";
print "Content-type: text/html\n\n";
$qstring = "$ENV{'QUERY_STRING'}";
	if ($qstring =~ s/[^a-zA-Z0-9\_]//g) {print qq~HUH???~;       exit;}
	use Geo::IP;
			$gi = Geo::IP->open( $geoip_file,  GEOIP_STANDARD)||die"died opening";
						$country_code = $gi->country_code_by_addr($addr);
			if ($country_code !~/(AA|BB|CC|DD|EE)/i){
				
				#INSERT
				
				
				
				
}#end geo ip
else{
	exit;
}
 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Apr 2006 
				Location: Germany 
				
				
					Posts: 4,323
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 I will also load a probably huge file on every page load. 
		
	
		
		
		
		
			Do yourself a favor and import the data into a database. 
				__________________ 
		
		
		
		
	
	--- ICQ 14-76-98 <-- I don't use this at all  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#8 | |
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Oct 2010 
				
				
				
					Posts: 227
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 Mysql DB will be huge enough and searching mysql db will not take less resource than searching their dat file... I'm using other method to opimize this - caching resolved countries for visitor IP's , so at least when single surfer is visiting page(s) with geo detection multiple times within day or two, it only searches .dat file once for him.  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#9 | 
| 
			
			
			
			 Confirmed User 
			
		
			
			
			Industry Role:  
				Join Date: Oct 2007 
				
				
				
					Posts: 1,448
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 I use it all the time, and it works great.  Try this instead: 
		
	
		
		
		
		
			Code: 
	<?php
include_once("geoip.inc");
include_once("geoipregionvars.php");
$gi = geoip_open("GeoIP.dat", GEOIP_STANDARD);
$record = geoip_record_by_addr($gi, "62.41.77.63");
$country_code = $record->country_code;
$state_code = $record->region;
$city_name = $record->city;
geoip_close($gi);
?>
				__________________ 
		
		
		
		
		
			
		
		
	
	xMarkPro -- Ultimate Blog Network Management Streamline your marketing operations. Centralize management of domains, pages, Wordpress blogs, sponsors, link codes, media items, sales and traffic statistics, plus more!  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#10 | 
| 
			
			
			
			 Confirmed User 
			
		
			
			
			Industry Role:  
				Join Date: Oct 2007 
				
				
				
					Posts: 1,448
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 No, don't do that.  It works just fine as is, and no need to create a headache for yourself every time Maxmind released an upgrade. 
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	xMarkPro -- Ultimate Blog Network Management Streamline your marketing operations. Centralize management of domains, pages, Wordpress blogs, sponsors, link codes, media items, sales and traffic statistics, plus more!  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#11 | 
| 
			
			
			
			 So Fucking Banned 
			
		
			
			
			Industry Role:  
				Join Date: Jul 2010 
				Location: Camp Crystal Lake. 
				
				
					Posts: 843
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 http://www.geoplugin.com/ Better, use it. Made by Borked, user here. 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#12 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jan 2003 
				Location: Los Angeles 
				
				
					Posts: 736
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 best way to optimize maxmind is to use the apache module mod_geoip 
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	Tanguy 0x7a69 inc. Programmer/President/CEO http://www.0x7a69.com A Leader in Programming since 1996 PHP, Ruby on Rails, MySQL, PCI DSS, and any Technical Consulting  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#13 | |
| 
			
			
			
			 Totally Borked 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Feb 2005 
				
				
				
					Posts: 6,284
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 Code: 
	Geolocation results for 62.41.77.63: *City: *Region: *Area Code: 0 *DMA Code: 0 *Country Name: Germany *Country Code: DE *Longitude: 9 *Latitude: 51 *Currency Code: EUR Currency Symbol: ? US$ Exchange Rate: 0.7354336098 (US$ was used here as the base currency.) (This can be changed for lookups.) At todays rate, US$100 will cost you ?73.54 Some places you may wish to visit near : 1: Place: Gemünden an der Wohra Country Code: DE Region: Hesse County: Latitude: 50.9666667 Longitude: 8.9666667 Distance (miles): 2.72 Distance (km): 4.38 Direction (degrees) 142.38 Direction (heading) SE 2: Place: Allendorf bei Frankenau Country Code: DE Region: Hesse County: Latitude: 51.0666667 Longitude: 8.9000000 Distance (miles): 6.33 Distance (km): 10.19 Direction (degrees) 45.22 Direction (heading) NE 3: Place: Hatzbach Country Code: DE Region: Hesse County: Latitude: 50.8833333 Longitude: 9.0166667 Distance (miles): 8.09 Distance (km): 13.02 Direction (degrees) 173.34 Direction (heading) S 4: Place: Allendorf an der Landsburg Country Code: DE Region: Hesse County: Latitude: 50.9500000 Longitude: 9.2166667 Distance (miles): 10.04 Distance (km): 16.16 Direction (degrees) 102.8 Direction (heading) ESE 5: Place: Neustadt Country Code: DE Region: Hesse County: Latitude: 50.8500000 Longitude: 9.1166667 Distance (miles): 11.54 Distance (km): 18.57 Direction (degrees) 146.31 Direction (heading) SSE 
				__________________ 
		
		
		
		
	
	![]() For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#14 | |
| 
			
			
			
			 Totally Borked 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Feb 2005 
				
				
				
					Posts: 6,284
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 
				__________________ 
		
		
		
		
	
	![]() For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#15 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jan 2004 
				Location: oddfuturewolfgangkillthemall!!!!!!! 
				
				
					Posts: 5,656
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Tried filling in the full path and it still functions the same, totally weird it just says US for any IP I feed to it.. 
		
	
		
		
		
		
			
		
		
		
		
	
	Thanks Borked the geoplugin works great! I did have to copy and paste the PHP class source and save it that way because the Winrar download on there (http://www.geoplugin.com/_media/webs...&cache =cache) opens as a corrupt 0kb file for me..?  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#16 | 
| 
			
			
			
			 Now choke yourself! 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Apr 2006 
				
				
				
					Posts: 12,085
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 I can only assume you aren't hard coding the URL, as you seem to have managed to handle things properly. 
		
	
		
		
		
		
			Are you caching the page with some WP-Supercache or other shit? If you have /any/ form of caching on this, it's not going to re-execute depending on how you are calling it. 
				__________________ 
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#17 | |
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Aug 2002 
				Location: Sunny Fucking California 
				
				
					Posts: 1,575
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 
				__________________ 
		
		
		
		
	
	“Ours is a world of nuclear giants and ethical infants. We know more about war than we know about peace, more about killing than we know about living. If we continue to develop our technology without wisdom or prudence, our servant may prove to be our executioner.” ― Omar Bradley (1948)  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#18 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jan 2010 
				Location: Online 
				
				
					Posts: 717
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 I was asked about maxmind recently, seems popular 
		
	
		
		
		
		
			
				__________________ 
		
		
		
		
	
	http://gaffg.com/affiliate-programs/ Find all gambling affiliate programs based on categories: casino, poker, sportsbetting, bingo, mobile. Find forex and binary options affiliate programs. Listed by revenue share, CPA and sub affiliate commission.  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#19 | |
| 
			
			
			
			 Totally Borked 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Feb 2005 
				
				
				
					Posts: 6,284
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 http://www.geoplugin.com/_media/webs....class.php.tgz or download from PHPClasses the classes from either source will be more up to date than the source you copy/pasted 
				__________________ 
		
		
		
		
	
	![]() For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#20 | |
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Industry Role:  
				Join Date: Jan 2004 
				Location: oddfuturewolfgangkillthemall!!!!!!! 
				
				
					Posts: 5,656
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 Grabbed the one from phpclasses and it works fine just like the one I copy and pasted from your site. Thanks!  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#21 | 
| 
			
			
			
			 Confirmed User 
			
		
			
			
			Join Date: May 2008 
				
				
				
					Posts: 3,406
				 
				
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 |