• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Server Signature with own backgrounds!

chojrak

Banned User
Joined
Oct 25, 2008
Messages
5,832
Solutions
2
Reaction score
160
Hello, some time ago i wrote Signature System now i will post it for you. :)

// edit
It's like an ots-list.org server status, but with custom, random backgrounds.
It requires Gesior's Account Managment System.
// end of edit

1. Go to your /www/ and create directory "signatures".

2. Create file called generate.php and paste this code inside:
Code:
<?PHP
	// Status Box Signature
	// By Chojrak
	// Version 1.3

	class statusBox
	{
		function __construct()
		{
			$this -> password = "YourPassword";
			$this -> backgrounds = array("./bg/1.png", "./bg/2.png");
		}
		function getPassword()
		{
			return $this -> password;
		}
		function getStatus($info)
		{
			$status = parse_ini_file("../config/serverstatus");
			if ($info == "status") { if ($status['serverStatus_online'] == 1) { return "Status: Online"; } else { return "Status: Offline"; } }
			if ($info == "players") { return "Players: ".$status['serverStatus_players']."/".$status['serverStatus_playersMax']; }
			if ($info == "uptime") { return "Uptime: ".$status['serverStatus_uptime']; }
			if ($info == "monsters") { return "Monsters: ".$status['serverStatus_monsters']; }
		}
		function generate()
		{
			header("Content-type: image/png");
			$image = imagecreatefrompng($this -> backgrounds[array_rand($this -> backgrounds)]);

			imagettftext($image, 12, 0, 15, 25, imagecolorallocate($image, 255, 255, 255), "./font.ttf", $this -> getStatus("status"));
			imagettftext($image, 12, 0, 15, 50, imagecolorallocate($image, 255, 255, 255), "./font.ttf", $this -> getStatus("players"));
			imagettftext($image, 12, 0, 15, 75, imagecolorallocate($image, 255, 255, 255), "./font.ttf", $this -> getStatus("uptime"));
			imagettftext($image, 12, 0, 15, 100, imagecolorallocate($image, 255, 255, 255), "./font.ttf", $this -> getStatus("monsters"));

			imagepng($image, "signature.png");
			imagedestroy($image);
		}
	}

	$signature = new statusBox();
	if ($_GET['password'] == $signature -> getPassword())
		$signature -> generate();
	else
		echo "Security password does not match!";
?>

3. Now download font which you want on status image and put into signature folder. (Font file should be called font.ttf)

4. Create an empty image with sizes which you want.

5. Create bg directory, and paste there your backgrounds. Then back to generate.php and fill backgrounds table with names of backgrounds.

6. To generate signature go to: http://YourServerIP/signature/generate.php?password=YourPassword

7. Now (Only for Linux!) setup your cron and execute generate.php each 5~ minutes.

8. Now you have to paste link http://YourServerUP/signature/signature.png.

9. Feel free to rep me, by clicking THIS link! :D
 
Last edited:
It's example link how to generate signature :)
 
@James:
Found it on HDD and decide to release :D
 
It works only at Sresuuuur AAC and all can reach the password (source or firebug) :F.
 
Tell me how to get a source code of PHP file? ^.-
 
Nice :)

Here is my little feedback :)

PHP:
$image = imagecreatefrompng($this -> backgrounds[rand(0, count($this -> backgrounds))]);

PHP: array_rand - Manual

--

And also

PHP:
imagedestroy($image);

Might be used when destructing class.

Anyway, keep up posting scripts hehe.
 
Back
Top