Thread: Forum Display Enhancements - GLA - Geographic Location Awareness for vBulletin
View Single Post
  #24  
Old 07-08-2007, 04:13 PM
mfyvie mfyvie is offline
 
Join Date: Mar 2007
Location: Zurich, Switzerland
Posts: 336
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually, what I meant was the range you wanted added, not just the ip address.

Anyway, if we look up that address you gave in the ARIN database we see that it is registered to comcast as you say, and covers the following range:

66.229.0.0 - 66.229.255.255 (a class B range, a pretty big chunk)

Before we do anything we need to convert this to numerical format. This is pretty simple, we just do it like this for the first part of the range:

66 * 256 * 256 *256
+
229 * 256 *256
+
0 * 256
+
0

This give us 1122304000

Now we do the same for the end of the address:

66 * 256 * 256 *256
+
229 * 256 *256
+
255 * 256
+
255

This gives us 1122369535

So we want to assign addresses between 1122304000 and 1122369535 to the US. But wait - are you really sure that this whole address range is in the US? How are you sure? Anyway, since this is your own database and nobody else's, you can do what you like.

Use a tool (like PhpMyAdmin, or the SQL query function in the admincp) to look inside your database. Execute the following SQL command to give you any ranges inside the one you want like this:

Code:
SELECT * FROM ip2country WHERE ip_from <= 1122369535 AND ip_to >= 1122304000
(note that I reversed the order of the high number and the low number).

We see that a single result is returned:

1122320960 - 1122320995 - only 35 addresses? In the middle of that range assigned to portugal? Probably a mistake.

Ok, so let's say you are absolutely sure that you want to add that big block in. You could make an SQL query like this:
Code:
INSERT INTO ip2country (ip_from, ip_to, country_code2, country_code3, country_name) VALUES ('1122304000', '1122369535', 'us', 'usa', 'United States')
Now you can use repair optimise table (in admincp) just for the ip2country table to rebuild the indexes.

Then you should be done. Anyone else can also use these instructions for another IP range if they like.

Some useful links:

http://ip-to-country.webhosting.info/forum (is full of spam, and isn't very useful, but these are the official forums for the database)
http://www.arin.net/whois/ (for looking up IP address ranges)

And of course - read install.txt and developer.txt in the installation archive for links, etc.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02121 seconds
  • Memory Usage 1,767KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete