hello all,
i have a roblam that need some new view.
i have a file that contain ip | country
what i am tring to do is to know how many ips i have from each country.
the file looks like that :
34.34.34.34 | US
34.24.24.24 | US
12.12.12.12 | UK
10.10.10.10 | FR
my out put should say that i have
3 countrys (US,UK,FR)
and in US 2 ips: ip,ip.
in UK 1 ip: ip.
in FR 1 ip: ip.
i mange to create array with string index for all the countrys
but from here i am stock.
please help
here is a bit of code i done so far
[CODE=php]<?php
$countrys = array();
$file = "ip_list.tx t";
$handle = @fopen($file,"r ");
if ($handle) {
while(!feof($ha ndle)){
$line = explode("|",fge ts($handle, 4096));
$countrys[$line[1]]=array();
}
echo count($countrys );
print_r($countr ys);
?>[/CODE]
what i need to do now the way i see it is to
go over the file agian and
how can it be done?
i have a roblam that need some new view.
i have a file that contain ip | country
what i am tring to do is to know how many ips i have from each country.
the file looks like that :
34.34.34.34 | US
34.24.24.24 | US
12.12.12.12 | UK
10.10.10.10 | FR
my out put should say that i have
3 countrys (US,UK,FR)
and in US 2 ips: ip,ip.
in UK 1 ip: ip.
in FR 1 ip: ip.
i mange to create array with string index for all the countrys
but from here i am stock.
please help
here is a bit of code i done so far
[CODE=php]<?php
$countrys = array();
$file = "ip_list.tx t";
$handle = @fopen($file,"r ");
if ($handle) {
while(!feof($ha ndle)){
$line = explode("|",fge ts($handle, 4096));
$countrys[$line[1]]=array();
}
echo count($countrys );
print_r($countr ys);
?>[/CODE]
what i need to do now the way i see it is to
go over the file agian and
Code:
if $line[1] == string_index //US==US then country["US"][0]= 34.34.34.34
Comment