Quote:
Originally Posted by hatijahat
hello guys,
need a little help here, i have try to install geopip in my vps,
but still in the site didn't mention from what country the IP Address from.
is there any code needed for this?
|
Save the two atached files to www root and then save this in bittorrent.php
PHP Code:
function cipf($ipf) {
include ("geoip.inc");
$handle = geoip_open("GeoIP.dat", GEOIP_STANDARD);
switch (geoip_country_code_by_addr($handle, $ipf)) {
case "UK" :
$flag_out = "<img src='/pic/flag/uk.gif'>";
break;
case "USA" :
$flag_out = "<img src='/pic/flag/.gif'>";
break;
case "ZA" :
$flag_out = "<img src='/pic/flag/southafrica.gif'>";
break;
default :
$flag_out = "not defined!";
}
Return "IP address $ipf located in " . geoip_country_name_by_addr($handle, $ipf) . " (country code " . geoip_country_code_by_addr($handle, $ipf) . ") $flag_out";
geoip_close($handle);
}
Then replace your current Ip address line in userdetails.php with this
PHP Code:
print ("<tr><td class=rowhead>Country</td><td align=left>".Cipf($user["ip"])."</td></tr>\n");
You will need to add more flags in the switch Ive only added three..