コード例 #1
0
ファイル: class.mailer.php プロジェクト: migumuno/obesity
 function enviar($Mail)
 {
     //configuracion
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->Host = "smtp.mandrillapp.com";
     $mail->Port = 587;
     $mail->SMTPAuth = true;
     $mail->Username = "******";
     $mail->Password = "******";
     //puede que queramos cambiar el remitente por defecto
     if (!is_null($Mail->From) && $Mail->From != '') {
         $mail->From = $Mail->From;
     } else {
         $mail->From = "*****@*****.**";
     }
     if (!is_null($Mail->FromName) && $Mail->FromName != '') {
         $mail->FromName = $Mail->FromName;
     } else {
         $mail->FromName = "Soporte Innova";
     }
     $mail->Mailer = "smtp";
     if ($Mail->para != "") {
         $arr_paras = explode(";", $Mail->para);
         if (sizeof($arr_paras) > 0) {
             foreach ($arr_paras as $valor) {
                 if (trim($valor) != "") {
                     $mail->AddAddress(trim($valor));
                 }
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
     $mail->IsHTML(true);
     $mail->Timeout = 120;
     $mail->Subject = utf2iso($Mail->asunto);
     $mail->Body = utf2iso($Mail->cuerpo);
     $mail->AddReplyTo($mail->From, $mail->FromName);
     //enviamos el mail. Si falla, lo intentamos enviar hasta 3 veces
     $intentos = 0;
     do {
         $ok = $mail->Send();
         $intentos = $intentos + 1;
     } while (!$ok && $intentos < 3);
     return $ok;
 }
コード例 #2
0
function topplayersblock($sortby = "skill", $direction = "DESC", $offset = 0)
{
    global $coddb;
    global $minkills;
    global $minrounds;
    global $toplist_block;
    global $user_length;
    global $t;
    global $maxdays;
    global $currentconfignumber;
    $current_time = time();
    $sortfields = array("skill", "kills", "ratio");
    $sortby = strtolower($sortby);
    if (!in_array($sortby, $sortfields)) {
        $sortby = $sortfields[0];
    }
    if ($direction != "ASC") {
        $direction = "DESC";
    }
    echo "\n  <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"outertable\"><tr><td align=\"center\">Top {$toplist_block} - {$sortby}</span></td></tr><tr><td>\n  <table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" class=\"innertable\">\n  <tr class=\"outertable\">\n  <td>Rank</td>\n  <td>Name</td>\n  </tr>\n  ";
    $rank = $offset + 1;
    $rank_step = $direction == "ASC" ? -1 : 1;
    $query = "SELECT {$t['b3_clients']}.name, {$t['b3_clients']}.time_edit, {$t['players']}.id, kills, deaths, ratio, skill, winstreak, losestreak, rounds, fixed_name\n            FROM {$t['b3_clients']}, {$t['players']}\n            WHERE ({$t['b3_clients']}.id = {$t['players']}.client_id)\n                AND (({$t['players']}.kills > {$minkills})\n                     OR ({$t['players']}.rounds > {$minrounds}))\n                AND ({$t['players']}.hide = 0)\n        AND ({$current_time} - {$t['b3_clients']}.time_edit  < {$maxdays}*60*60*24)\n            ORDER BY {$sortby} {$direction}";
    if ($toplist_block > 0) {
        $query .= " LIMIT {$offset}, {$toplist_block}";
    }
    $result = $coddb->sql_query($query);
    while ($row = $coddb->sql_fetchrow($result)) {
        echo "<tr>";
        echo "<td>{$rank}</td>";
        $name = htmlspecialchars(utf2iso($row['fixed_name'] ? $row['fixed_name'] : $row['name']));
        if (strlen($name) > $user_length) {
            $name = substr($name, 0, $user_length) . '...';
        }
        if ($sortby == "skill") {
            echo "<td><a href=\"" . httplink() . "index.php?func=player&playerid={$row['id']}&config={$currentconfignumber}\" target=\"_blank\" title=\"{$sortby} - {$row['skill']}\">", $name, "</a></td>";
        } elseif ($sortby == "kills") {
            echo "<td><a href=\"" . httplink() . "index.php?func=player&playerid={$row['id']}&config={$currentconfignumber}\" target=\"_blank\" title=\"{$sortby} - {$row['kills']}\">", $name, "</a></td>";
        } elseif ($sortby == "ratio") {
            echo "<td><a href=\"" . httplink() . "index.php?func=player&playerid={$row['id']}&config={$currentconfignumber}\" target=\"_blank\" title=\"{$sortby} - {$row['ratio']}\">", $name, "</a></td>";
        }
        echo "</tr>";
        $rank += $rank_step;
    }
    echo "</table>";
    echo "</td></tr></table>";
    // Closing extra border-table
}
コード例 #3
0
function map_players($mapid)
{
    $link = baselink();
    global $coddb;
    global $separatorline;
    global $t;
    // table names from config
    global $map_minkills;
    global $map_minrounds;
    global $exclude_ban;
    global $currentconfignumber;
    global $text;
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"outertable\"><tr><td align=\"center\">" . $text["playermapstats"] . "</td></tr><tr><td>\n      <table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" class=\"innertable\">\n        <tr class=\"outertable\">\n          <td>" . $text["player"] . "</td>\n          <td colspan=\"2\" align=\"center\">" . $text["kills"] . "</td>\n          <td colspan=\"2\" align=\"center\">" . $text["suicides"] . "</td>\n          <td colspan=\"2\" align=\"center\">" . $text["teamkills"] . "</td>\n          <td align=\"center\">" . $text["rounds"] . "</td>\n    ";
    $query = "SELECT kills, suicides, teamkills, rounds\n            FROM {$t['maps']}\n            WHERE id = {$mapid}\n            LIMIT 1";
    $result = $coddb->sql_query($query);
    $row = $coddb->sql_fetchrow($result);
    $kills = $row['kills'];
    //  $deaths = $row['deaths'];
    $suicides = $row['suicides'];
    $teamkills = $row['teamkills'];
    $rounds = $row['rounds'];
    //  $teamdeaths = $row['teamdeaths'];
    $query = "SELECT {$t['b3_clients']}.name, {$t['playermaps']}.player_id, {$t['playermaps']}.kills, \n                {$t['playermaps']}.suicides, \n                {$t['playermaps']}.teamkills,\n                {$t['playermaps']}.rounds,\n                {$t['players']}.fixed_name\n            FROM {$t['b3_clients']}, {$t['players']}, {$t['playermaps']}\n            WHERE {$t['playermaps']}.map_id = {$mapid}\n                AND {$t['players']}.id = {$t['playermaps']}.player_id\n                AND {$t['players']}.hide = 0\n                AND {$t['b3_clients']}.id = {$t['players']}.client_id\n                AND ( {$t['playermaps']}.kills > {$map_minkills}\n                     OR {$t['playermaps']}.rounds > {$map_minrounds} )";
    if ($exclude_ban) {
        $query .= " AND {$t['b3_clients']}.id NOT IN (\n        SELECT distinct(target.id)\n        FROM {$t['b3_penalties']} as penalties, {$t['b3_clients']} as target\n        WHERE (penalties.type = 'Ban' OR penalties.type = 'TempBan')\n        AND inactive = 0\n        AND penalties.client_id = target.id\n        AND ( penalties.time_expire = -1 OR penalties.time_expire > UNIX_TIMESTAMP(NOW()) )\n      )";
    }
    $query .= "  ORDER BY {$t['playermaps']}.kills DESC";
    $result = $coddb->sql_query($query);
    while ($row = $coddb->sql_fetchrow($result)) {
        if ($separatorline == 1) {
            echo "<tr><td colspan=\"8\" class=\"outertable\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\" alt=\"\"></td></tr>";
        }
        // This draws a one pixel line between rows
        echo "<tr>";
        echo "<td><a href=\"{$link}?func=player&playerid={$row['player_id']}&config={$currentconfignumber}\">", htmlspecialchars(utf2iso($row['fixed_name'] ? $row['fixed_name'] : $row['name'])), "</a></td>";
        echo "  <td align=\"center\">", $row['kills'] ? $row['kills'] : "", "</td>";
        if ($kills > 0 && $row['kills'] > 0) {
            $temp = sprintf("%.2f", 100 * $row['kills'] / $kills);
            echo "  <td align=\"center\" class=\"tiny\">({$temp}%)</td>";
        } else {
            echo "  <td></td>";
        }
        echo "  <td align=\"center\">", $row['suicides'] ? $row['suicides'] : "", "</td>";
        if ($suicides > 0 && $row['suicides'] > 0) {
            $temp = sprintf("%.2f", 100 * $row['suicides'] / $suicides);
            echo "  <td align=\"center\" class=\"tiny\">({$temp}%)</td>";
        } else {
            echo "  <td></td>    ";
        }
        echo "  <td align=\"center\">", $row['teamkills'] ? $row['teamkills'] : "", "</td>";
        if ($teamkills > 0 && $row['teamkills'] > 0) {
            $temp = sprintf("%.2f", 100 * $row['teamkills'] / $teamkills);
            echo "  <td align=\"center\" class=\"tiny\">({$temp}%)</td>";
        } else {
            echo "  <td></td>";
        }
        echo "  <td align=\"center\">", $row['rounds'] ? $row['rounds'] : "", "</td>";
        echo "</tr>";
    }
    echo "</table>";
    echo "</td></tr><tr><td class=\"tiny\" align =\"right\">" . $text["youneedmap"] . "";
    echo "</td></tr></table>";
    // Closing extra border-table
}
コード例 #4
0
 function fix_name($name, $fixed_name = '', $name_length = 10)
 {
     if ($fixed_name == '') {
         unset($fixed_name);
     }
     $name = htmlspecialchars(utf2iso($fixed_name ? $fixed_name : $name));
     if (strlen($name) > $name_length) {
         $name = substr($name, 0, $name_length) . '...';
     }
     return $name;
 }
コード例 #5
0
function ShowMedal($MedalName, $ArchieveName, $ArchValue, $PlayerId, $Nick, $MedalPicture, $Description, $PlayerNames, $Scores, $FunctionName, $PlayerListIds, $Country, $ch)
{
    $link = baselink();
    global $game;
    global $currentconfignumber;
    global $text;
    global $geoip_path;
    // do we have game specific medals?
    if (file_exists("./images/medals/{$game}/")) {
        $MedalSrc = "./images/medals/{$game}/{$MedalPicture}";
    } else {
        $MedalSrc = "./images/medals/{$MedalPicture}";
    }
    // Clean the Nick from html code (translate)
    $Nick = htmlspecialchars(utf2iso($Nick));
    if ($ArchValue == 0 || $ArchValue == "" || $ArchValue == false) {
        $PlayerId = "";
        $ArchValue = $text["awardavailable"];
        $ArchieveName = ":";
        $Nick = "";
        $Scores[] = "";
        $text["owner"] = "";
        $text["score"] = ":";
    }
    flush();
    if (!isset($_GET['fname'])) {
        echo "<td align=\"center\" width=\"150\">\r\n      <table width=\"150\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\" class=\"with_border_alternate\">\r\n      <tr><td align=\"center\" class=\"cellmenu1\"><a name=\"{$Description}\"><strong><a href='{$link}?func=medal&fname={$FunctionName}' title=\"" . $text["seemedaldetails"] . "\">{$MedalName}</a></strong></a></td></tr>\r\n      <tr> \r\n        <td width=\"150\" class=\"line1\" nowrap valign=\"top\" align=\"center\">\r\n        <B>{$ArchieveName}: &nbsp;{$ArchValue}&nbsp;</B>\r\n        <br/><a href=\"{$link}?func=player&playerid={$PlayerId}&config={$currentconfignumber}\" title=\"" . $text["seeplayerdetails"] . "\">{$Nick}<br/></a>\r\n        <a href='{$link}?func=medal&fname={$FunctionName}' title=\"" . $text["seemedaldetails"] . "\">\r\n        <img src=\"{$MedalSrc}\" border=\"0\" style=\"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{$MedalSrc}', sizingMethod='scale')\" width=\"128\" height=\"256\" name=\"{$Description}\">\r\n        </a>\r\n        </td>\r\n      </tr>\r\n      <tr> \r\n        <td class=\"line0\" valign=\"top\" align=\"center\">\r\n         {$Description} \r\n        <br><br>\r\n        </td>\r\n      </tr>\r\n      </table>\r\n      </td>\r\n  ";
        $ch->close();
    } else {
        echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"outertable\">\r\n          <tr><td colspan=\"2\" align=\"center\">" . $text["medaldetails"] . "</td></tr>\r\n          <tr><td>\r\n            <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"innertable\">\r\n              <tr class=\"outertable\"><td width=\"50%\"align=\"center\">{$MedalName}</td><td align=\"center\">" . $text["topplayers"] . "</td></tr>\r\n              <tr><td>\r\n                <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\" class=\"outertable\">\r\n                  <tr class=\"innertable\"><td width=\"150\" rowspan=\"3\" align=\"center\"><img src=\"{$MedalSrc}\" style=\"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{$MedalSrc}', sizingMethod='scale')\" width=\"128\" height=\"256\" title=\"{$MedalName}\"></img></td>\r\n                  <td valign=\"top\">\r\n                    <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"innertable\">\r\n                      <tr><td height=\"10px\"><b><br>" . $text["owner"] . "<a href=\"{$link}?func=player&playerid={$PlayerId}&config={$currentconfignumber}\" title=\"" . $text["seeplayerdetails"] . "\">{$Nick}</a></b></td></tr>\r\n                      <tr class=\"innertable\"><td><b>" . $text["score"] . ": {$ArchValue}<br><br></b></td></tr>\r\n                      <tr><td colspan=\"1\" class=\"outertable\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\" alt=\"\"></td></tr>\r\n                      <tr class=\"innertable\"><td valign=\"top\"><b><br>" . $text["medaldescription"] . "<br></b>{$Description}</td></tr>\r\n                    </table></td>\r\n                </table></td>\r\n                  <td valign=\"top\">\r\n                    <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"innertable\">\r\n                      <tr><td>\r\n                        <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"innertable\">\r\n                          <tr class=\"outertable\">\r\n                          <td align=\"center\">" . $text["place"] . "</td>\r\n                          " . (file_exists($geoip_path . "GeoIP.dat") ? "<td align=\"center\">" . $text["cntry"] . "</td>" : "") . "\r\n                          <td align=\"center\">" . $text["player"] . "</td>\r\n                          <td align=\"center\">" . $text["mdscore"] . "</td></tr>\r\n        ";
        for ($i = 0; $i < 10; $i++) {
            if (@$Scores[$i] > 0) {
                echo "<tr class=\"innertable\">\r\n              <td width=\"50\" align=\"center\">" . ($i + 1) . "</td>\r\n              " . (file_exists($geoip_path . "GeoIP.dat") ? "<td width=\"50\" align=\"center\">" . $Country[$i] . "</td>" : "") . "\r\n              <td align=\"left\"><a href=\"{$link}?func=player&playerid=" . $PlayerListIds[$i] . "&config={$currentconfignumber}\" title=\"" . $text["seeplayerdetails"] . "\">" . htmlspecialchars(utf2iso($PlayerNames[$i])) . "</td></a>\r\n              <td align=\"center\">" . $Scores[$i] . "</td></tr>\r\n              <tr><td colspan=" . (file_exists($geoip_path . "GeoIP.dat") ? '4' : '3') . " class=\"outertable\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\" alt=\"\"></td></tr>\r\n             ";
            }
        }
        echo "</table></tr></td>\r\n          </table></td></tr>\r\n      </table></td></tr>\r\n      </table>\r\n      ";
    }
}
コード例 #6
0
function addClients($clients, $backgroundColor)
{
    global $geoip_path;
    global $public_ip;
    global $currentconfignumber;
    $link = baselink();
    $x = 1;
    foreach ($clients as $client) {
        echo '<tr bgcolor="#cccccf" valign="middle">
    <td style="background: ' . $backgroundColor . 'none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black;" align="center"><font class="fontNormal" size="2"><strong>' . $x . '</strong></font></td>';
        if ($client->levelInt == 0) {
            echo '<td style="background: ' . $backgroundColor . ' none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black;" align="center"><font class="fontNormal" size="2">' . htmlspecialchars(utf2iso($client->name)) . '</font></td>';
        } else {
            echo '<td style="background: ' . $backgroundColor . ' none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black;" align="center"><font class="fontNormal" size="2"><a href=' . $link . '?func=player&playerdbid=' . $client->dbid . '&config=' . $currentconfignumber . '><strong>' . htmlspecialchars(utf2iso($client->name)) . '</strong></a></font></td>';
        }
        echo '<td style="background: ' . $backgroundColor . ' none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black;" align="center"><font class="fontNormal" size="2">' . $client->score . '</font></td>';
        if (file_exists($geoip_path . "GeoIP.dat")) {
            if ($client->level == "BOT") {
                $tip = explode(":", $public_ip);
                $ip = $tip[0];
            } else {
                $ip = $client->ip;
            }
            $geocountry = $geoip_path . "GeoIP.dat";
            $gi = geoip_open($geocountry, GEOIP_STANDARD);
            $countryid = strtolower(geoip_country_code_by_addr($gi, $ip));
            $country = geoip_country_name_by_addr($gi, $ip);
            if (!is_null($countryid) and $countryid != "") {
                $flag = "<img src=\"images/flags/" . $countryid . ".gif\" title=\"" . $country . "\" alt=\"" . $country . "\">";
            } else {
                $flag = "<img width=\"16\" height=\"11\" src=\"images/spacer.gif\" title=\"" . $country . "\" alt=\"" . $country . "\">";
            }
            geoip_close($gi);
            echo '<td style="background: ' . $backgroundColor . ' none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black;" align="center"><font class="fontNormal" size="2">' . $flag . '</font></td>';
        }
        echo '<td style="background: ' . $backgroundColor . ' none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black;" align="center"><font class="fontNormal" size="2">' . $client->level . '</font></td>';
        echo '<td style="background: ' . $backgroundColor . ' none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black;" align="center"><font class="fontNormal" size="2">' . $client->connections . '</font></td>
    </tr>';
        $x++;
    }
}
コード例 #7
0
ファイル: functions.php プロジェクト: migumuno/Core
/**
 * Cambia un string de utf8 a sio
 * @param string $input
 */
function utf2iso($input)
{
    if (is_array($input)) {
        $array_temp = array();
        foreach ($input as $name => $value) {
            if (is_array($value)) {
                $array_temp[mb_detect_encoding($name . " ", 'UTF-8,UTF-8') == 'UTF-8' ? utf8_decode($name) : $name] = utf2iso($value);
            } else {
                $array_temp[mb_detect_encoding($name . " ", 'UTF-8,UTF-8') == 'UTF-8' ? utf8_decode($name) : $name] = mb_detect_encoding($value . " ", 'UTF-8,UTF-8') == 'UTF-8' ? utf8_decode($value) : $value;
            }
        }
        return $array_temp;
    } else {
        if (mb_detect_encoding($input . " ", 'UTF-8,UTF-8') == 'UTF-8') {
            return utf8_decode($input);
        } else {
            return $input;
        }
    }
}
コード例 #8
0
function do_search($name, $search_aliases = false)
{
    global $currentconfig;
    global $currentconfignumber;
    global $coddb;
    global $t;
    global $text;
    $count = 0;
    $link = baselink();
    $query = "SELECT {$t['b3_clients']}.name, {$t['players']}.id, {$t['players']}.fixed_name,\n              {$t['players']}.hide \n              FROM {$t['b3_clients']}, {$t['players']}\n              WHERE ({$t['b3_clients']}.id = {$t['players']}.client_id)\n              AND ( \n                      ({$t['b3_clients']}.name LIKE \"%{$name}%\")\n                  OR\n                      ({$t['players']}.fixed_name LIKE \"%{$name}%\")\n                  )\n              AND {$t['players']}.hide = 0";
    $result = $coddb->sql_query($query);
    opentablerow('100');
    echo "<td>" . $text["currentplnames"] . "<td></tr><tr>";
    while ($row = $coddb->sql_fetchrow($result)) {
        opentablecell('100');
        if ($row['fixed_name'] == "") {
            echo "<a href=\"{$link}?func=player&playerid={$row['id']}&config={$currentconfignumber}\">" . htmlspecialchars(utf2iso($row['name'])) . "</a><br/>";
            $count++;
        } else {
            if (stristr($row['fixed_name'], $name)) {
                echo "<a href=\"{$link}?func=player&playerid={$row['id']}&config={$currentconfignumber}\">" . htmlspecialchars(utf2iso($row['fixed_name'])) . "</a><br/>";
                $count++;
            }
        }
        closetablecell();
        echo "</tr><tr>";
    }
    closetablerow();
    if ($search_aliases == "true") {
        $query = "SELECT {$t['b3_aliases']}.alias, {$t['b3_clients']}.name, {$t['players']}.id\n        FROM {$t['b3_aliases']}, {$t['b3_clients']}, {$t['players']}\n        WHERE ({$t['b3_aliases']}.alias LIKE \"%{$name}%\")\n        AND {$t['b3_aliases']}.client_id = {$t['b3_clients']}.id\n        AND {$t['b3_clients']}.id = {$t['players']}.client_id\n        AND {$t['players']}.hide = 0\n        AND {$t['players']}.fixed_name = '' ";
        $result = $coddb->sql_query($query);
        if ($coddb->sql_numrows($result) > 0) {
            echo "Alias results:<br/>";
        }
        opentablerow('100');
        echo "<td>Search results (aliase -> current playername)<td></tr><tr>";
        while ($row = $coddb->sql_fetchrow($result)) {
            opentablecell('100');
            echo "{$row['alias']} -> <a href=\"{$link}?func=player&playerid={$row['id']}&config={$currentconfignumber}\">{$row['name']}</a><br/>";
            $count++;
            closetablecell();
            echo "</tr><tr>";
        }
        closetablerow();
    }
    return $count;
}
コード例 #9
0
}
require_once $currentconfig;
//echo $_SESSION['currentconfignumber'];
//include('../config/statsconfig.php');
$clients = array();
loadSimpleData();
$geocity = $geoip_path . "GeoLiteCity.dat";
$gi = geoip_open($geocity, GEOIP_STANDARD);
foreach ($clients as $client) {
    if ($client->level == "BOT") {
        $tip = explode(":", $public_ip);
        $ip = $tip[0];
    } else {
        $ip = $client->ip;
    }
    $playername = htmlspecialchars(utf2iso($client->name));
    $record = geoip_record_by_addr($gi, $ip);
    $latitude = $record->latitude;
    $longitude = $record->longitude;
    $cityname = utf8_decode($record->city);
    $region = utf8_decode($GEOIP_REGION_NAME[$record->country_code][$record->region]);
    $country = utf8_decode($record->country_name);
    //$results = file_get_contents("http://api.hostip.info/get_html.php?ip=$ip&position=true"); //catch errors later
    //parse response
    //preg_match('/Latitude: (.*)/', $results, $lat);
    //preg_match('/City: (.*)/', $results, $city);
    //preg_match('/Longitude: (.*)/', $results, $lon);
    //printf("<state id=\"point\"><loc>%s,%s</loc><name>%s</name><size>%s</size><opacity>%s</opacity></state>\n", $row[0], $row[1], utf8_encode($row[2]), round($diameter,2), round($calculated_opacity,2) );
    $diameter = 3;
    $opacity = 75;
    //printf("<state id=\"point\"><loc>%s,%s</loc><name>%s</name><hover>$playername , $ip</hover><size>%s</size><opacity>%s</opacity></state>\n", $lat[1], $lon[1], $city[1], $diameter, $opacity );