PDA

Просмотр полной версии : Свой Userbar


XIII
15.03.2007, 01:56
Люди добрые подскажите пожалуйста как связать юзербар со скриптом

status.php
<?php


/* Configurations */
$host = '212.98.164.134'; // Enter your no-ip.com address or server ip here.
$acc_port = '6900'; // Port number of your Login/Account Server. Default 6900.
$char_port = '6121'; // Port number of your Charater Server. Default 6121.
$map_port = '5121'; // Port number of your Map Server. Default 5121.
$interval = time()+120; // What interval (in seconds) should this script check server status? To disable, type leave as 0
$online = 'Online'; // Either type the word Online or use <img src="/images/online.gif" title="Online">
$offline = 'Offline'; // Either type the word Offline or use <img src="/images/offline.gif" title="Offline">



/* Disable Error Reporting */
error_reporting(0);

/* Check Server Status, If Server Status Was Not Checked In Last $interval seconds */
if($_COOKIE["checked"] != "true")
{
/* Check Server Status */
$acc = fsockopen($host, $acc_port, $errno, $errstr, 1);
$char = fsockopen($host, $char_port, $errno, $errstr, 1);
$map = fsockopen($host, $map_port, $errno, $errstr, 1);

/* Workout Server Status & Set Cookie */
if(!$acc){ $acc_status = $offline; setcookie("acc_status", "offline", $interval); } else { $acc_status = $online; }
if(!$char){ $char_status = $offline; setcookie("char_status", "offline", $interval); } else { $char_status = $online; }
if(!$map){ $map_status = $offline; setcookie("map_status", "offline", $interval); } else { $map_status = $online; }

/* Set Cookie To Let The Script Know, Server Status is Checked */
setcookie("checked", "true", $interval);
}
else
if($_COOKIE["checked"] == "true")
{
/* Read Cookie Values */
if($_COOKIE["acc_status"] == "offline"){ $acc_status = $offline; } else { $acc_status = $online; }
if($_COOKIE["char_status"] == "offline"){ $char_status = $offline; } else { $char_status = $online; }
if($_COOKIE["map_status"] == "offline"){ $map_status = $offline; } else { $map_status = $online; }
}

?>

serv.php

<?php

/* Server Status Script */
include("status.php");

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>SoulRO.net Status</title>
<style type="text/css">
<!--
.text {font-family: Verdana, Arial, Helvetica, sans-serif; font-size:12px;}
-->
</style>
</head>
<body>
<table border="1" cellspacing="0" cellpadding="5">
<tr>
<td width="200" colspan="2" align="center" class="text" bgcolor="#E4E4E4">
<strong>By-RO Server Status </strong></td>
</tr>
<tr>
<td width="100" class="text">Login Server</td>
<td width="100" class="text"><?php echo $acc_status; ?></td>
</tr>
<tr>
<td width="100" class="text">Char Server</td>
<td width="100" class="text"><?php echo $char_status; ?></td>
</tr>
<tr>
<td width="100" class="text">Map Server</td>
<td width="100" class="text"><?php echo $map_status; ?></td>
</tr>
</table>
</body>
</html>

и вот этот юзербар _http://img410.imageshack.us/my.php?image=byroth3.png

как сделать чтобы в нём показывался статус ?
зарание спасибо

bxN5
15.03.2007, 02:08
<?php
Header("Content-type: image/png");
$string=сюда пишеш то что хочеш выводить свои $acc_status; и т.д
$im = ImageCreateFromPng("byroth3.png");
$c = ImageColorAllocate($im, 225, 225, 225);
ImageString($im,3,75,43, $string,$c);
ImagePng($im);
ImageDestroy($im);
?>
Вроде так

XIII
15.03.2007, 02:34
там же include "serv.php" или include "status.php" надо добавить вроде? чтото неправельно я делаю =)

XIII
15.03.2007, 02:55
чёта получилось но не видно текст =) _http://murdok.emobl.com/bar.php
<?php
include "status.php";
Header("Content-type: image/png");
$im = ImageCreateFromPng("by-ro.png");
$c = ImageColorAllocate($im, 225, 225, 225);
imagestring ($im, $F, 146, 16, strtoupper($map_status), $tcolor);

ImagePng($im);
ImageDestroy($im);
?>

XIII
15.03.2007, 03:10
вроде как сделал, всё показывает надеюсь правельно =), но как сделать чтобы этот юзер бар можно было засунуть в форум? также не будет с расширением php

bxN5
15.03.2007, 03:16
Почему?Хотя я в бб коды не пробовал,но в html свободно <img src="img.php"> и показывает картинку ибо Content-type: image/png

XIII
15.03.2007, 03:24
на форумах нельзя вроде так <img src="http://murdok.emobl.com/bar.php">

bxN5
15.03.2007, 03:32
На форумах вобще html нельзя.А вобще читай
http://forum.antichat.ru/thread20996-%CF%EE%E4%EF%E8%F1%FC+php.html
http://forum.antichat.ru/thread13068-%CF%EE%E4%EF%E8%F1%FC+php.html

GoNZo
15.03.2007, 05:58
дак ты просто вставляй http://murdok.emobl.com/bar.php
а еще ты забыл прописать в .htaccess это:
AddType application/x-httpd-php .png

DRON-ANARCHY
16.03.2007, 16:12
dala$$ смени аватар. слишком возбуждает)
или поставь на него функции юзербара, как цензуру)

bxN5
16.03.2007, 21:33
Так норм)?

Abra
16.03.2007, 21:47
зашел тему почитать. Сплошные сиськи и жопы =\
внимание отвлекают =\

XIII
17.03.2007, 01:34
http://murdok.emobl.com/userbar.png
ещё один =)

GoNZo
17.03.2007, 06:29
У меня вот такой =)
http://gonzo.name/toolz/bar/img.php

тока блин ошибка там а псдишник удалил :/

Isis
17.03.2007, 17:52
Во....спасибо за статью комуто ))
Сегодня выложу скрипт, кс мониторинг - на картинке....Во тема...