<?
function city($user=NULL)
{
global $set;
static $users;

$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $user LIMIT 1"));

if ($ank['ank_city']>0){
$city=mysql_fetch_array(mysql_query("SELECT * FROM `city` WHERE `id`='$ank[ank_city]' LIMIT 1"));
$region=mysql_fetch_array(mysql_query("SELECT * FROM `region` WHERE `id`='$city[region]' LIMIT 1"));
$country=mysql_fetch_array(mysql_query("SELECT * FROM `country` WHERE `id`='$city[country]' LIMIT 1"));
return "<img src='/style/flags/$country[ico].gif' alt='*' class='icon'/> $country[name], $city[name] ($region[name])";
}
}

function ankcity($user=NULL)
{
global $set;
static $users;

$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $user LIMIT 1"));

if ($ank['ank_city']>0){
$city=mysql_fetch_array(mysql_query("SELECT * FROM `city` WHERE `id`='$ank[ank_city]' LIMIT 1"));
$country=mysql_fetch_array(mysql_query("SELECT * FROM `country` WHERE `id`='$city[country]' LIMIT 1"));
return "<img src='/style/flags/$country[ico].gif' alt='*' class='icon'/> <a href='search.php?city=$city[id]'>$city[name]</a> (<a href='search.php?country=$country[id]'>$country[name]</a>)";
}
}

function oncity($user=NULL)
{
global $set;
static $users;

$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $user LIMIT 1"));

if ($ank['ank_city']>0){
$city=mysql_fetch_array(mysql_query("SELECT * FROM `city` WHERE `id`='$ank[ank_city]' LIMIT 1"));
$country=mysql_fetch_array(mysql_query("SELECT * FROM `country` WHERE `id`='$city[country]' LIMIT 1"));
return "<img src='/style/flags/$country[ico].gif' alt='*' class='icon'/> $city[name]";
}
}

?>
