[Download] **** IP 2 Country Script **** I wrote 100% FREE

Discussion in 'Programming' started by Vooler, Jul 5, 2008.

  1. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #21
    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
     
    Vooler, Jul 21, 2008 IP
  2. MadK3

    MadK3 Well-Known Member

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    118
    #22
    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
     
    MadK3, Jul 22, 2008 IP
    Vooler likes this.
  3. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #23
    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
     
    Vooler, Jul 22, 2008 IP
  4. MadK3

    MadK3 Well-Known Member

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    118
    #24
    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!
     
    MadK3, Jul 22, 2008 IP
  5. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #25
    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
     
    Vooler, Jul 22, 2008 IP
  6. MadK3

    MadK3 Well-Known Member

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    118
    #26
    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.
     
    MadK3, Jul 22, 2008 IP
  7. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #27
    Vooler, Jul 22, 2008 IP
  8. MadK3

    MadK3 Well-Known Member

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    118
    #28
    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? :p
     
    MadK3, Jul 22, 2008 IP
  9. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #29
    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
     
    Vooler, Jul 22, 2008 IP
  10. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #30
    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.
     
    Vooler, Sep 25, 2008 IP
  11. Mr.O

    Mr.O Well-Known Member

    Messages:
    123
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    103
    #31
    I was looking for one from almost one year... but cant find a free one...

    thanks a lot for ur good work [:D]
     
    Mr.O, Sep 27, 2008 IP
  12. SEOBOT

    SEOBOT Banned

    Messages:
    794
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #32
    Great script good.. i really appreciate
     
    SEOBOT, Sep 27, 2008 IP
  13. LowBattery

    LowBattery Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #33
    its needed. thanks for sharing. good work ;)
     
    LowBattery, Sep 28, 2008 IP
  14. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #34
    Welcome welcome welcome :)

    Any examples of you guys using it over ?
     
    Vooler, Sep 28, 2008 IP
  15. rhoula

    rhoula Well-Known Member

    Messages:
    875
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    145
    #35
    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
     
    rhoula, Oct 4, 2008 IP
  16. ruberr2002

    ruberr2002 Peon

    Messages:
    463
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #36
    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
     
    ruberr2002, Nov 15, 2008 IP