Код
<?php
/*
Copyright © LightMon
URL: http://www.lightmon.ru
E-mail: support@lightmon.ru
*/
define ( 'LM', true );
# Защита от SQL иньекции и XSS
$_GET['n'] = intval($_GET['n']);
$n = $_GET['n'];
$do = $_GET['do'];
include 'engine/config/mysql.config.php';
include 'engine/classes/mysql.class.php';
include 'engine/function/filter.php';
class main
{
function __construct()
{
$this->db=new DB();
}
}
$main=new main();
$my=$main->db->query('SELECT * FROM `lm_list` where id=\''.$n.'\'');
$row_my=$main->db->fetch($my);
include 'engine/function/protocol.php';
$server=query_cached('', '', '', 'sepc', $row_my['id']);
$server=server_html($server);
$golos=($row_my['golos'] > 9998) ? 'V.I.P' : $row_my['golos'];
$server['s']['map']=(empty($server['s']['map'])) ? '-' : $server['s']['map'];
$server['s']['name']=(empty($server['s']['name'])) ? '-' : $server['s']['name'];
if($do == 'ubar')
{
$image = 'images/'.(!isset($_GET['col']) ? 'grey' : $_GET['col']).'_ubar.gif';
$icon = 'images/icons/'.$row_my['type'].'.png';
Header('Content-type: image/gif');
$im = imagecreatefromgif($image);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
$red = ImageColorAllocate($im, 255,0,0);
$bl = ImageColorAllocate($im, 250,250,0);
ImageString($im, 1, 25, 2, name_filtered(html2text($server['s']['name'])), $white);
ImageString($im, 1, 25, 10, $row_my['ip'].':'.$row_my['q_port'], $bl);
ImageString($im, 1, 150, 10, $server['s']['players'].'/'.$server['s']['playersmax'], $bl);
ImageString($im, 1, 190, 10, $server['s']['map'], $bl);
Imagegif($im);
ImageDestroy($im);
}
if($do == 'bg')
{
$image = 'images/banners/hb/'.((!file_exists('images/banners/hb/'.$row_my['type'].'.jpg')) ? 'cs' : $row_my['type']).'.jpg';
Header('Content-type: image/jpeg');
$im = imagecreatefromjpeg($image);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
$red = ImageColorAllocate($im, 255,0,0);
$bl = ImageColorAllocate($im, 250,250,0);
$silver= ImageColorAllocate($im, 192,192,192);
$country = ($row_my['country']!='') ? $row_my['country'] : 'Unknown';
ImageString($im, 2, 145, 17, name_filtered(html2text($server['s']['name'])), $silver);
ImageString($im, 2, 145, 46, $row_my['ip'].':'.$row_my['q_port'], $silver);
ImageString($im, 2, 145, 75, $server['s']['map'], $silver);
ImageString($im, 3, 275, 46, $country, $silver);
ImageString($im, 3, 275, 75, $server['s']['players'].'/'.$server['s']['playersmax'], $silver);
Imagejpeg($im);
ImageDestroy($im);
}
if($do == 'bf') {
$flags = (file_exists('images/flags/'.$row_my['country'].'.png')) ? $row_my['country'] : 'RU';
header ('Content-type: image/jpeg');
$im = imagecreatefromjpeg('images/mstats.jpg');
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
$red = ImageColorAllocate($im, 255,0,0);
$bl = ImageColorAllocate($im, 250,250,0);
$orange= ImageColorAllocate($im, 255,136,0);
$server_full=($server['b']['status']) ? floor(($server['s']['players'] / $server['s']['playersmax']) * 100) : 0;
imagestring($im, 2, 38, 20, $row_my['ip'].':'.$row_my['q_port'], $white);
imagestring($im, 2, 38, 50, name_filtered(html2text($server['s']['name'])), $white);
imagestring($im, 2, 38, 145, $server['s']['map'], $white);
imagestring($im, 2, 38, 80, $flags, $white);
imagestring($im, 2, 78, 80, cache_rang($row_my['id']), $white);
imagestring($im, 2, 38, 111, $server['s']['players'].'/'.$server['s']['playersmax'], $white);
imagestring($im, 2, 100, 111, '(L/A '.$server_full. '%)', $white);
imagejpeg($im);
ImageDestroy($im);
}
if($do == 'block')
{
$image=($game=='css') ? 'images/maps/'.$server['s']['map'].'_css.jpg' : 'images/maps/'.$server['s']['map'].'.jpg';
if (!file_exists($image)) $image = 'images/maps/nopicture.jpg';
$site = 'http://'.$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']),'/\\').'/';
$server_full = ($row_my['status']) ? floor(($server['s']['players'] / $server['s']['playersmax']) * 100) : 0;
$flags = (file_exists('images/flags/'.$row_my['country'].'.png')) ? $row_my['country'] : 'RU';
$players = ($row_my['status']) ? $server['s']['players'].'/'.$server['s']['playersmax'] : 'Нет информации';
echo <<<HTML
<html>
<head>
<Style>
A:Link{ Color: #323232; Text-decoration: none}
A:Visited{ Color: #323232; Text-decoration: none}
A:Hover{ Color: #323232; Text-decoration: underline}
td, body {font-family: tahoma, verbana, arial, helvetica; font-size:11px;}
</Style>
</head>
<body>
<table border="0" width="230" bgcolor="#{$_GET['border']}" cellspacing="1" cellpadding="2">
<tr>
<td bgcolor="#{$_GET['bg']}">
<table border="0" width="100%" style="margin-top: 0; margin-bottom: 0">
<tr>
<td style="font-family: tahoma, verbana, arial, helvetica; font-size: 11px" width="216" colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0" style="margin-top: 0; margin-bottom: 3">
<tr>
<td width="19"><img border="0" src="images/icons/{$row_my['type']}.png"></td>
<td><font face="Arial" style="color: #FFFFFF; font-size: 11px; text-decoration: none; font-weight:700">{$games}</font></td>
<td width="19"><img border="0" src="images/flags/{$flags}.png" height="12" width="16" alt="{$flags}" title="{$flags}"></td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<table border="0" width="225" cellspacing="1" cellpadding="3" bgcolor="#{$_GET['border']}" height="36">
<tr>
<td bgcolor="#{$_GET['in']}" valign="top">
<p style="margin-top: 0; margin-bottom: 0">
<font color="#{$_GET['border']}"><b>
<font color="7c3e00">
<a target="_blank" href="{$site}{$n}-view.html">
<font color="#{$_GET['text']}" style="font-size: 11px" face="Arial">
<u>{$server['s']['name']}</u></font></a></font></b></font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
HTML;
if($_GET['map'])
{
echo <<<HTML
<tr>
<td style="font-family: tahoma, verbana, arial, helvetica; font-size: 11px" width="216" colspan="2">
<p align="center" style="margin-top: 0; margin-bottom: 0">
<a target="_blank" href="{$site}{$n}-view.html"><img border="0" src="{$image}" width=216 style="border: 1px solid #323232"></a></td>
</tr>
HTML;
}
echo <<<HTML
<tr>
<td style="font-family: tahoma, verbana, arial, helvetica; font-size: 11px" colspan="2">
<table border="0" width="100%" id="table2" cellspacing="0" cellpadding="0">
<tr>
<td><font face="Arial" style="font-size: 10px; font-weight: 700" color="#FFFFFF">IP: </font></td>
<td><p align="right"><font face="Arial" style="font-size: 10px; font-weight: 700" color="#{$_GET['text']}">{$row_my['ip']}:{$row_my['q_port']}</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="font-family: tahoma, verbana, arial, helvetica; font-size: 11px" colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><font face="Arial" style="font-size: 10px; font-weight: 700" color="#FFFFFF">Карта: </font></td>
<td><p align="right"><font face="Arial" style="font-size: 10px; font-weight: 700" color="#FFFFFF">{$server['s']['map']}</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="font-family: tahoma, verbana, arial, helvetica; font-size: 11px">
<p style="margin-top: 0; margin-bottom: 0"><font face="Arial" style="font-size: 10px; font-weight: 700" color="#FFFFFF">Игроки:</font></td><td style="font-family: tahoma, verbana, arial, helvetica; font-size: 11px">
<p align="right" style="margin-top: 0; margin-bottom: 0">
<font face="tahoma, verbana, arial, helvetica;" style="font-size: 10px; " color="#FFFFFF">
{$players}</font></td>
</tr>
</table>
<div align="center">
<table border="0" width="97%" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" height="18">
<div style="padding: 0px; border: 1px solid #{$_GET['border']}; background-color: #{$_GET['in']}; height: 4px; font-size: 0;">
<div style="width: {$server_full}%; background-color: #{$_GET['text']}; height: 4px;"></div>
</div></td>
</tr>
</table></div>
HTML;
if($_GET['users'])
{
$i=1;
echo <<<HTML
<div style="height:100px; width:221px; margin:2px; padding:2px; border:solid; border-color=#{$_GET['border']}; background=#{$_GET['in']}; border-width:1px; overflow:auto;">
<table width="100%">
HTML;
if(empty($server['p']) || !is_array($server['p'])) { return; }
foreach ($server['p'] as $player_key => $player)
{
echo "<tr><td><font color=\"#FFFFFF\" style=\"font-size: 9px; font-weight:700\" face=\"Arial\">".$i."</font></td>";
echo "<td style=\"font-family: tahoma, verbana, arial, helvetica\">
<font color=\"#FFFFFF\" style=\"font-size: 10px\">".$player['name']."</font></td>";
echo "<td style=\"text-align: right; font-family:tahoma, verbana, arial, helvetica; font-size:11px\">
<font color=\"#FFFFFF\" style=\"font-size: 10px; font-weight:700\" face=\"Arial\">".$player['score']."</font></td>";
echo "</tr>\r\n";
$i++;
}
echo "</table></div>";
}
echo <<<HTML
<p align="right" style="margin-top: 0; margin-bottom: 0">
<font face="Arial"><span style="font-size: 10px" lang="en-us">
<a target="_blank" href="{$site}"><font color="#FFFFFF">мониторинг игровых серверов</font></a></span></font></div>
</td>
</tr>
</table>
</body>
</html>
HTML;
}
if($do == 'webml') {
$site = 'http://'.$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER[PHP_SELF]),'/\\').'/';
echo <<< HTML
<script type="text/javascript" src="engine/jQuery/webml/icolorpicker.js"></script>
<center>
<form action="" onsubmit="return false;">
<table style="font-family:Tahoma;font-size: 9pt;color: #979797;">
<tr>
<td>Общий фон</td>
<td><input type="text" value="#4E4E4E" class="iColorPicker" name="bgColor" id="bgColor" /></td>
</tr>
<tr>
<td>Бордюр</td>
<td><input type="text" value="#000000" class="iColorPicker" name="borderColor" id="borderColor" /></td>
</tr>
<tr>
<td>Фон таблиц</td>
<td><input type="text" value="#323232" class="iColorPicker" name="inColor" id="inColor" /></td>
</tr>
<tr>
<td>Текст заголовка</td>
<td><input type="text" value="#b9b9b9" class="iColorPicker" name="textColor" id="textColor" /></td>
</tr>
<tr>
<td>Ширина</td>
<td><input type="text" value="245" name="width" id="width" class="banner_params" /></td>
</tr>
<tr>
<td height="25px;">Изображение карты</td>
<td><input type="checkbox" name="map" id="map" value="1" class="show"></td>
</tr>
<tr>
<td height="25px;">Игроки</td>
<td><input type="checkbox" name="users" id="users" value="1" class="show"></td>
</tr>
<input type="hidden" name="id" id="id" value="{$_GET['n']}" />
<input type="hidden" name="site" id="site" value="{$site}" />
</table>
<noscript>
<input type="submit" value="Обновить">
</noscript>
</form>
<div id="frame"><iframe src="{$site}all.php?n={$_GET['n']}&do=block&bg=4E4E4E&border=000000&in=323232&text=b9b9b9&map=0&users=0" frameborder="0" width="245" height="164" scrolling="no"></iframe></div>
<div id="code"><textarea rows="4" cols="40" onfocus="java script:this.select()" readonly="readonly"><iframe src="{$site}all.php?n={$_GET['n']}&do=block&bg=4E4E4E&border=000000&in=323232&text=b9b9b9&map=0&users=0" frameborder="0" width="245" height="164" scrolling="no"></iframe></textarea></div>
</center>
<script type="text/javascript" src="engine/jQuery/webml/webml.js"></script>
HTML;
}
?>