hi frnds i want t add country flags,country name, in lavalair profile plz help me out here is the code<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?php
$db_host = "localhost";
$db_user = "username";
$db_pass = "password";
$db_name = "database";
$dbc = mysql_connect($db_host, $db_user, $db_pass);
$dbs = mysql_select_db($db_name);
$_dez_ip=getdezIP();
$q = mysql_query("SELECT `cc`, `network` FROM `mobile_carrier` WHERE `num_min` <= '".$_dez_ip."' ORDER BY `num_min` DESC, `num_max` ASC LIMIT 1") or die("MySQL Error: ".mysql_error());
$info = mysql_fetch_array($q);
mysql_close();
$cc=$info[0];
echo 'Network: '.$info[1]; // Mobile network
echo 'Country code: '.$cc; // Country code
include("countries.php"); /* Include the country arrays to convert country code to country name */
echo 'Country: '.$countries[$cc];
/* you can also download famfamfam flag icons from
http://www.famfamfam.com/lab/icons/flags/
to show the country flag */
// echo 'Country flag : [img]flags/'.strtolower($cc).'.gif[/img]';
function getdezIP(){
$IP = "";
if (isSet($_SERVER)) {
if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
} elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
$IP = $_SERVER["HTTP_CLIENT_IP"];
} else {
$IP = $_SERVER["REMOTE_ADDR"];
}
} else {
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$IP = getenv( 'HTTP_X_FORWARDED_FOR' );
} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
$IP = getenv( 'HTTP_CLIENT_IP' );
} else {
$IP = getenv( 'REMOTE_ADDR' );
}
}
if (strstr($IP, ',')) {
$ips = explode(',', $IP);
$IP = $ips[0];
}
if(empty($IP)) $IP=$_SERVER["REMOTE_ADDR"];
else if(strtolower(trim($IP))=='unknown') $IP=$_SERVER["REMOTE_ADDR"];
$numbers = preg_split( "/\./", $IP);
$dezip=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);
return $dezip;
}
?></div>
$db_host = "localhost";
$db_user = "username";
$db_pass = "password";
$db_name = "database";
$dbc = mysql_connect($db_host, $db_user, $db_pass);
$dbs = mysql_select_db($db_name);
$_dez_ip=getdezIP();
$q = mysql_query("SELECT `cc`, `network` FROM `mobile_carrier` WHERE `num_min` <= '".$_dez_ip."' ORDER BY `num_min` DESC, `num_max` ASC LIMIT 1") or die("MySQL Error: ".mysql_error());
$info = mysql_fetch_array($q);
mysql_close();
$cc=$info[0];
echo 'Network: '.$info[1]; // Mobile network
echo 'Country code: '.$cc; // Country code
include("countries.php"); /* Include the country arrays to convert country code to country name */
echo 'Country: '.$countries[$cc];
/* you can also download famfamfam flag icons from
http://www.famfamfam.com/lab/icons/flags/
to show the country flag */
// echo 'Country flag : [img]flags/'.strtolower($cc).'.gif[/img]';
function getdezIP(){
$IP = "";
if (isSet($_SERVER)) {
if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
} elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
$IP = $_SERVER["HTTP_CLIENT_IP"];
} else {
$IP = $_SERVER["REMOTE_ADDR"];
}
} else {
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$IP = getenv( 'HTTP_X_FORWARDED_FOR' );
} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
$IP = getenv( 'HTTP_CLIENT_IP' );
} else {
$IP = getenv( 'REMOTE_ADDR' );
}
}
if (strstr($IP, ',')) {
$ips = explode(',', $IP);
$IP = $ips[0];
}
if(empty($IP)) $IP=$_SERVER["REMOTE_ADDR"];
else if(strtolower(trim($IP))=='unknown') $IP=$_SERVER["REMOTE_ADDR"];
$numbers = preg_split( "/\./", $IP);
$dezip=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);
return $dezip;
}
?></div>
Comment