Profile Help

Started on the old forum in April 2008 · view the original in the archive · old links redirect here

6 replies · 464 views · started 18 years ago · 1 min read

2 participants
cortez Junior · 27 posts #1

hi frnds i want t add country flags,country name, in lavalair profile plz help me out here is the codeCODE<?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 : External image (may be gone)';

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; } ?>

cortez Junior · 27 posts #3

frnd i tried but i got dis error. Call to undefined function: getdezip() in /home/www/sitename/index.php on line 2390

plz help me any 1

crazybrumi Super moderator Principal · 1,064 posts #5
$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);

u still ent got that have you ? u need to delete that if yu have a inlcude config.php alredi on the page

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

cortez Junior · 27 posts #6

its working in my login page bt i want 2 add it in profile i tried bt get errors

cortez Junior · 27 posts #7
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;
}

i add this part in core.php

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