( search forums )
[UPDATED]Soldat-Server-Status-Pic-Generator
Soldat Forums - Soldat Fans - Fan Apps
ManSoft Warlord
March 7, 2006, 9:14 pm
Hi!

I made a little Script, which generates a picture whether your server is online or offline. Nothing big ^^.
You only need a picture called "onoff.png".
Or take this one here:
http://img123.imageshack.us/img123/4954/onoffphp0eu.png

and rename it.
Important! Your webhoster should support sockets.

Now you can simply add your picture with the [IMG] / < img > tags.

Here a little demo:
[IMAGE]

[IMAGE]

[IMAGE]


If you find bugs - please tell 'em me ;)
Have Fun - Play Soldat ;)

CyA

Warlord ;)

[code]<?php
//#########################################
//### Mankind-Software proudly presents ###
//### Soldat-Server-Status-Pic-Generator ##
//Done by Warlord aKa Friedemann Stoffregen
// Copyright in March 2006
//# Version 0.4a www.mankind-software.de ##
//############ done for PsY ###############
//######### with help of Keydon ###########
//#########################################

// Variables - Must be changed!
$host="62.141.39.51"; //Your server-IP
$port="22073"; //Your server-port
$password = ""; //Your admin-password

//Do not change anything below!

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket < 0) else

$result = socket_connect($socket, $host, $port);
if ($result < 0)

$in = $password."\r\n";
socket_write($socket, $in, strlen($in));
$out = socket_read($socket, 2048);


$out = socket_read($socket, 2048);

$out = socket_read($socket, 2048);
if ($out == "")
$error = 'Login failed';



if (!$socket)else
socket_close($socket);
header("Content-type: image/png");
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");
$image = imagecreatefrompng('onoff.png');
$green = imagecolorallocate($image, 0, 100, 0);
$red = imagecolorallocate($image, 100, 0, 0);
$blue = imagecolorallocate($image, 0, 0, 100);

if($onoff=="Online" && $error=='')
imagestring($image, 3, 1, 1, $onoff, $green);
elseif ($onoff == "offline" && $error=='')
imagestring($image, 3, 1, 1, $onoff, $red);
else
imagepng($image);

?>[/code]

Deleted User
March 7, 2006, 11:32 pm
Your demo isnt showing for me.
Also why doesnt the time change in your signature? :S
I would really like this though, i hope its possible? XD


EDIT:: nvm it does move =O

Deleted User
March 7, 2006, 11:52 pm
nice i like it very origional.


p.s.
i could probably be able to do those three at the bottom but i would be able to add the map images because it too much work for me.

Deleted User
March 8, 2006, 12:47 am
Your sig... rules... broken...

FliesLikeABrick
March 8, 2006, 1:06 am
I was going to say that, but I don't think that is his signature and right now he doesn't have any other posts I can find to check. I think that may just be a horizontal rule, but I could be wrong.

ManSoft Warlord
March 8, 2006, 5:37 am
The Stats-Pics are my sig.
I'm going to release it, but at the moment i only read the information via the gamestat.txt which means a lot of speed-losings.

But if you want, i could make it public beta ;).

rainrider
March 9, 2006, 10:44 pm
put that at the begin of file
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");
to let browser always redownload image

ManSoft Warlord
March 10, 2006, 11:06 am
yes - I'll do it... thx