1. I will provide a little upgrade module that will update the database from remote CSV 2. That can be done using php, rather than updating names in database $info = get_ip_info($_SERVER['REMOTE_ADDR']); $cnt = ucfirst(strtolower($info['ip_country'])); // Canada Code (markup): regards
What about Countries with longer names? E.G. Russian Federation, United States, United Kingdom, United Arab Emirates, etcera. This is how Example1.php looks like: <? /**************************************************\ IP2S IP to Country Script By support@apitalk.com Version 1.0 License 100% free no license, no mess, use for any purpose \**************************************************/ #Example 1. Simple usage, print country name include 'ip2c.inc'; $info = get_ip_info($_SERVER['REMOTE_ADDR']); # $_SERVER['REMOTE_ADDR'] is user's ip address $cnt = ucfirst(strtolower($info['ip_country'])); // Lowercase countries echo "Country : $info[ip_country]"; ?> PHP: It is still in capitals! mafia-mp.com/Example1.php
In your code you are printng $info[ip_country], where you had to use $cnt, secondly, Disregard the last reply. use following $info = get_ip_info($_SERVER['REMOTE_ADDR']); $cnt = ucwords(strtolower($info['ip_country'])); // UNITED STATES -> United States regards
Thank you, a lot. It works, perfectly. <? /**************************************************\ IP2S IP to Country Script By support@apitalk.com Version 1.0 License 100% free no license, no mess, use for any purpose \**************************************************/ #Example 1. Simple usage, print country name include 'ip2c.inc'; $info = get_ip_info($_SERVER['REMOTE_ADDR']); $cnt = ucwords(strtolower($info['ip_country'])); // UNITED STATES -> United States echo "Country : $cnt"; ?> PHP: You should update your package, I'm sure that's better for everyone! Thank you, again. However, I have a question. How can I make this script work on a forum? I mean, have a different country for every user: Say the user comes from Canada, and another one comes from Sweden and then a guest decides to visit the forums and sees the respective countries for every user. For the Canadian user, the guest will see Country: Canada and for the Swedish user, the guest will see Country: Sweden. Thank you!
Secondly I posted fast, strtolower is also not required, following is sufficient: $cnt = ucwords( $info['ip_country'] ); As far forum, track the user ip addresses, and display countyr name accordingly. regards
That did not work (by removing strtolower). <? /**************************************************\ IP2S IP to Country Script By support@apitalk.com Version 1.0 License 100% free no license, no mess, use for any purpose \**************************************************/ #Example 1. Simple usage, print country name include 'ip2c.inc'; $info = get_ip_info($_SERVER['REMOTE_ADDR']); $cnt = ucwords($info['ip_country']); echo "Country : $cnt"; ?> PHP: It's all capitalized.
Alright, thank you. I have +rep you, I'm going to try to learn some PHP and try to do that forum script which I have asked you about! Wish me luck, this is going to be tough, I feel it! Do you offer guidance?
Yes I lead 4 developers and that is my job 8 hours daily, I write free scripts in spare time. So cant really promis when to help. Besides I engage my developers in commercial projects. regards
switch($info['ip_code2']) { case 'CA': header("Location http://www.yousite.com/canada"); break; case 'PK': header("Location http://www.yousite.com/paksitan"); break; case 'IN': header("Location http://www.yousite.com/india"); break; case 'CN': header("Location http://www.yousite.com/china"); } Code (markup): I hope it helps.
I was looking for one from almost one year... but cant find a free one... thanks a lot for ur good work []
I added the script to my website but i m gaving problems getting it to work can you please help. Thanks a lot. this is where the script is installed: http://choufouni.com/webmaster_tools/ip2c/index.php this is what i get: Fatal error: Call to undefined function: get_ip_info() in /homepages/40/d153471067/htdocs/choufouni.com/webmaster_tools/ip2c/myscript.php on line 2
After going through all the posts & comments about various errors, I am confused so could someone please summarize & post the most updated working download link & print code. Thanks