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]
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]