[Release] Web Monitoring for your server (php)

Hi there, mates.

Let me introduce a Simple Web Monitoring for your server. You can use it on your website in .php pages.

Here is the code

<?php
/*-----------------------[ SETTINGS ]------------------------------*/
$server_settings['title'] = "Server Name"; // Server name or brand to display
$server_settings['ip'] = "localhost"; // localhost for local servers / IP or domain name for VDS/VPS
$server_settings['port'] = "30120"; // basically 30120
$server_settings['max_slots'] = 24; // maximum slots. By default 24
/*----------------------------------------------------------------*/
print "<div style='background-color: #f2f2f2; border: 4px double black; border-radius: 5px; width: 300px; padding: 2px; border: 4px double black;'>";
$content = json_decode(file_get_contents("http://".$server_settings['ip'].":".$server_settings['port']."/info.json"), true);
$img_d64 = $content['icon'];
if($content):
    $gta5_players = file_get_contents("http://".$server_settings['ip'].":".$server_settings['port']."/players.json");
	$content = json_decode($gta5_players, true);
	$pl_count = count($content);
	$SRV_STATUS = "<font style='color: green;'>Online</font>";
	if($img_d64) { print "<div align='center'><img  width='150' src='data:image/png;base64, $img_d64' ></div>"; }
	print "<p align='center' style='color:#000000; background-color: #ffffff;'><strong>$server_settings[title]</strong></p>";
	print "<p align='center'><strong>Players:</strong> $pl_count / $server_settings[max_slots]</p>";
else:
	print "<p align='center' style='color:#000000; background-color: #ffffff;'><strong>$server_settings[title]</strong></p>";
	$SRV_STATUS = "<font style='color: red;'>Offline</font>";
endif;
print "<br/><hr/><p align='center'><strong>Status: $SRV_STATUS</strong></p></div>";
?>

What does this script does?

Using JSON info, it decodes your server icon from data64 to png/jpg/whatewer, prints how much players is playing now or shows you Status: Offline backwise.

Do not forget

To set up your IP and port in settings!

Screenshots

Ok status:

Or:

Links

Live preview: HERE

Also

As usual, no credits required, Use it however you want.

Visit unofficial wiki: HERE

Thanks, good luck!

11 Likes

Again, awesome release!

1 Like

Hey buddy, don’t forget to mention people to change their query/game port to whatever they have when they’ve set a custom one as your script only tells the php to listen to the default port (30120) as shown in your rule:

" $gta5_players = file_get_contents(“http://rolegame.online:30120/players.json”); "

Other than that, awesome job

1 Like

Thank you! Fixed!

1 Like

i want to implante your script in my other vps extern to serveur but i have this error

ile_get_contents(http://149.56.46.126:30120/info.json): failed to open stream: Connection refused in /homepages/36/d674497271/htdocs/clickandbuilds/IdentityV/online.php on line 9

maybe 30120 or 80 port is closed?
I cant get information from http://149.56.46.126 too…

its wierd the port its open i look again

Hello everyone, anyone could he share json files ?

Is this still working?

yes works fine for me

Thanks you :slight_smile: (20chars)

Hello, i got a weird error from php when the server is offline, here is the error: http://prntscr.com/mkixzr

EDIT: The error only arrive on my localhost server, so on the server itself it’s good.

I’m surprised this didn’t even get flagged. I made something that does this (in a different way) in C# and they were all butthurt about it :stuck_out_tongue: But nice job!

What issue did they have with a server monitoring app/script? There’s quite a few web panels out there that are offered without any opposition.

how to get player online name with php

You grab the content of your.server.ip:30120/players.json and decode it.

Thank you. I can find the player name online.

Did exactly as you said in the instructions, works perfectly fine for my server. Thanks for releasing! :slight_smile: Looks good on the website.

are you tried to look for playername online ?

Hello all I want designed and system for professional GameTracker monitorning for all CS version I want help. Wer want I Pay for that my. Email. csregame@gmail.com