<?php
//Адрес сайта со статистикой HLstatsX:CE
$url_site = "http://cssser.myarena.ru/stats/";
//Тип игры
$game_type = "css";
//Лимит Макс 20
$limit = "20";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title> Топ <?=$limit?> игроков!</title>
<style type="text/css">
.toptable {
margin-right: 15px;
margin-left: 15px;
margin-bottom: 15px;
color: #5d5d5c;
}
.toptable th, .toptable td {
padding:10px 2px 10px 2px;
border-top: 1px solid grey;
border-left: 1px solid grey;
}
.toptable table {
width: 100%;
border-right: 1px solid grey;
border-bottom: 1px solid grey;
}
.toptxt {
margin-top: 20px;
margin-bottom: 20px;
text-align: center;
font-size: 20px;
color: #488fd2;
font-weight: bold;
}
</style>
</head>
<body>
<div class=toptxt>
Рейтинг сервера Positivniy css-server #1
<p>
46.174.48.27:27248
</div>
<div class=toptable>
<table>
<thead style="color: #007AB0; font-weight: bold;">
<tr>
<th>Место</th>
<th>Ник</th>
<th>Очки</th>
<th>Время в игре</th>
<th>Убийств</th>
<th>Смертей</th>
<th>У/С</th>
<th>Хедшот</th>
<th>Х/У</th>
<th>Меткость</th>
</tr>
</thead>
<tbody>
<?php
if($url_site && $game_type && $limit<=20){
$url = $url_site."ingame.php?mode=players&game=".$game_type;
$grab = str_replace(array("\n","\r","\t"," "),"",file_get_contents($url));
preg_match_all("#<tr>(.*?)</tr>#i",$grab,$html);
for ($i = 0; $i <= ($limit-1); $i++) {
$data = strip_tags($html[0][$i],"<td><a>");
$data = preg_replace("#<td.*?>#","<td>",$data);
preg_match_all("#<td>(.*?)</td>#si",$data,$htmlc);
preg_match_all("#<a.*>(.*?)</a>#i",$htmlc[1][1],$nik);
preg_match_all("#(player=\d{0,9999})#i",$htmlc[1][1],$profile);
$hlx = array(
"rank"=>$htmlc[1][0],
"name"=>$nik[1][0],
"profile"=>$url_site."hlstats.php?mode=playerinfo&".$profile[1][0],
"points"=>$htmlc[1][2],
"playtime"=>$htmlc[1][4],
"kills"=>$htmlc[1][5],
"deaths"=>$htmlc[1][6],
"kd"=>$htmlc[1][7],
"headshoots"=>$htmlc[1][8],
"hsk"=>$htmlc[1][9],
"accuracy"=>$htmlc[1][10],
);
?>
<tr align=center>
<td><?=$hlx['rank']?></td>
<td><a style="font-weight: bold; color:#5d5d5c" target="_blank" href="<?=$hlx['profile']?>"><?=$hlx['name']?></a></td>
<td><?=$hlx['points']?></td>
<td><?=$hlx['playtime']?></td>
<td><?=$hlx['kills']?></td>
<td><?=$hlx['deaths']?></td>
<td><?=$hlx['kd']?></td>
<td><?=$hlx['headshoots']?></td>
<td><?=$hlx['hsk']?></td>
<td><?=$hlx['accuracy']?></td>
</tr>
<?php
}
} else {
die('Не все данные указанны!');
}
?>
<tr>
<td colspan="10" align=center>
<a style="font-size: 20px; color: #007AB0; font-weight: bold;" href="<?=$url_site?>hlstats.php?mode=players&game=css">Посмотреть еще</a>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>