( search forums )
someone had requested....
Soldat Forums - Soldat Fans - Fan Apps
Deleted User
March 22, 2006, 12:14 am
someone had requested puregrains soldat status script. this isnt his but it works the exact same way.

[code]
<?
//CONFIG START//
$ip = "server ip";
$port = "server port";
$name = "server name";
//CONFIG END//

if (! $sock = @fsockopen($ip, $port))
{
echo(''.$name.'<br>
<font color="red">Offline</font>');
} else {
echo(''.$name.'<br>
<font color="green">Online</font><br>
<a href="soldat://'$ip':'$port'">Click here to join</a>');
}
?>
[/code]

rainrider
March 22, 2006, 12:35 pm
Image version..

pic.php
[code]
<?
$on_url = "http://vip.webezgo.com.tw/images/ver2/on.gif";
$off_url = "http://vip.webezgo.com.tw/images/ver2/off.gif";
if ( substr ( $on_url, - 3 ) != substr ( $off_url, - 3 ) ) $msg = "Images should have the same extension.";
if ( substr ( $on_url, - 3 ) == "png" ) $type = 1;
else if ( substr ( $on_url, - 3 ) == "gif" ) $type = 2;
else if ( substr ( $on_url, - 3 ) == "jpg" ) $type = 3;
else if ( substr ( $on_url, - 3 ) == "jpeg" ) $type = 3;
if ( ! isset ( $type ) ) $msg = "Invalid picture extension.";

error_reporting ( E_NONE );

if ( isset ( $msg ) )
{
$fontsize = 2;
$margins = 3;
$img = imagecreatetruecolor ( imagefontwidth ( $fontsize ) * strlen ( $msg ) + $margins * 2, imagefontheight ( $fontsize ) + $margins * 2 );
$back = imagecolorallocate ( $img, 255, 255, 255 );
$text = imagecolorallocate ( $img, 80, 0, 0 );
imagefilledrectangle ( $img, 0, 0, imagesx ( $img ), imagesy ( $img ), $back );
imagestring ( $img, $fontsize, $margins, $margins, $msg, $text );
}
else
{
$parsed_url = fsockopen ( $_GET [ 'ip' ], $_GET [ 'port' ] ) ? $on_url : $off_url;
switch ( $type )
{
case 2: $img = @ imagecreatefromgif ( $parsed_url ); break;
case 3: $img = @ imagecreatefromjpeg ( $parsed_url ); break;
default: $img = @ imagecreatefrompng ( $parsed_url );
}
};

header ( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header ( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header ( "Cache-Control: no-store, no-cache, must-revalidate" );
header ( "Cache-Control: post-check=0, pre-check=0", false );
header ( "Pragma: no-cache" );

header ( "Content-type: image/png" );
imagepng ( $img );
?>
[/code]
view.php
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
<title>Server status</title>
</head>
<body>
<?
$ip = "127.0.0.1";
$port = 23073;
echo "<a href=\"soldat://" . $ip . ":" . $port . "\"><img align=\"absmiddle\" src=\"./pic.php?ip=" . $ip . "&port=" . $port . "\" alt=\"Server status\"> Click to join</a>";
?>
</body>
</html>
[/code]
Whole config is placed in view.php (lines with $ip and $port). If you want you can change the path to on and off graphics in pic.php

Deleted User
March 25, 2006, 7:37 am
It would be better to use:

imagepng($image,"output.png");

then you can just stick the call to the page on your website, and use the image on forums. or you could just mess with .htaccess

AddType application/php png

or something, then rename your .php to .png and it will fool all forum software :)

rainrider
March 25, 2006, 7:40 am
http://image.com/images.php?a.png
http://image.com/images.php?a&a.png
:D

mar77a
March 25, 2006, 2:13 pm
Ehhh, it's better to try and connect to port + 10 since there are more servers with admin disabled than with map downloading disabled...

FliesLikeABrick
March 25, 2006, 4:08 pm
or check both, the server is online if either one responds

rainrider
March 25, 2006, 8:23 pm
pic.php
$port = 23073;
$port2 = 23083;
(...)
echo "<a href=\"soldat://" . $ip . ":" . $port . "\"><img align=\"absmiddle\" src=\"./pic.php?ip=" . $ip . "&port=" . $port . "&port2=" . $port2 . "\" alt=\"Server status\"> Click to join</a>";
(...)

view.php
$parsed_url = fsockopen ( $_GET [ 'ip' ], $_GET [ 'port' ] ) ? $on_url : $off_url;
if ( $parsed_url == $off_url )
$parsed_url = fsockopen ( $_GET [ 'ip' ], $_GET [ 'port2' ] ) ? $on_url : $off_url;