Įsirašiau pinigų sistemą su tuo server listu. surašiau visus teisingai db duomenys, bet kaip įdedu servą vistiek jo nerodo sąrašę.
Index.php
Nežinau kame bėda.
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body bgimage="bg.jpg" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" text="#FFFFFF">
<center><img src=images/theme/head.gif></center>
<?php
$starttime = microtime();
$startarray = explode(" ", $starttime);
$starttime = $startarray[1] + $startarray[0];
?>
<?php
include "configas.php";
error_log(0);
function show_server($ip, $port, $big, $blod){
include "locale.php";
$maxlongname = 70;
$maxlongnamesmall = 40;
if($server = @fsockopen("udp://".$ip,$port,$errno,$errstr)){
$write = "\xFF\xFF\xFF\xFFTSource Engine Query\x00";
socket_set_timeout($server,1);
$time_in = microtime_float();
fwrite($server, $write);
$server_response = fread($server,4096);
$time_out = microtime_float();
if ($server_response) {
$server_ping = (int)(($time_out-$time_in)*1000);
$server_response = substr($server_response, 5);
$server_address = get_value_string($server_response);
$server_host_name = get_value_string($server_response);
$map = get_value_string($server_response);
$gamedir = get_value_string($server_response);
$gamename = get_value_string($server_response);
$count_players = get_value_byte($server_response);
$maxplayers = get_value_byte($server_response);
$netver = get_value_byte($server_response);
$dedicated = get_value_byte($server_response);
$os = get_value_byte($server_response);
$pass = get_value_byte($server_response);
$skip = get_value_byte($server_response);
$skip = get_value_string($server_response);
$skip = get_value_string($server_response);
$skip = get_value_string($server_response);
$skip = get_value_lint($server_response);
$skip = get_value_lint($server_response);
$skip = get_value_byte($server_response);
$skip = get_value_byte($server_response);
$secure = get_value_byte($server_response);
$bots = get_value_byte($server_response);
$players = "$count_players / $maxplayers";
if($big == 1){
if (file_exists("images/".$map.".jpg")){$map_image = "<img src='images/".$map.".jpg' class='img2'>";}else{$map_image = "<img src='images/nera.jpg' class='img2'>";}
echo "<br>\n";
echo "<table class='bgbigo' width='700' align='center'>\n<tr>\n<td>\n";
echo "<table width='100%' align='center' border='0'>\n";
echo "<tr>\n";
echo "<td rowspan='7' width='160'>\n";
echo $map_image."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo $locale[pavadinimas];
echo "</td>\n";
echo "<td>\n";
if (strlen($server_host_name) > $maxlongname){
$server_host_namesmall = substr($server_host_name, 0, $maxlongname - 3) . "...";
}else{
$server_host_namesmall = $server_host_name;
}
echo $server_host_namesmall."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td >";
echo $locale[adresas];
echo "</td>\n";
echo "<td>\n";
echo htmlspecialchars($ip).":".htmlspecialchars($port)."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo $locale[zaidejai];
echo "</td\n>";
echo "<td>\n";
echo htmlspecialchars($players)."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo $locale[zemelapis];
echo "</td>\n";
echo "<td >\n";
echo htmlspecialchars($map)."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo $locale[pingas];
echo "</td>\n";
echo "<td>\n";
echo htmlspecialchars($server_ping)."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo $locale[protokolas];
echo "</td>\n";
echo "<td>\n";
echo htmlspecialchars($netver)."\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</td>\n</tr>\n</table>\n<br>\n";
}
if($big == 0){
if (strlen($server_host_name) > $maxlongnamesmall){
$server_host_namesmall = substr($server_host_name, 0, $maxlongnamesmall - 3) . "...";
}else{
$server_host_namesmall = $server_host_name;
}
echo "<tr>\n";
echo "<td class='list_row1'>\n";
echo "<center><img src='images/theme/cstrike.gif'></center>\n";
echo "</td>\n";
echo "<td class='list_row1'>\n";
blodopen($blod);
echo htmlspecialchars($server_host_namesmall)."\n";
blodclose($blod);
echo "</td>";
echo "<td class='list_row1'>\n";
blodopen($blod);
echo htmlspecialchars($ip).":".htmlspecialchars($port)."\n";
blodclose($blod);
echo "</td>\n";
echo "<td class='list_row1'>\n";
blodopen($blod);
echo htmlspecialchars($map)."\n";
blodclose($blod);
echo "</td>\n";
echo "<td class='list_row1'>\n";
blodopen($blod);
echo "<center>".htmlspecialchars($players)."</center>\n";
blodclose($blod);
echo "</td>\n";
echo "<td class='list_row1'>\n";
blodopen($blod);
echo "<center>".htmlspecialchars($server_ping)."</center>\n";
blodclose($blod);
echo "</td>\n";
echo "<tr>\n";
}
}
}
}
function get_value_byte(&$data){
$temp = $data[0];
$data = substr($data, 1);
return ord($temp);
}
function get_value_string(&$data){
$temp = '';
$i = 0;
while (ord($data[$i]) != 0){
$temp .= $data[$i];
$i++;
}
$data = substr($data, $i+1);
return $temp;
}
function get_value_sint(&$data){
$temp = substr($data, 0, 2);
$data = substr($data, 2);
$array = @unpack('Sshort', $temp);
return $array['short'];
}
function get_value_lint(&$data){
$temp = substr($data, 0, 4);
$data = substr($data, 4);
$array = @unpack('Lint', $temp);
return $array['int'];
}
function get_value_float(&$data){
$temp = substr($data, 0, 4);
$data = substr($data, 4);
$array = @unpack('ffloat', $temp);
return $array['float'];
}
function microtime_float() {
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
function blodopen($blod){
if($blod == "1"){
echo "<font color='#CC0000'><b>";
}}
function blodclose($blod){
if($blod == "1"){
echo "</font></b>";
}}
//Gaunam serveriu duomenis is mysql ir bandom juos isvesti xD
function dbarray($query) {
$result = @mysql_fetch_assoc($query);
if (!$result) {
echo mysql_error();
return false;
} else {
return $result;
}
}
function dbcount($field,$table,$conditions="") {
$cond = ($conditions ? " WHERE ".$conditions : "");
$result = @mysql_query("SELECT Count".$field." FROM ".DB_PREFIX.$table.$cond);
if (!$result) {
echo mysql_error();
return false;
} else {
$rows = mysql_result($result, 0);
return $rows;
}
}
$db = mysql_connect($hostas, $useris, $passas) or die("<center><b>Laikinos serverio problemos 1</b></center>") or die("<center><b>Laikinos serverio problemos</b></center>");
mysql_select_db($dbas) or die("<center><b>Laikinos serverio problemos 2</b></center>");
$snddata = mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y"));
$goas = mysql_query("DELETE FROM ".$fusionoprefixas."money_servers WHERE `galiojaiki` < '".$snddata."'");
$serveriai1 = mysql_query("SELECT * FROM ".$fusionoprefixas."money_servers WHERE `tipas` = 1 and `galiojaiki` > ".$snddata." ORDER BY galiojaiki DESC");
if(!$serveriai1)
{
}else{
while($serverio1 = dbarray($serveriai1))
{
show_server($serverio1[serverip], $serverio1[serveroprt], "1", "0");
}
}
echo "<table cellpadding='3' cellspacing='0' class='list_table' width='700' align='center'>\n";
echo "<tr>\n<td class='list_row1'> </td>\n<td class='list_row1'><center>Hostname:</center></td>\n<td class='list_row1'><center>Ip:</center></td>\n<td class='list_row1'><center>Map:</center></td>\n<td class='list_row1'><center>Players:</center></td>\n<td class='list_row1'><center>Ping:</center></td>\n</tr>\n";
$serveriai = mysql_query("SELECT * FROM ".$fusionoprefixas."money_servers WHERE `tipas` = '0' and `galiojaiki` > ".$snddata." ORDER BY galiojaiki DESC") or die("<center><b>Laikinos serverio problemos</b</center>");
while($serverio = dbarray($serveriai))
{
show_server($serverio[serverip], $serverio[serveroprt], "0", "0");
}
mysql_close($db);
echo "</table>";
?>
<?php
$endtime = microtime();
$endarray = explode(" ", $endtime);
$endtime = $endarray[1] + $endarray[0];
$totaltime = $endtime - $starttime;
$totaltime = round($totaltime,0);
?>
</body>
</html>
|