Country Flag Script!

Started on the old forum in January 2011 · view the original in the archive · old links redirect here

6 replies · 3,087 views · started 15 years ago · 1 min read

6 participants
rizwan Junior · 25 posts #1

Hello My Dear Friends, How Are You... Some buddy Give Me Country Flag Script. Thankyou

tkreturns Developer · 98 posts #2

hmmm

use the serach button, it really helps

ASK FOR HELP

subzero Super moderator Fellow · 3,954 posts #3

Put this where you need it.

<?
$IPaddress=$_SERVER['REMOTE_ADDR']; 
$two_letter_country_code=iptocountry($IPaddress);
  
include("ip_files/countries.php");
$three_letter_country_code=$countries[$two_letter_country_code][0];
$country_name=$countries[$two_letter_country_code][1];

print "Two letters code: <b>$two_letter_country_code</b> |";
print "Three letters code: <b>$three_letter_country_code</b> |  ";
print "Country name: <b>$country_name</b> |";

// To display flag
$file_to_check="flags/$two_letter_country_code.gif";
if (file_exists($file_to_check)){
                print " <img src=$file_to_check width=30 height=15>";
                }else{
                print " <img src=flags/noflag.gif width=30 height=15>";
                }

function iptocountry($ip) {
    $numbers = preg_split( "/\./", $ip);
    include("ip_files/".$numbers[0].".php");
    $code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);
    foreach($ranges as $key => $value){
        if($key<=$code){
            if($ranges[$key][0]>=$code){$two_letter_country_code=$ranges[$key][1];break;}
            }
    }
    if ($two_letter_country_code==""){$two_letter_country_code="unkown";}
    return $two_letter_country_code;
}
?>

Then add this files unzip folders to www folder.

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

Attachments: ip_files.zip flags.zip
Miklo Newbie · 3 posts #4

Thank you so much, I am opening my own IP Script site,

Thank you very much for this, this forum have been the best so far! Many forums just deletes users with no acitivity, well I musta say I am so happy that my accounts was not deleted! I am very greatfull to be a part of this forum, and as a web developer and vBulletin coder and Designer its the cleanest and most educational forum I have seen so far!

Thanks for having me, and thank you for the great script!

santha26 Junior · 40 posts #5

subzero wrote: Put this where you need it.

<?
$IPaddress=$_SERVER['REMOTE_ADDR']; 
$two_letter_country_code=iptocountry($IPaddress);
  
include("ip_files/countries.php");
$three_letter_country_code=$countries[$two_letter_country_code][0];
$country_name=$countries[$two_letter_country_code][1];

print "Two letters code: <b>$two_letter_country_code</b> |";
print "Three letters code: <b>$three_letter_country_code</b> |  ";
print "Country name: <b>$country_name</b> |";

// To display flag
$file_to_check="flags/$two_letter_country_code.gif";
if (file_exists($file_to_check)){
                print " <img src=$file_to_check width=30 height=15>";
                }else{
                print " <img src=flags/noflag.gif width=30 height=15>";
                }

function iptocountry($ip) {
    $numbers = preg_split( "/\./", $ip);
    include("ip_files/".$numbers[0].".php");
    $code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);
    foreach($ranges as $key => $value){
        if($key<=$code){
            if($ranges[$key][0]>=$code){$two_letter_country_code=$ranges[$key][1];break;}
            }
    }
    if ($two_letter_country_code==""){$two_letter_country_code="unkown";}
    return $two_letter_country_code;
}
?>

Then add this files unzip folders to www folder.

can you give me the upto-date ip files, because it doesn't detect some ip's . I checked with my mobile it returns empty country code , but in pc it detected correctly.

Hammad Developer · 89 posts #6

Use it With Gum_real_ip Function

santha26 wrote: can you give me the upto-date ip files, because it doesn't detect some ip's . I checked with my mobile it returns empty country code , but in pc it detected correctly.

Use it with gum_real_ip function it will work correctly

WapdeviL.iN Most Updated Services Portal.. Want To increase Site Users ???

santha26 Junior · 40 posts #7

Hammad wrote: Use it with gum_real_ip function it will work correctly

No its not working

my ip: 101.220.198.245

it should return " India "

but i m getting

Two letters code: unkown Three letters code: Country name:

I think that ip address was not in the ip_files folder

Can you tell me how to add new ip list to the ip_files folder

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close