Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

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
  #2  
Old 06-06-2003, 01:26 PM
cirisme cirisme is offline
 
Join Date: Jan 2003
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cool! 8-)

Moving servers right now, but I will install this when I am done.
Reply With Quote
  #3  
Old 06-06-2003, 02:11 PM
Tim Wheatley's Avatar
Tim Wheatley Tim Wheatley is offline
 
Join Date: Nov 2001
Location: England
Posts: 489
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Doesn't work here... Nothing changes at all...
Reply With Quote
  #4  
Old 06-06-2003, 02:13 PM
msimplay's Avatar
msimplay msimplay is offline
 
Join Date: Aug 2002
Location: UK
Posts: 1,059
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

didn't work for me on vbulletin 2.3
Reply With Quote
  #5  
Old 06-06-2003, 04:25 PM
partang2 partang2 is offline
 
Join Date: Jun 2002
Location: Norway
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe that is because phpMyAdmin doesn't support files as large as this...?
Reply With Quote
  #6  
Old 06-06-2003, 05:34 PM
Tim Wheatley's Avatar
Tim Wheatley Tim Wheatley is offline
 
Join Date: Nov 2001
Location: England
Posts: 489
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It does, the queries worked eventually. Took a while though. The problem is it's just not working, don't know the reason why though...
Reply With Quote
  #7  
Old 06-06-2003, 05:53 PM
-Sidekick- -Sidekick- is offline
 
Join Date: May 2002
Location: Cudahy, Wi
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That sucks. I'll have to keep checking back then. Cause I hate when people leave there Location empty and then it shows up blank in the postbit.
Reply With Quote
  #8  
Old 06-06-2003, 07:07 PM
Raz's Avatar
Raz Raz is offline
 
Join Date: Oct 2001
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Apologies. There are many modifications on my boards, which is why it isn't working on others.

I've installed a vanilla version, and modified the instructions to reflect normal installations. So please try those now

Also make sure that your mysql max_packet variable is large enough to handle a 2MB file. I would personally recommend importing the table via ssh.
Reply With Quote
  #9  
Old 06-06-2003, 07:16 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great idea but you really need to make the query into a few smaller ones for those of us that don't have SSH.
Reply With Quote
  #10  
Old 06-06-2003, 07:30 PM
Raz's Avatar
Raz Raz is offline
 
Join Date: Oct 2001
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you tried importing it from phpMyAdmin? It may be large, but its not impossible.
Reply With Quote
Reply


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 03:22 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06385 seconds
  • Memory Usage 2,297KB
  • Queries Executed 23 (?)
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)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
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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