- dAgWy7T.jpg (76.08 KiB) Преглеждано 3898 пъти
- dAgWy7T.jpg (76.08 KiB) Преглеждано 3898 пъти
Благодарен съм предварителтно.
Код за потвърждение: Избери целия код
<?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>
Код за потвърждение: Избери целия код
<?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 Адрес и порт!";
}
?>
Код за потвърждение: Избери целия код
<?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 Адрес и порт!";
}
?>
Код за потвърждение: Избери целия код
<?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;
}
}
}
?>
Разгледай кода, скрипта изисква банер картинка и sql файл, имах ги някъде но пак ми даваше същият проблем като на снимката от 1-вият пост.
Кодовете колегата ги е поставил.
Код за потвърждение: Избери целия код
--
-- Структура на таблица `server_gen`
--
CREATE TABLE IF NOT EXISTS `server_gen` (
`id` int(25) NOT NULL AUTO_INCREMENT,
`ip` varchar(60) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=206 ;
--
-- Ссхема на данните от таблица `server_gen`
--
INSERT INTO `server_gen` (`id`, `ip`) VALUES
(1, '78.130.136.123:27015'),
(2, '95.169.197.48:27016'),
(3, '94.236.237.130:27018'),
(4, '93.155.224.224:27016'),
(5, '46.10.235.10:27018'),
(6, '46.233.25.75:27015'),
(7, '194.187.133.88:27015'),
(8, '212.5.147.243:27019'),
(9, '85.217.250.126:27015'),
(10, '94.235.237.125:27022'),
(11, '109.120.210.158:27017'),
(12, '109.107.64.190:27015'),
(13, '94.190.179.28:27017'),
(14, '46.47.116.242:27020'),
(15, '87.121.84.20:27022'),
(16, '95.158.155.232:27017'),
(17, '46.10.235.10:27017'),
(18, '212.233.214.111:27015'),
(19, '94.156.201.139:27015'),
(20, '188.254.254.249:27015'),
(21, '130.204.143.102:27026'),
(22, '109.160.50.40:27015'),
(23, '78.83.53.57:27015'),
(24, '87.121.194.86:27015'),
(25, '88.80.129.13:27015'),
(26, '77.76.180.95:27015'),
(27, '78.128.6.2:27021'),
(28, '78.128.6.4:27022'),
(29, '79.124.4.84:27020'),
(30, '93.183.163.113:27020'),
(31, '94.236.237.125:27022'),
(32, '87.120.124.41:27018'),
(33, '84.54.160.62:27015'),
(34, '89.215.34.82:27015'),
(35, '93.123.50.11:27015'),
(36, '89.215.171.129:27015'),
(37, '87.119.64.196:27015'),
(38, '79.124.67.163:27015'),
(39, '46.47.80.74:27019'),
(40, '213.231.146.97:27015'),
(41, '88.80.113.243:27015'),
(42, '89.215.57.18:27016'),
(43, '77.238.79.212:27018'),
(44, '87.121.206.239:27017'),
(45, '213.240.229.242:27010'),
(46, '88.87.8.50:27019'),
(47, '178.75.246.82:27015'),
(48, '78.128.6.4:27023'),
(49, '212.233.176.25:27015'),
(50, '13.123.123.4:25130'),
(51, '79.124.67.166:27019'),
(52, '94.190.187.235:27017'),
(53, '95.87.198.236:27018'),
(54, '93.94.139.13:27015'),
(55, '80.78.225.182:27015'),
(56, '94.156.162.186:27016'),
(57, '85.130.16.146:27016'),
(58, '46.47.102.231:2709'),
(59, '93.152.161.35:27015'),
(60, '77.71.10.240:27015'),
(61, '130.204.177.168:27016'),
(62, '130.204.145.69:27015'),
(63, '109.120.212.156:27015'),
(65, '212.233.249.184:27016'),
(66, '78.90.209.33:27016'),
(67, '109.121.229.197:27012'),
(68, '46.233.27.49:27015'),
(69, '78.83.43.178:27014'),
(70, '89.215.156.220:27015'),
(71, '46.10.81.215:27011'),
(72, '87.121.169.44:27015'),
(73, '87.246.51.207:27015'),
(74, '178.254.218.88:27021'),
(75, '95.42.137.251:27015'),
(76, '188.254.201.239:27015'),
(77, '213.91.200.93:27017'),
(78, '77.77.21.146:27015'),
(79, '85.130.73.84:27016'),
(80, '78.128.6.3:27021'),
(83, '87.126.59.165:27016'),
(82, '212.70.136.4:27019'),
(84, '93.93.12.4:27017'),
(85, '195.178.8.21:27015'),
(86, '195.178.8.21:27016'),
(87, '213.231.137.56:27015'),
(88, '93.155.220.197:27016'),
(89, '212.70.136.4:27012'),
(90, '178.75.246.82:27016'),
(91, '212.104.118.89:27018'),
(92, '94.236.237.182:27020'),
(93, '79.124.67.167:27018'),
(94, '79.124.67.174:27016'),
(95, '87.119.64.23:27015'),
(96, '46.10.223.11:27016'),
(97, '89.190.213.199:27015'),
(98, '78.90.197.113:27019'),
(99, '89.106.118.85:29799'),
(100, '78.83.244.107:27010'),
(101, 'http://46.47.80.74:27016/'),
(102, '84.54.132.227:27015'),
(103, '87.119.67.121:27016'),
(104, '78.125.254.96:27015'),
(105, '109.104.200.3:27015'),
(106, '95.168.226.213:27015'),
(107, '77.78.55.45:27024'),
(108, '78.83.37.60:27015'),
(109, '78.128.6.4:27017'),
(110, '84.252.6.25:27017'),
(111, '79.124.23.254:27016'),
(112, '212.233.247.4:27019'),
(113, '94.236.237.241:27015'),
(114, '46.40.124.136:27019.'),
(115, '88.80.113.243:27016'),
(116, '95.87.59.207:27015'),
(117, '95.87.59.207:27016'),
(135, '31.211.143.65:27017'),
(120, '212.233.133.85:27016'),
(168, '188.254.237.139:27016'),
(122, '79.124.67.173:27017.'),
(123, '79.124.67.173:27017'),
(137, '31.211.143.65:27018'),
(138, '95.87.217.170:27015'),
(139, '212.233.187.149:27018'),
(140, '212.25.56.219:27015'),
(141, '212.25.56.219:27017'),
(132, '212.122.86.247:27018'),
(133, '79.124.67.173:27019'),
(134, '79.124.67.168:27018'),
(142, '31.211.148.92:27015'),
(143, '78.128.6.9:27019'),
(144, '46.47.123.212:27015'),
(145, '213.214.65.108:27015'),
(146, '93.123.50.11:27017'),
(147, '178.254.224.45:27015'),
(148, '46.47.81.84:27017'),
(149, '31.211.136.60:27015'),
(150, '78.83.123.235:27015'),
(151, '195.34.118.179:27016'),
(152, '79.124.67.162:27019'),
(153, '46.40.92.102:27015'),
(154, '78.90.209.33:27018'),
(155, '80.253.62.1:27015'),
(156, '89.190.213.199:27023'),
(157, '89.190.213.199:27018'),
(158, '89.190.213.199:27025'),
(159, '77.78.23.30:27016'),
(160, '212.233.245.152:27018'),
(161, '78.130.171.38:27015'),
(162, '78.130.171.38:27016'),
(163, '78.130.171.38:27017'),
(164, '94.156.58.89:27018'),
(165, '94.156.58.254:27015'),
(166, '79.124.67.168:27022'),
(167, '93.124.167.50:27015'),
(169, '178.254.245.23:25565'),
(170, '78.83.85.35:27015'),
(171, '87.252.188.125:27016'),
(172, '78.108.243.194:27016'),
(173, '213.167.5.238:27050'),
(174, '46.47.82.116:27015'),
(175, '178.169.134.157:27016'),
(176, '89.215.34.82:27016'),
(177, '85.217.249.172:27020'),
(178, '84.54.132.171:27015'),
(179, '94.101.194.100:27018'),
(180, '84.54.145.222:27015'),
(181, '212.233.185.227:27016'),
(182, '77.76.145.163:27017'),
(183, '37.130.242.82:27015'),
(184, '85.239.142.29:27016'),
(185, '91.134.58.92:27016'),
(186, '178.254.255.44:27029'),
(187, '89.100.15.119:27015'),
(188, '178.254.247.235:27019'),
(189, '93.94.139.11:27014'),
(190, '91.211.109.65:27021'),
(191, '178.254.250.193:27016'),
(192, '46.10.227.139:27019'),
(193, '109.160.26.36:27015'),
(194, '109.160.26.36:27016'),
(195, '109.160.26.36:27017'),
(196, '109.160.26.36:27018'),
(197, '109.160.26.36:27019'),
(198, '109.160.26.36:27020'),
(199, '109.160.26.36:27021'),
(200, '94.26.64.130:27018'),
(201, '94.236.237.16:27016'),
(202, '94.236.237.16:27015'),
(203, '78.128.6.5:27020'),
(204, '178.75.193.234:27015'),
(205, '46.10.227.139:27011');
-- --------------------------------------------------------
Потребители разглеждащи този форум: 0 регистрирани и 2 госта