jcroom Posted February 25, 2009 Share Posted February 25, 2009 I was bored. </story> This will show you: # of servers you have # of suspended game servers # of active game servers total # of game servers total # of slots you host http://smokin-servers.com/files/quickstats/quickstats.zip include.php: <?php $link = mysql_connect('IPADDRESS', 'USERNAME', 'PASSWORD'); if (!$link) { die('Not connected : ' . mysql_error()); } $db_selected = mysql_select_db('DATABASENAME', $link); if (!$db_selected) { die ('Can\'t Find DB : ' . mysql_error()); } // hi $totalservers = mysql_query("SELECT COUNT(SERVER_ID) FROM tc_servers"); $ts = mysql_result($totalservers, 0); $suspended = mysql_query("SELECT COUNT(SERVICE_ID) FROM tc_services WHERE STARTUP_TYPE = 3"); $sus = mysql_result($suspended, 0); $active = mysql_query("SELECT COUNT(SERVICE_ID) FROM tc_services WHERE STARTUP_TYPE = 1"); $act = mysql_result($active, 0); $totalgservers = mysql_query("SELECT COUNT(SERVICE_ID) FROM tc_services"); $tg = mysql_result($totalgservers, 0); $totalslots = mysql_query("SELECT SUM(SLOTS) FROM tc_services"); $tsc = mysql_result($totalslots, 0); // ?> index.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>TCAdmin Quick Stats</title> </head> <?php include 'include.php'; ?> <body> <p>TCAdmin Quick Stats</p> <br /> <table width="200" height="42" border="1"> <tr> <td>Total # of Servers: </td> </tr> <tr> <td><div align="center"><?php echo $ts; ?></div> </td> </tr> </table> <br /> <table width="235" border="1"> <tr> <td width="166"><div align="center">Suspended Game Servers:</div></td> <td width="53"><div align="center"><?php echo $sus; ?></div></td> </tr> <tr> <td><div align="center">Active Game Servers:</div></td> <td><div align="center"><?php echo $act; ?></div></td> </tr> <tr> <td><div align="center">Total # of Game Servers</div></td> <td><div align="center"><?php echo $tg; ?></div></td> </tr> </table> <br /> <table width="168" border="1"> <tr> <td width="101">Total Slot Count</td> <td width="51"><div align="center"><?php echo $tsc; ?></div></td> </tr> </table> <p> </p> </body> </html> edit: oh yea make sure you change the login and database info in include.php. Link to comment Share on other sites More sharing options...
ECF Posted February 25, 2009 Share Posted February 25, 2009 Thank you for sharing! Link to comment Share on other sites More sharing options...
nosit1 Posted February 25, 2009 Share Posted February 25, 2009 Looks nice, does exactly what it's supposed to do. Link to comment Share on other sites More sharing options...
Todd Holley Posted February 25, 2009 Share Posted February 25, 2009 You have proven to be worth something Justin haha . Nice script, I honestly can say that I respect you much more than I did back in the LPG days. Keep it up. Link to comment Share on other sites More sharing options...
KingJ Posted February 25, 2009 Share Posted February 25, 2009 Sounds and looks great, perhaps we could make a combined version that includes my current players stats to make a more complete package? It's amazing how much statistical information you can actually pull from the TCA DB Link to comment Share on other sites More sharing options...
jcroom Posted February 25, 2009 Author Share Posted February 25, 2009 Yea we could, and yes the DB is full of useful information (LOL) Link to comment Share on other sites More sharing options...
jcroom Posted February 27, 2009 Author Share Posted February 27, 2009 Alright guys, here is the updated version to include KingJ's current players script: http://smokin-servers.com/files/quickstats/quickstats1.2.zip NOTE: it is not using the cron version so don't sit there refreshing the page. (lol) Link to comment Share on other sites More sharing options...
datalect Posted May 13, 2009 Share Posted May 13, 2009 Hi Guys, I too found this thread of interest, i've used this as a base for the current players quick check which i have implemented on our site to give us the number of current players accurate to 30 minutes. The variable $cur will contain the number of users currently connected. <?php $link = mysql_connect('SERVER', 'USERNAME', 'PASSWORD'); if (!$link) { die('Not connected : ' . mysql_error()); } $db_selected = mysql_select_db('DATABASE', $link); if (!$db_selected) { die ('Can\'t Find DB : ' . mysql_error()); } $minute = date('i'); if ($minute > '30') { $rounded = '30'; } else { $rounded = '00'; } $now = date('Y-m-d H:'); $current = mysql_query("SELECT SUM(AVERAGE_PLAYERS) FROM tc_service_performance WHERE PERF_DATE='$now$rounded'"); $cur = mysql_result($current, 0); ?> Hope this comes in handy for anybody interested. Cheers, Phil Link to comment Share on other sites More sharing options...
Dan M Posted May 13, 2009 Share Posted May 13, 2009 The above seems to be working but how do I enable logging of average slots within TCA? I've looked all over the place, "Collect Game Server Performance Data" is enabled. Link to comment Share on other sites More sharing options...
KingJ Posted May 13, 2009 Share Posted May 13, 2009 The above seems to be working but how do I enable logging of average slots within TCA? I've looked all over the place, "Collect Game Server Performance Data" is enabled. I don't think TCA does averages itself, rather they are calculated on-the-fly using the counts and time period. Link to comment Share on other sites More sharing options...
Dan M Posted May 13, 2009 Share Posted May 13, 2009 Yeah, all of it is enabled I think but it's not displaying anything when $cur is echoed. Link to comment Share on other sites More sharing options...
datalect Posted May 14, 2009 Share Posted May 14, 2009 Hi Dan, That php i have included above gets it from the tc_service_performce table, if you check that table you will notice that it collects and stores the data at 30 minute intervals, so lets say you wanted to check previous times for the slot counts you would just need to modify the $cur value. I have made it do it does the current half hour, but you can set that to any value you like through a form, but the format for the variable $cur MUST be: YYYY-MM-DD HH:MM eg. 2009-05-13 09:26 Hope that helps! Phil Link to comment Share on other sites More sharing options...
Dan M Posted May 14, 2009 Share Posted May 14, 2009 Yeah, there's nothing set inside that table, not sure why. Link to comment Share on other sites More sharing options...
tangogc Posted May 14, 2009 Share Posted May 14, 2009 the download link not work ! Link to comment Share on other sites More sharing options...
datalect Posted May 15, 2009 Share Posted May 15, 2009 Hey Dan, You need to ensure you have 'Game Server Performance Data' enabled in: System Settings -> Plugins -> GameMonitor Configuration I'm assuming if you dont have that enabled you also don't use the auto-restart/branding/slot check count enabled either? Thats within the same plugin. Cheers, Phil Link to comment Share on other sites More sharing options...
Dan M Posted May 15, 2009 Share Posted May 15, 2009 Hi Phil, All this is enabled. Specifically "Collect Game Server Performance Data" which is ticked. Still isn't working. Link to comment Share on other sites More sharing options...
tangogc Posted May 15, 2009 Share Posted May 15, 2009 the download link still not working for me could you repost please Link to comment Share on other sites More sharing options...
xpservers Posted May 25, 2009 Share Posted May 25, 2009 does anyone have an updated link or can attach the files ? Link to comment Share on other sites More sharing options...
Dan M Posted May 25, 2009 Share Posted May 25, 2009 The PHP code is in this post.. http://clientforums.tcadmin.com/showpost.php?p=35069&postcount=1 Just save the respective pieces of code as include.php and index.php Link to comment Share on other sites More sharing options...
pjdaley Posted May 25, 2009 Share Posted May 25, 2009 Would someone mind posting a screen shot of this? Link to comment Share on other sites More sharing options...
xpservers Posted May 26, 2009 Share Posted May 26, 2009 The PHP code is in this post.. http://clientforums.tcadmin.com/showpost.php?p=35069&postcount=1 Just save the respective pieces of code as include.php and index.php what about the update with the current players script ? Link to comment Share on other sites More sharing options...
Dan M Posted May 26, 2009 Share Posted May 26, 2009 what about the update with the current players script ? There isn't a download link for that, just add the necessary source code into the necessary files. Link to comment Share on other sites More sharing options...
pjdaley Posted May 26, 2009 Share Posted May 26, 2009 still would like a screen shot.... Link to comment Share on other sites More sharing options...
Dan M Posted May 26, 2009 Share Posted May 26, 2009 I would take a screenshot but I have advanced the script slightly into our backend which we can't show as it contains customer data. Link to comment Share on other sites More sharing options...
pjdaley Posted May 27, 2009 Share Posted May 27, 2009 start>run>mspaint>rectangle tool>color black>highlight customer information>save as "screenshot.jpg>http://clientforums.tcadmin.com/showthread.php?p=38197#post38197>attach screenshot.jpg>post reply ;-) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.