Ето и файловете.
generator.php
Код за потвърждение: Избери целия код
<?php
//Config file
$host = "localhost"; //IP-то към mysql сървъра ви
$user = "user"; //Потребителят за базата ви данни
$pass = "pass"; //Паролата на портебителя
$database = "db"; //Базата данни за потребителя
//Следващите два реда не се пипат
$connect = mysql_connect($host, $user, $pass) or die("<b>FATAL ERROR:</b> <i>Could not connect to the mysql server.</i>");
mysql_select_db($database, $connect) or die("<b>FATAL ERROR:</b> <i>Could not connect to the mysql database.</i>");
?>
<center><?php
$random_number = rand(1, 5);
$random_banner[1] = 'Колко е 18-9';
$random_banner[2] = 'Колко е 5+4';
$random_banner[3] = 'Колко е 8+1';
$random_banner[4] = 'Колко е 2+7';
$random_banner[5] = 'Колко е 15-6';
function validateIpAddress($ip_addr) {
if(preg_match("/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}/",$ip_addr))
{
return true;
}
else {
return false;
}
}
?>
<fieldset><legend>Статистиката съдържа само играта:Counter-Strike 1.6</legend><form action="" method="post"><label for="input-two" class="float"><strong>IP Адрес:</strong></label><br />
<input class="inp-text" name="ip" id="input-two" type="text" size="30" />
<br /><label for="input-two" class="float"><strong><?PHP echo $random_banner[$random_number]; ?></strong></label><br />
<input class="inp-text" name="code" id="input-two" type="text" size="30" />
</fieldset>
<p><input class="buttona" type="submit" alt="SUBMIT" name="napravi" value="Създай" /></p>
<br/>
<?php
if(isset($_POST['napravi']))
{
$ip = addslashes(trim($_POST['ip']));
$code = trim($_POST['code']);
if($ip == NULL || $code == NULL)
{
echo "<fieldset>
<legend>Грешка</legend>Моля, попълнете всички полета!</fieldset>";
}else{
if(validateIpAddress($ip))
{
if($code != 9) {
echo "<fieldset>
<legend>Грешка</legend>Кодът е грешен!</fieldset>
";
}else{
$check = mysql_query("SELECT * FROM server_gen WHERE ip = '$ip'");
if($num = mysql_num_rows($check)){
echo "<fieldset>
<legend>Грешка
</legend>Този IP адрес вече е бил използван.</fieldset><br /><br />
";
echo '<fieldset>
<legend>Демо на картинката
</legend><img src="http://arenaplay.pro/stats.php?ip='.$ip.'"></fieldset>
<h3><fieldset>
<legend>Кодове за вграждане</legend><div class="code_box"><label for="codebb">BBCode (за форуми):</label> <input id="codebb" value="[url=http://arenaplay.pro][IMG]http://arenaplay.pro/stats.php?ip='.$ip.'[/IMG][/url]" onclick="javascript:this.focus();this.select();" readonly="false" class="text_input long" type="text"></div>
<div class="code_box"><label for="codebb">HTML (за сайтове):</label> <input id="codebb" value="<img src=http://arenaplay.pro/stats.php?ip='.$ip.'>" onclick="javascript:this.focus();this.select();" readonly="false" class="text_input long" type="text"></div>
</h3>
</fieldset>
<br /><br /><div style="border-bottom: 1px dashed #ccc; width: auto;padding-bottom: 5px;padding-top: 5px;"></div><br /><br />
<fieldset>
<legend>Демо на картинката
</legend><img src="http://arenaplay.pro/small-stats.php?ip='.$ip.'"></fieldset>
<h3><fieldset>
<legend>Кодове за вграждане</legend><div class="code_box"><label for="codebb">BBCode (за форуми):</label> <input id="codebb" value="[url=http://arenaplay.pro][IMG]http://arenaplay.pro/small-stats.php?ip='.$ip.'[/IMG][/url]" onclick="javascript:this.focus();this.select();" readonly="false" class="text_input long" type="text"></div>
<div class="code_box"><label for="codebb">HTML (за сайтове):</label> <input id="codebb" value="<img src=http://arenaplay.pro/small-stats.php?ip='.$ip.'>" onclick="javascript:this.focus();this.select();" readonly="false" class="text_input long" type="text"></div>
</h3>
</fieldset>';
} else {
$sql = mysql_query("INSERT INTO server_gen (ip) VALUES ('$ip')");
echo '<fieldset>
<legend>Демо на картинката
</legend><img src="http://arenaplay.pro/stats.php?ip='.$ip.'"></fieldset>
<h3><fieldset>
<legend>Кодове за вграждане</legend><div class="code_box"><label for="codebb">BBCode (за форуми):</label> <input id="codebb" value="[url=http://arenaplay.pro][IMG]http://arenaplay.pro/stats.php?ip='.$ip.'[/IMG][/url]" onclick="javascript:this.focus();this.select();" readonly="false" class="text_input long" type="text"></div>
<div class="code_box"><label for="codebb">HTML (за сайтове):</label> <input id="codebb" value="<img src=http://arenaplay.pro/stats.php?ip='.$ip.'>" onclick="javascript:this.focus();this.select();" readonly="false" class="text_input long" type="text"></div>
</h3>
</fieldset>
<br /><br /><div style="border-bottom: 1px dashed #ccc; width: auto;padding-bottom: 5px;padding-top: 5px;"></div><br /><br />
<fieldset>
<legend>Демо на картинката
</legend><img src="http://arenaplay.pro/small-stats.php?ip='.$ip.'"></fieldset>
<h3><fieldset>
<legend>Кодове за вграждане</legend><div class="code_box"><label for="codebb">BBCode (за форуми):</label> <input id="codebb" value="[url=http://arenaplay.pro][IMG]http://arenaplay.pro/small-stats.php?ip='.$ip.'[/IMG][/url]" onclick="javascript:this.focus();this.select();" readonly="false" class="text_input long" type="text"></div>
<div class="code_box"><label for="codebb">HTML (за сайтове):</label> <input id="codebb" value="<img src=http://arenaplay.pro/small-stats.php?ip='.$ip.'>" onclick="javascript:this.focus();this.select();" readonly="false" class="text_input long" type="text"></div>
</h3>
</fieldset><br /><br /><br />';
}
}
}else{
echo "<fieldset>
<legend>Грешка
</legend>Въведете реален IP адрес и порт.</fieldset>";
}
}
}
?></center>
small-stats.php
Код за потвърждение: Избери целия код
<?php
header("Content-type: image/png; charset=UTF-8");
include "include/server_status.php";
function validateIpAddress($ip_addr) {
if(preg_match("/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}/",$ip_addr))
{
return true;
}
else {
return false;
}
}
$ip = $_GET['ip'];
if(validateIpAddress($ip))
{
$ip_port = $ip;
$exp = explode(":", $ip_port);
$s = new GetInfo($exp[0],$exp[1]);
$image = imagecreatefrompng('images/status-on2.png');
$black = imagecolorallocate($image, 0, 0, 0);
$red = imagecolorallocate($image, 205, 51, 51);
$green = imagecolorallocate($image, 0, 201, 87);
$white = imagecolorallocate($image, 255, 255, 255);
$fontsize = 2;
if($s->getStatus())
{
$s->getServerData();
$name = $s->serverInfo['hostname'];
$tochka = "...";
if(strlen($name)<30) {
$var = TRUE;
} else {
$name=substr($name,0 , 30);
$name = $name.$tochka;
}
$players = $s->serverInfo['players'];
$maxplayers = $s->serverInfo['maxplayers'];
$map = $s->serverInfo['map'];
}
else
{
$name = "n/a";
$players = "n";
$maxplayers = "a";
$map = "n / a";
$image = imagecreatefrompng('images/status-off2.png');
}
imagestring($image, $fontsize, 46, 4, "" . $name, $white);
imagestring($image, $fontsize, 328, 4, "" . $players ." / ".$maxplayers, $white);
imagestring($image, $fontsize, 277, 21, " " . $ip_port, $white);
imagestring($image, $fontsize, 32, 20, " " . $map, $white);
imagepng($image);
imagedestroy($image);
}else{
echo "Невалиден IP Адрес и порт!";
}
?>
stats.php
Код за потвърждение: Избери целия код
<?php
header("Content-type: image/png; charset=UTF-8");
include "include/server_status.php";
function validateIpAddress($ip_addr) {
if(preg_match("/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}/",$ip_addr))
{
return true;
}
else {
return false;
}
}
$ip = $_GET['ip'];
if(validateIpAddress($ip))
{
$ip_port = $ip;
$exp = explode(":", $ip_port);
$s = new GetInfo($exp[0],$exp[1]);
$image = imagecreatefrompng('images/status-on.png');
$black = imagecolorallocate($image, 0, 0, 0);
$red = imagecolorallocate($image, 205, 51, 51);
$green = imagecolorallocate($image, 0, 201, 87);
$white = imagecolorallocate($image, 255, 255, 255);
$fontsize = 3;
if($s->getStatus())
{
$s->getServerData();
$name = $s->serverInfo['hostname'];
$tochka = "...";
if(strlen($name)<29) {
$var = TRUE;
} else {
$name=substr($name,0 , 29);
$name = $name.$tochka;
}
$players = $s->serverInfo['players'];
$maxplayers = $s->serverInfo['maxplayers'];
$map = $s->serverInfo['map'];
}
else
{
$name = "n/a";
$players = "n";
$maxplayers = "a";
$map = "n / a";
$image = imagecreatefrompng('images/status-off.png');
}
imagestring($image, $fontsize, 60, 20, "" . $name, $white);
imagestring($image, $fontsize, 182, 85, "" . $players ." / ".$maxplayers, $white);
imagestring($image, $fontsize, 260, 85, " " . $ip_port, $white);
imagestring($image, $fontsize, 5, 85, " " . $map, $white);
imagepng($image);
imagedestroy($image);
}else{
echo "Невалиден IP Адрес и порт!";
}
?>
server_status.php
Код за потвърждение: Избери целия код
<?php
class GetInfo{
public function GetInfo($ip,$port)
{
$this->ip = $ip;
$this->port = $port;
$this->fp = fsockopen('udp://'.$ip, $port);
}
public function getServerData()
{
fwrite($this->fp, "\xFF\xFF\xFF\xFFdetails\x00");
socket_set_timeout($this->fp, 1);
$this->getData('byte');
$this->getData('byte');
$this->getData('byte');
$this->getData('byte');
$this->getData('byte');
$this->getData('byte');
$this->getData('byte');
$this->getData('byte');
$this->getData('byte');
$this->getString();
$this->serverInfo['hostname'] = $this->getString();
$this->serverInfo['map'] = $this->getString();
$this->getString();
$this->serverInfo['mod'] = $this->getString();
$this->serverInfo['players'] = $this->getData("byte");
$this->serverInfo['maxplayers'] = $this->getData("byte");
$this->getData("byte");
$this->serverInfo['servertype'] = (chr($this->getData("byte")) == "d") ? "Dedicated" : "Listen";
$this->serverInfo['server_os'] = (chr($this->getData("byte")) == "w") ? "Windows" : "Linux";
$this->serverInfo['password'] = $this->getData("byte");
$this->getData("byte");
$this->getString();
$this->getString();
$this->getString();
$this->getData("long");
$this->getData("long");
$this->getData("byte");
$this->getData("byte");
$this->serverInfo['vac'] = $this->getData("byte");
$this->getData("byte");
}
private function getData($type)
{
switch($type)
{
case "byte":
return ord(fread($this->fp, 1));
break;
case "char":
return fread($this->fp, 1);
break;
case "float":
$data = unpack("f", fread($this->fp, 4));
return $data[1];
break;
}
}
private function getString()
{
$string = '';
$loop = TRUE;
while($loop)
{
$_fp = $this->getData("char");
if( ord($_fp) != 0 )
{
$string .= $_fp;
}
else { $loop = FALSE; }
}
return $string;
}
public function getStatus()
{
$fp = fsockopen('udp://'.$this->ip, $this->port);
fwrite($fp, "\xFF\xFF\xFF\xFFTSource Engine Query\x00");
socket_set_timeout($fp, 1);
if(fread($fp,24))
{
return 1;
}
else
{
return 0;
}
}
}
?>
server name
maps
player
Добавено преди 4 часа 58 минути 16 секунди:
Ще се намери ли някой разбирач по моя проблем.