Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
Auto-Detect User Location At Registration Details »»
Auto-Detect User Location At Registration
Version: 1.00, by Raz Raz is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 06-05-2003 Last Update: Never Installs: 9
 
No support by the author.

Simple hack making use of the Directi Ip-to-Country Database (included).

What it does
Auto-detects which country user is from and auto-fills the location field on the registration form using their IP Address.

Installing
Import the 'ip2country' table attached into your forums database. Either use phpMyAdmin or from ssh.
(Make sure your mysql max_packet size is large enough to handle the ~2 Mb file -- otherwise try downloading this split table here)

Open up register.php and look for:
PHP Code:
        while ($profilefield=$DB_site->fetch_array($profilefields)) {
                
$profilefieldname "field$profilefield[profilefieldid]"
Above that place the following:
PHP Code:
// CUSTOM ADD AUTO LOCATION
$ip_number sprintf("%u",ip2long($REMOTE_ADDR));
$ct_array $DB_site->query_first("SELECT COUNTRY_NAME FROM ip2country WHERE $ip_number >= IP_FROM AND $ip_number <= IP_TO LIMIT 1");
$bbuserinfo['field2'] = ucwords(strtolower($ct_array['COUNTRY_NAME']));
// END CUSTOM ADD AUTO LOCATION 
Once you've done that, you're all set.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 06-07-2003, 11:47 AM
Raz's Avatar
Raz Raz is offline
 
Join Date: Oct 2001
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here are my stats:

Data 1,448 KB
Index 699,392 Bytes
Total 2,131 KB

Rows 56,576
Row length ø 26
Row size ø 39 Bytes
Reply With Quote
  #23  
Old 06-07-2003, 12:03 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bingo! We have a winner. Thank you, sir.

[high]* Boofo sneaks off to click install[/high]
Reply With Quote
  #24  
Old 06-09-2003, 02:54 AM
zajako's Avatar
zajako zajako is offline
 
Join Date: Jan 2002
Location: a place not to far away
Posts: 633
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is there a free city listing set of tables, or does this one list the city,Country

i know its possible to determine city from ip but im sure that would make the db jump several megs. Im willing to do it if there is one avaliable.

of course ill use it a lot more than just showing in their location
Reply With Quote
  #25  
Old 06-09-2003, 03:48 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That would be a great idea if the IPs always returned to correct city. Mine shows Alexandria, Virginia, USA and I am in Des Moines, Iowa USA. Sometimes it shows the headquarters of your ISP instead.
Reply With Quote
  #26  
Old 06-09-2003, 03:55 AM
S.Shady's Avatar
S.Shady S.Shady is offline
 
Join Date: Apr 2003
Location: Cleveland, Ohio
Posts: 179
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

or the proxie your on as i found out today thought somone was in la turns out they were in washington :-\
Reply With Quote
  #27  
Old 06-09-2003, 04:04 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's true, but I am not on a proxy and it still shows my city and state wrong.
Reply With Quote
  #28  
Old 06-09-2003, 04:21 AM
S.Shady's Avatar
S.Shady S.Shady is offline
 
Join Date: Apr 2003
Location: Cleveland, Ohio
Posts: 179
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i didnt mean you i ment a general user - but its weird its wrong.
Reply With Quote
  #29  
Old 06-09-2003, 04:40 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, No, I know you weren't talking about me. I was just trying to let you know that proxies aren't the only ones that can be wrong. You're right. It is weird.
Reply With Quote
  #30  
Old 06-09-2003, 04:55 AM
zajako's Avatar
zajako zajako is offline
 
Join Date: Jan 2002
Location: a place not to far away
Posts: 633
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah but even if it is worng sometimes, it still captures a majority of the users.
Reply With Quote
  #31  
Old 06-09-2003, 05:09 AM
S.Shady's Avatar
S.Shady S.Shady is offline
 
Join Date: Apr 2003
Location: Cleveland, Ohio
Posts: 179
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 01:55 AM zajako said this in Post #29
yeah but even if it is worng sometimes, it still captures a majority of the users.

true
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:43 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04741 seconds
  • Memory Usage 2,304KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete