yaakhi 0 Newbie Poster

hi there web masters, i have a simple script in php which shows users online with their ip and browser can you please modify it to show country flag or name or both here is the code

<?php 
error_reporting(0); 
include("cnfg.php"); 
$ms=mysql_connect($host,$login,$pass) or exit; 
mysql_select_db($db) or exit; 
$res=mysql_query("Select * From `online` Order By time Desc"); 
$mrp=array("SIE-"=>"Siemens ","MOT-"=>"Motorola "); $n=0; $arr=NULL; $st=""; 
while ($ar=mysql_fetch_array($res,MYSQL_ASSOC)) {$n++; $ua=""; 
 $ua2=htmlspecialchars(str_replace('$','$$',trim(strtr($ar["ua"],$mrp))),ENT_QUOTES); 
 for ($i=0;$i<strlen($ua2);$i++) { 
  if (($ua2[$i]<>"/")&&($ua2[$i]<>" ")) {$ua.=$ua2[$i];} else {break;} 
 } 
 $arr[]="<b>$n</b>. ".trim($ar["ip"])."; $ua; ".date("H:i:s",$ar["time"])."<br/>"; 
} 
mysql_close($ms); 

$cnt=count($arr); $nm=15; $allp=ceil($cnt/$nm); 
$p=trim($_GET['p']); if ($p<1) {$p=1;} elseif ($p>$allp) {$p=$allp;} 
$begin=$p*$nm-$nm; if ($begin>$cnt-1) {$begin=0;} 
$end=$begin+$nm; if ($end>$cnt-1) {$end=$cnt;} 
for ($i=$begin;$i<$end;$i++) {$st.=$arr[$i];} $lks=""; 
if ($p>1) {$v=$p-1; $lks.="<a href=\"users.php?p=$v\">Предыдущие</a><br/>\r\n";} 
if ($allp>$p) {$v=$p+1; $lks.="<a href=\"users.php?p=$v\">Следующие</a><br/>\r\n";} 
if ($lks<>NULL) {$lks.="- - -<br/>";} 

header('Content-type: application/vnd.wap.xhtml+xml'); 
echo '<?xml version="1.0" encoding="utf-8"?> 
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" > 
<head> 
<meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8"/> 
</head> 
<body> 
<p style="text-align:left;font-size:small;"> 
'.$st.' 
- - -<br/>'.$lks.' 
<a href="./">Назад</a> 
</p> 
</body></html>'; 
?>