Jump to content

why array value is not passing


phpmady

Recommended Posts

function get_geoip($ip,$method_type,$image_use)

{

 

 

$array=array();

include("geoip/geoip.inc");

$gi = geoip_open("geoip/GeoIP.dat",GEOIP_STANDARD);

$country_code = geoip_country_code_by_addr($gi, "$ip");

$country_name = geoip_country_name_by_addr($gi, "$ip");

 

 

 

geoip_close($gi);

$cc=strtolower($country_code);

$img_str = "<img src=\"./geoip/flags/$cc.png\" border=0>";//geoip_close($gi);

if($method_type == 'short')

{

$array[0]=$country_code;

 

}

 

if($method_type == 'long')

{

$array[0]=$country_name;

 

 

}

 

if($image_use == 'yes')

{

$array[1]=$img_str;

return $array;

}

 

}

 

//since $_SERVER['REMOTE_ADDR'] would be 127.0.0.1

//$ip = $_SERVER['REMOTE_ADDR'];

$ip[] = '78.93.167.238';

$ip[] = '78.93.167.239';

 

var_dump($ip);

 

//$ip[1] = '78.93.167.239';

 

 

 

 

 

//$ip = '10.199.212.2';

 

//$k=0;

 

for($k=0;$k<2;$k++)

{

//echo "hi";

$returned_array=get_geoip($ip[$k],'long','yes');

$tpl->newBlock("stats1");

//echo var_dump($returned_array);

$tpl->assignGlobal("country",$returned_array[0]);

$tpl->assignGlobal("flag",$returned_array[1]);

}

Link to comment
https://forums.phpfreaks.com/topic/196242-why-array-value-is-not-passing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.