![]() |
Auto-Detect User Location At Registration
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:
PHP Code:
|
Cool! 8-)
Moving servers right now, but I will install this when I am done. :) |
Doesn't work here... Nothing changes at all...
|
didn't work for me on vbulletin 2.3
|
Maybe that is because phpMyAdmin doesn't support files as large as this...?
|
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...
|
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.
|
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. |
Great idea but you really need to make the query into a few smaller ones for those of us that don't have SSH. ;)
|
Have you tried importing it from phpMyAdmin? It may be large, but its not impossible.
|
dont you have to pay for ip2country database?
|
From the site (link posted in first post):
Quote:
|
Quote:
Okay, I'm kidding... Here's the serious part of this post: Quote:
|
Quote:
|
Yes it works now.
I got it to work when someone updates their profile too: In member.php above PHP Code:
Works great, thank you. I'm using 2.3.0. |
Quote:
|
Really nice! *installed*
I attached a split version of the ip2country table. Make sure you first insert part1 before inserting the other parts (in order to create the table). Alex |
Thanks a lot AlexanderT!! :)
|
I've added a link to the split table in the first post.
|
Can someone tell me how many rows there are and what size the table should be? I want to make sure I got it in there right.
|
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 |
Bingo! We have a winner. Thank you, sir. ;)
[high]* Boofo sneaks off to click install[/high] |
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 ;) |
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.
|
or the proxie your on :) as i found out today thought somone was in la turns out they were in washington :-\
|
That's true, but I am not on a proxy and it still shows my city and state wrong.
|
i didnt mean you :) i ment a general user - but its weird its wrong.
|
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. ;)
|
yeah but even if it is worng sometimes, it still captures a majority of the users.
|
Quote:
true |
I don't know of a freely available database that does this.
For larger ISPs it would probably be wrong, as it would just show the HQ of the ISP (who the IPs are registered to). |
I made a small change to the code Tim Wheatley posted for the "member.php" file as follows..
Add: PHP Code:
PHP Code:
In other words, if the user already has something in the location field it won't be changed. If the location field is empty, it will be automatically filled in with the country name. |
I also made the following change so no user can leave the location field empty in their profile..
In "root/member.php" find: PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
How could i combine this hack with the Flagshack?
So that it looks up what country the IP is in and then update the countryflag next to the username. Would this be hard to do? |
Pikok - The changes you mentioned, will they be the same for ver 2.3.0 also ??
I am really interested in this hack, let me know how your changes and this hack works on 2.3.0 ?? Thank you very much Cheers |
Are there new version for 3.6.4?
Thanks. |
I was searching for something else entirely and came across this.
Quote:
Quote:
|
All times are GMT. The time now is 04:52 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|