Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Prasau padekite del CS serverio zaideju info

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

Parašė Absinthe· 2012 Bir. 16 23:06:01
#2

Geriau surask kita panele , ju internete pilna , nes nemanau kad kas nors pades

Parašė Jomaajjaja· 2012 Bir. 17 12:06:08
#3

nu tai va tada sita, paprasta radau, reikia kad rodytu ir zaidejus prisijungusius


<?php
 
$pav ='#Cs.Aina.LT Public Serveris';
$ip ='77.241.199.216:27016';
 
$packet = "\xFF\xFF\xFF\xFFTSource Engine Query\x00";
 function getnextstring(&$data)
    {
       $temp="";
       $counter=0;
       while (ord($data[$counter++])!=0) $temp.=$data[$counter-1];
       $data=substr($data,strlen($temp)+1);
       return $temp;
   }
   function getnextbytevalue(&$data)
   {
     $temp=ord($data[0]);
     $data=substr($data,1);
     return $temp;
   }
 
        if(!$live_server = fsockopen("udp://77.241.199.216:27016"))
       {
        $output = "on";
      }
       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 = getnextstring($server_info);
         $servername = getnextstring($server_info);
         $map = getnextstring($server_info);
         $junk = getnextstring($server_info);
         $junk = getnextstring($server_info);
         $players = getnextbytevalue($server_info);
         $maxplayers = getnextbytevalue($server_info);
         }
         if ($players != "")
         {
          $players = $players;
         }
         else
         {
          $players = "0";
         }
         if ($maxplayers != "")
         {
          $maxplayers = $maxplayers;
         }
         else
         {
          $maxplayers = "0";
         }
         if ($players < $maxplayers)
         {
          $output = "<font color='green'>ON</font>";
         }
 
        else
        {
          $output = "Full";
        }
        if ($output != "Full" and $players != "0" or $maxplayers != "0")
        {
          $output = $output;
        }
        else
        {
          $output = "<font color='red'>OFF</font>";
        }
        if ($map != "")
         {
          $map = "$map";
         }
         else
         {
          $map = "nera";
         }
         echo "
 
<table class='mon' cellspacing='0' cellpadding='0' border='0'><tr>
<td rowspan='3' class='monitor_03' align='center'><img src='".THEME."images/maps/$map.png'/></td>
<td colspan='2' class='monitor_04' align='center'>$pav</td>
</tr><tr>
<td class='monitor_06' valign='top'>
ŽEMĖLAPIS: $map <br />
ADRESAS: $ip <br />
MODIFIKACIJA: surf <br />
ŽAIDĖJAI: $players / $maxplayers <br />
SERVERIO STATUSAS: $output <br />
</td>
<td class='monitor_07' align='center' valign='top'>
<img src='".THEME."images/left.png'/> PASLAUGOS <img src='".THEME."images/right.png'/>
<br />
VIP MENESIUI TIK <font color='#faa612'>1</font> LT <br />
ADMIN MENESIUI TIK <font color='#faa612'>2</font> LT <br />
SADMIN MENESIUI TIK <font color='#faa612'>3</font> LT <br />
UNBAN <font color='#faa612'>0.5</font> LT <br />
</td>
</tr><tr>
<td colspan='2' class='monitor_08'></td>
</tr></table>
";
      }
      ?> 

Redagavo Jomaajjaja· 2012 Bir. 17 12:06:45