Parašė Jomaajjaja· 2012 Bir. 16 19:06:10
#1
Sveiki, gal kas galite padeti, ar imanoma padaryti kaip nors zaideju info siai panelei kad rodytu kokie zaidejai prisijunge serveryje?
if (!defined("IN_FUSION"))
{
die("Access Denied");
}
if (file_exists(INFUSIONS."css_server_panel/locale/".$settings['locale'].".php"))
{
include INFUSIONS."css_server_panel/locale/".$settings['locale'].".php";
}
else
{
include INFUSIONS."css_server_panel/locale/Lithuanian.php";
}
$map;
$players;
$servername;
$maxplayers;
$bots;
$success;
$serveroutput = create_table();
opentable("Mūsų serveriai");
echo "<table width='100%' cellpadding='1' cellspacing='1' class='tbl-border'>
<tr>
<td class='tbl2'></td>
<td class='tbl2' align='center'>Serverio Pavadinimas</td>
<td class='tbl2' align='center'>IP Adresas</td>
<td class='tbl2' align='center'>Žemėlapis</td>
<td class='tbl2' align='center'>Žaidėjai</td>
<td class='tbl2' width='5%'>Statusas</td>
</tr>
$serveroutput
</table>";
closetable();
//Funkcijos
function create_table()
{
global $players;
global $map;
global $servername;
global $maxplayers;
global $bots;
global $success;
global $db_prefix;
$list = "";
$result = dbquery("SELECT * FROM ".$db_prefix."css_polk_servers ORDER BY css_polk_server_order ASC");
$rows = dbrows($result);
if ($rows != 0)
{
while($data = dbarray($result))
{
foreach($data as $key=>$value)
{
$$key = $value;
}
$server_status = query_server($css_polk_server_type,$css_polk_server_address,$css_polk_server_port);
if ($success == 1)
{
$players = $players." / ".$maxplayers." ";
}
if ($map == "")
{
$mapaz = "<img style='margin-right: 5px; border: 1px solid #fff;' src='http://image.www.gametracker.com/images/maps/160x120/nomap.jpg' align='left' alt='Nera'/>";
}
else
{
$mapaz = "<img style='margin-right: 5px; border: 1px solid #fff;' src='http://image.www.gametracker.com/images/maps/160x120/cs/".$map.".jpg' align='left' alt='".$map."'/>";
}
if ($map == "")
{
$*aš* = "Serveris Neatsako";
$playersoff = "0 / 0";
}
else
{
$*aš* = "$map";
$playersoff = $players;
}
$list .= "
<tr><td align='center' class='tbl1' width='10'>
<img src='".INFUSIONS."css_server_panel/".$css_polk_server_image."' alt='*' />
</td>
<td align='center' class='tbl1'>".$css_polk_server_Name."</td>
<td align='center' class='tbl1'>".$css_polk_server_address.":".$css_polk_server_port."</td>
<td align='center' class='tbl1'>".$*aš*."</td>
<td align='center' class='tbl1'>".$playersoff."</td>
<td align='center' class='tbl1'>$server_status</td></tr>
";
}
}
else
{
$list = "<tr><td align='center' valign='middle' colspan='7'>Serverių nėra</td></tr>";
}
return $list;
}
function query_server($type,$ip,$port)
{
global $players;
global $map;
global $servername;
global $maxplayers;
global $bots;
global $success;
$success = 0;
$map = "";
$players = "";
$servername = "";
$maxplayers = "";
$bots = "";
if ($type == "Counter Strike Source") // Source - Nustatymai
{
$packet = "\xFF\xFF\xFF\xFFTSource Engine Query\x00";
if(!$live_server = fsockopen("udp://".$ip,$port))
{
$output = "<img src='infusions/css_server_panel/images/red.png' title='Offline' alt='Isjungta' />";
}
else
{
fwrite($live_server, $packet);
socket_set_timeout($live_server,1,0);
$junk = fread($live_server,5);
$status = socket_get_status($live_server);
$do = 1;
$server_info= "";
while($do)
{
$str_1 = fread($live_server,1);
$server_info .= $str_1;
$status = socket_get_status($live_server);
if($status["unread_bytes"] == 0) {$do = 0;}
}
fclose($live_server);
if (strlen($server_info) > 0)
{
$success = 1;
$servername = getnextstring2($server_info);
$map = getnextstring2($server_info);
$junk = getnextstring2($server_info);
$junk = getnextstring2($server_info);
$junk = getnextbytevalue2($server_info);
$junk = getnextbytevalue2($server_info);
$players = getnextbytevalue2($server_info);
$maxplayers = getnextbytevalue2($server_info);
$bots = getnextbytevalue2($server_info);
if ($players < $maxplayers)
{
$output = "<img src='infusions/css_server_panel/images/green.png' title='Online' alt='Ijungta' />";
}
else
{
$output = "<img src='infusions/css_server_panel/images/yellow.png' title='Keiciasi' alt='Keiciasi' />";
}
}
else
{
$output = "<img src='infusions/css_server_panel/images/red.png' title='Offline' alt='Isjungta' />";
}
}
}
elseif ($type == "TeamSpeak")// Teamspeak - Nustatymai
{
if (!$fp = @fsockopen($ip,$port))
{
$output = "<img src='infusions/css_server_panel/images/red.png' title='Offline' alt='Isjungta' />";
}
else
{
socket_set_timeout($fp,1,0);
$data = fread($fp,4);
fputs($fp, "quit");
fclose($fp);
if ($data == "[TS]")
{
$output = "<img src='infusions/css_server_panel/images/green.png' title='Online' alt='Ijungta' />" ;
}
else
{
$output = "<img src='infusions/css_server_panel/images/yellow.png' title='Keiciasi' alt='Keiciasi' />";
}
}
}
elseif ($type == "CounterStrike 1.6") // 1.6 - Nustatymai
{
$packet = "\xFF\xFF\xFF\xFFTSource Engine Query\x00";
if(!$live_server = fsockopen("udp://".$ip,$port))
{
$output = "<img src='infusions/css_server_panel/images/red.png' title='Offline' alt='Isjungta' />";
}
else
{
fwrite($live_server, $packet);
socket_set_timeout($live_server,1,0);
$junk = fread($live_server,5);
$status = socket_get_status($live_server);
$do = 1;
$server_info= "";
while($do)
{
$str_1 = fread($live_server,1);
$server_info .= $str_1;
$status = socket_get_status($live_server);
if($status["unread_bytes"] == 0) {$do = 0;}
}
fclose($live_server);
if (strlen($server_info) > 0)
{
$success = 1;
$junk = getnextstring2($server_info);
$servername = getnextstring2($server_info);
$map = getnextstring2($server_info);
$junk = getnextstring2($server_info);
$junk = getnextstring2($server_info);
$players = getnextbytevalue2($server_info);
$maxplayers = getnextbytevalue2($server_info);
if ($players < $maxplayers)
{
$output = "<img src='infusions/css_server_panel/images/green.png' title='Online' alt='Ijungta' />";
}
else
{
$output = "<img src='infusions/css_server_panel/images/yellow.png' title='Keiciasi' alt='Keiciasi' />";
}
}
else
{
$output = "<img src='infusions/css_server_panel/images/red.png' title='Offline' alt='Isjungta' />";
}
}
}
elseif ($type == "GTA:SAMP") // GTA:SAMP - by Minimukas
{
$fp = fsockopen('udp://' . $ip, $port, $errno, $errstr);
if (!$fp)
{
$output = "<img src='".BASEDIR."infusions/status_server_panel/images/offline.png' title='Offline' alt='Offline' />";
}
else
{
$packet = 'SAMP';
$packet .= chr(strtok($ip, '.'));
$packet .= chr(strtok('.'));
$packet .= chr(strtok('.'));
$packet .= chr(strtok('.'));
$packet .= chr($port & 0xFF);
$packet .= chr($port >> 8 & 0xFF);
fwrite($fp, $packet.'i');
fread($fp, 11);
$is_passworded = ord(fread($fp, 1));
$players = ord(fread($fp, 2));
$maxplayers = ord(fread($fp, 2));
$strlen = ord(fread($fp, 4));
$servername = fread($fp, $strlen);
$strlen = ord(fread($fp, 4));
$gamemode = fread($fp, $strlen);
$strlen = ord(fread($fp, 4));
$map = fread($fp, $strlen);
if ($players < $maxplayers)
{
$output = "<img src='".BASEDIR."infusions/status_server_panel/images/online.png' title='Online' alt='Online' />";
}
else
{
$output = "<img src='".BASEDIR."infusions/status_server_panel/images/full.png' title='Nepasiekiama' alt='Keiciasi' />";
}
}
}
return $output;
}
function getnextstring2(&$data)
{
$temp="";
$counter=0;
while (ord($data[$counter++])!=0) $temp.=$data[$counter-1];
$data=substr($data,strlen($temp)+1);
return $temp;
exit();
}
function getnextbytevalue2(&$data)
{
$temp=ord($data[0]);
$data=substr($data,1);
return $temp;
}
p.s. info gali buti betkur, susitwarkysiu po to, tereikia kodo kad rodytu ir zaidejus kurie prisijunge