[MySQL] Server Status for Butterfly & Phoenix [PDO]

Status
Not open for further replies.

Xversion

Member
Jul 5, 2014
11
0
First release on Devbest, gets the data from your database (most but not sure if all) databases of Butterfly and Phoenix.
Details include :
-> Online or Offline
-> Users Online
-> User Peak
-> Rooms Loaded
-> Server Name/Version
-> Stamp
-> Bannerdata (for Butterfly)
-> Minutes Uptime (for Butterfly)
PHP:
<?php
/*
   _________                                _________ __          __               
/   _____/ ______________  __ ___________/   _____//  |______ _/  |_ __ __  ______
\_____  \_/ __ \_  __ \  \/ // __ \_  __ \_____  \\   __\__  \\   __\  |  \/  ___/
/        \  ___/|  | \/\   /\  ___/|  | \/        \|  |  / __ \|  | |  |  /\___ \
/_______  /\___  >__|    \_/  \___  >__| /_______  /|__| (____  /__| |____//____  >
        \/     \/                 \/             \/           \/                \/
                                                                      By Xversion
*/

define('db_host', 'localhost'); //Your Database Hostname
define('db_user', 'root'); //Your Database Username
define('db_pass', 'test123'); //Your Database Password
define('db_name', 'xabbo_db'); //Your Database Name
define('server', 'butterfly'); //Your Emulator (phoenix or butterfly)

$db = new PDO('mysql:host='. db_host .';dbname='. db_name, db_user, db_pass); //Connect to MySQL Database via PDO
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); //PDO Exceptions

if (server == 'butterfly')
{
    $get_server_status = $db->prepare('SELECT * FROM server_status ORDER BY id DESC');
    $get_server_status->execute();
    for($i=0; $row = $get_server_status->fetch(); $i++)
    {
        echo '<b>Server Status :</b> ' . htmlentities($row['status']) . '<br />
        <b>Server Name &amp; Version :</b> ' . htmlentities($row['server_ver']) . '<br />
        <b>Rooms Loaded :</b> ' . htmlentities($row['rooms_loaded']) . '<br />
        <b>User(s) Online : </b>' . htmlentities($row['users_online']) . '<br />
        <b>User(s) Peak : </b>' . htmlentities($row['userpeak']) . '<br />
        <b>Stamp : </b>' . htmlentities($row['stamp']) . '<br />
        <b>Minutes Uptime : </b>' . htmlentities($row['minutesuptime']) . '<br />
        <b>BannerData : </b>' . htmlentities($row['bannerdata']) . '<br />';
    }
    exit;
}
elseif (server == 'phoenix')
{
    $get_server_status = $db->prepare('SELECT * FROM server_status ORDER BY id DESC');
    $get_server_status->execute();
    for($i=0; $row = $get_server_status->fetch(); $i++)
    {
        echo '<b>Server Status :</b> ' . htmlentities($row['status']) . '<br />
        <b>Server Name &amp; Version :</b> ' . htmlentities($row['server_ver']) . '<br />
        <b>Rooms Loaded :</b> ' . htmlentities($row['rooms_loaded']) . '<br />
        <b>User(s) Online : </b>' . htmlentities($row['users_online']) . '<br />
        <b>User(s) Peak : </b>' . htmlentities($row['userpeak']) . '<br />
        <b>Stamp : </b>' . htmlentities($row['stamp']) . '<br />';
    }
    exit;
}
exit;
?>

Copy the code and save to 'server_status.php'

Screenshots: (of Butterfly Emu)
4f27783b105099108c9531cd6a8b1ce7.png

lemme know if it works (I only tested this on Apache but any web server with PHP/PDO and MySQL should work.
 
Last edited:

Xversion

Member
Jul 5, 2014
11
0
Pretty useless if i'm being honest & Pretty simple to do. But good job.

Thanks for your feedback, however I believe it is useful - for example I have a hotel and when I'm away I would like to if a staff member of mine shut the hotel down (by going rage), and see whats going on without loading the whole website (waste of internet and time) - and this would be my solution to it.

I also wonder why most people still use MySQL, MySQLi is a better alternative but PDO imo is the best, and its something that you don't see much on Habbo Retros.

However on the bright side - I'm glad you like it :)
 
Last edited:

Kurma

Member
Oct 12, 2011
32
1
Thanks for your feedback, however I believe it is useful - for example I have a hotel and when I'm away I would like to if a staff member of mine shut the hotel down (by going rage), and see whats going on without loading the whole website (waste of internet and time) - and this would be my solution to it.
:)
Didn't think of it like that, thats not a bad idea!
 

DarkAdam

Member
Jul 21, 2014
6
0
Thanks for your feedback, however I believe it is useful - for example I have a hotel and when I'm away I would like to if a staff member of mine shut the hotel down (by going rage), and see whats going on without loading the whole website (waste of internet and time) - and this would be my solution to it.

I also wonder why most people still use MySQL, MySQLi is a better alternative but PDO imo is the best, and its something that you don't see much on Habbo Retros.

However on the bright side - I'm glad you like it :)
Agreed. Also if your on an older mobile device, with a weak processor etc, a standard page takes forever to load, this will take no more than a few seconds
 

biancstubac

New Member
Dec 11, 2014
5
0
How'd i fix this?
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 1
STR: <?
SQL: <?php
/*
_________ _________ __ __
/ _____/ ______________ __ ___________/ _____// |______ _/ |_ __ __ ______
\_____ \_/ __ \_ __ \ \/ // __ \_ __ \_____ \\ __\__ \\ __\ | \/ ___/
/ \ ___/| | \/\ /\ ___/| | \/ \| | / __ \| | | | /\___ \
/_______ /\___ >__| \_/ \___ >__| /_______ /|__| (____ /__| |____//____ >
\/ \/ \/ \/ \/ \/
By Xversion
*/

define('db_host', '127.0.0.1');

I am using phoenix and phpmyadmin. please help and for me i exported it pls help it says server_status.sql where is server_status.php located at? I use revcms.
 
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Top