1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 10:39:53 +00:00

comment format renewal

This commit is contained in:
Jonas Friedmann 2013-03-28 16:06:49 +01:00 committed by Steve Schnepp
parent 22436814ea
commit 4192c14f76
8 changed files with 250 additions and 172 deletions

View file

@ -1,14 +1,22 @@
#!/usr/bin/php #!/usr/bin/php
<?php <?php
########################################################### /**
## - Bukkit player online Munin plugin - ## * Bukkit player online Munin plugin
########################################################### * ---------------------------------
## Script by: ## *
## Jonas Friedmann (@frdmn) ## * Shows the current online players
## http://blog.frd.mn ## * (parsed via JSONAPI)
########################################################### *
## JSONAPI ## * Read more about my plugins on my blog:
########################################################### * http://s.frd.mn/XJsryR
*
* Author: Jonas Friedmann (http://frd.mn)
*
*/
/**
* JSONAPI configuration
*/
$hostname = 'your-hostname'; $hostname = 'your-hostname';
$username = 'your-username'; $username = 'your-username';
@ -16,9 +24,10 @@ $password = 'your-password';
$salt = 'your-salt'; $salt = 'your-salt';
$port = 20059; $port = 20059;
########################################################### /**
## DON'T EDIT THIS ## * !!! DO NOT EDIT THIS PART BELOW !!!
########################################################### */
if ((count($argv) > 1) && ($argv[1] == 'config')) if ((count($argv) > 1) && ($argv[1] == 'config'))
{ {
print("graph_title Bukkit / JSONAPI - players online print("graph_title Bukkit / JSONAPI - players online
@ -31,16 +40,16 @@ players.label players
exit(); exit();
} }
## Include JSONAPI.php SDK (get this file here: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php) // Include JSONAPI.php SDK (get this file here: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php)
require('/var/cache/munin/JSONAPI.php'); require('/var/cache/munin/JSONAPI.php');
## Prepare API call // Prepare API call
$api = new JSONAPI($hostname, $port, $username, $password, $salt); $api = new JSONAPI($hostname, $port, $username, $password, $salt);
$result = $api->call("getPlayerCount"); $result = $api->call("getPlayerCount");
## Check for success // Check for success
if ($result['result'] == 'success'){ if ($result['result'] == 'success'){
## Print values // Print values
print('players.value ' . $result['success'] . "\n"); print('players.value ' . $result['success'] . "\n");
} }
?> ?>

View file

@ -1,14 +1,22 @@
#!/usr/bin/php #!/usr/bin/php
<?php <?php
########################################################### /**
## - Bukkit RAM usage Munin plugin - ## * Bukkit RAM usage Munin plugin
########################################################### * ---------------------------------
## Script by: ## *
## Jonas Friedmann (@frdmn) ## * Shows the current RAM usage of your Minecraft process
## http://blog.frd.mn ## * an the total RAM (parsed via JSONAPI)
########################################################### *
## JSONAPI ## * Read more about my plugins on my blog:
########################################################### * http://s.frd.mn/XJsryR
*
* Author: Jonas Friedmann (http://frd.mn)
*
*/
/**
* JSONAPI configuration
*/
$hostname = 'your-hostname'; $hostname = 'your-hostname';
$username = 'your-username'; $username = 'your-username';
@ -16,9 +24,10 @@ $password = 'your-password';
$salt = 'your-salt'; $salt = 'your-salt';
$port = 20059; $port = 20059;
########################################################### /**
## DON'T EDIT THIS ## * !!! DO NOT EDIT THIS PART BELOW !!!
########################################################### */
if ((count($argv) > 1) && ($argv[1] == 'config')) if ((count($argv) > 1) && ($argv[1] == 'config'))
{ {
print("graph_title Bukkit / JSONAPI - RAM usage print("graph_title Bukkit / JSONAPI - RAM usage
@ -33,10 +42,10 @@ used.type GAUGE
exit(); exit();
} }
## Include JSONAPI.php SDK (get this file here: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php) // Include JSONAPI.php SDK (get this file here: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php)
require('/var/cache/munin/JSONAPI.php'); require('/var/cache/munin/JSONAPI.php');
## Prepare API call // Prepare API call
$api = new JSONAPI($hostname, $port, $username, $password, $salt); $api = new JSONAPI($hostname, $port, $username, $password, $salt);
$result = $api->callMultiple(array( $result = $api->callMultiple(array(
"system.getJavaMemoryUsage", "system.getJavaMemoryUsage",
@ -46,9 +55,9 @@ $result = $api->callMultiple(array(
array(), array(),
)); ));
## Check for success // Check for success
if ($result['result'] == 'success'){ if ($result['result'] == 'success'){
## Print values // Print values
print('used.value ' . round($result['success'][0]['success']/1000,2) . "\n"); print('used.value ' . round($result['success'][0]['success']/1000,2) . "\n");
print('total.value ' . round($result['success'][1]['success']/1000,2) . "\n"); print('total.value ' . round($result['success'][1]['success']/1000,2) . "\n");
} }

View file

@ -1,14 +1,22 @@
#!/usr/bin/php #!/usr/bin/php
<?php <?php
########################################################### /**
## - Bukkit TPS Munin plugin - ## * Bukkit TPS Munin plugin
########################################################### * ---------------------------------
## Script by: ## *
## Jonas Friedmann (@frdmn) ## * Shows the current TPS (ticks per second) of your
## http://blog.frd.mn ## * Minecraft server (parsed via JSONAPI)
########################################################### *
## JSONAPI ## * Read more about my plugins on my blog:
########################################################### * http://s.frd.mn/XJsryR
*
* Author: Jonas Friedmann (http://frd.mn)
*
*/
/**
* JSONAPI configuration
*/
$hostname = 'your-hostname'; $hostname = 'your-hostname';
$username = 'your-username'; $username = 'your-username';
@ -16,9 +24,10 @@ $password = 'your-password';
$salt = 'your-salt'; $salt = 'your-salt';
$port = 20059; $port = 20059;
########################################################### /**
## DON'T EDIT THIS ## * !!! DO NOT EDIT THIS PART BELOW !!!
########################################################### */
if ((count($argv) > 1) && ($argv[1] == 'config')) if ((count($argv) > 1) && ($argv[1] == 'config'))
{ {
print("graph_title Bukkit / JSONAPI - ticks per second (TPS) print("graph_title Bukkit / JSONAPI - ticks per second (TPS)
@ -31,16 +40,16 @@ tps.label TPS
exit(); exit();
} }
## Include JSONAPI.php SDK (get this file here: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php) // Include JSONAPI.php SDK (get this file here: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php)
require('/var/cache/munin/JSONAPI.php'); require('/var/cache/munin/JSONAPI.php');
## Prepare API call // Prepare API call
$api = new JSONAPI($hostname, $port, $username, $password, $salt); $api = new JSONAPI($hostname, $port, $username, $password, $salt);
$result = $api->call("system.getServerClockDebug"); $result = $api->call("system.getServerClockDebug");
## Check for success // Check for success
if ($result['result'] == 'success'){ if ($result['result'] == 'success'){
## Print values // Print values
print('tps.value ' . round($result['success']['clockRate'], 2) . "\n"); print('tps.value ' . round($result['success']['clockRate'], 2) . "\n");
} }
?> ?>

View file

@ -1,14 +1,23 @@
#!/usr/bin/php #!/usr/bin/php
<?php <?php
########################################################### /**
## - Bukkit hostile mob kills per day Munin plugin - ## * Bukkit/MySQL Munin plugin
########################################################### * ---------------------------------
## Script by: ## * Hostile mob kills per day
## Jonas Friedmann (@frdmn) ## *
## http://frd.mn ## * Shows the daily kills of hostile mobs
########################################################### * via Statistician (http://s.frd.mn/14qKXTM)
## MySQL ## *
########################################################### * Read more about my plugins on my blog:
* http://s.frd.mn/XJsryR
*
* Author: Jonas Friedmann (http://frd.mn)
*
*/
/**
* MySQL configuration
*/
$hostname = 'localhost'; $hostname = 'localhost';
$username = 'sql'; $username = 'sql';
@ -16,9 +25,10 @@ $password = 'pass';
$database = 'sql'; $database = 'sql';
$port = 3306; $port = 3306;
########################################################### /**
## DON'T EDIT THIS ## * !!! DO NOT EDIT THIS PART BELOW !!!
########################################################### */
if ((count($argv) > 1) && ($argv[1] == 'config')) if ((count($argv) > 1) && ($argv[1] == 'config'))
{ {
print("graph_title Bukkit / Statistician - hostile mob kills per day print("graph_title Bukkit / Statistician - hostile mob kills per day

View file

@ -1,14 +1,23 @@
#!/usr/bin/php #!/usr/bin/php
<?php <?php
########################################################### /**
## - Bukkit neutral mob kills per day Munin plugin - ## * Bukkit/MySQL Munin plugin
########################################################### * ---------------------------------
## Script by: ## * Neutral mob kills per day
## Jonas Friedmann (@frdmn) ## *
## http://frd.mn ## * Shows the daily kills of neutral mobs
########################################################### * via Statistician (http://s.frd.mn/14qKXTM)
## MySQL ## *
########################################################### * Read more about my plugins on my blog:
* http://s.frd.mn/XJsryR
*
* Author: Jonas Friedmann (http://frd.mn)
*
*/
/**
* MySQL configuration
*/
$hostname = 'localhost'; $hostname = 'localhost';
$username = 'sql'; $username = 'sql';
@ -16,9 +25,10 @@ $password = 'pass';
$database = 'sql'; $database = 'sql';
$port = 3306; $port = 3306;
########################################################### /**
## DON'T EDIT THIS ## * !!! DO NOT EDIT THIS PART BELOW !!!
########################################################### */
if ((count($argv) > 1) && ($argv[1] == 'config')) if ((count($argv) > 1) && ($argv[1] == 'config'))
{ {
print("graph_title Bukkit / Statistician - neutral mob kills per day print("graph_title Bukkit / Statistician - neutral mob kills per day
@ -37,43 +47,43 @@ snowman.label killed snowmen
exit(); exit();
} }
## Construct 'minumum' timstamp // Construct 'minumum' timstamp
$current = mktime(); $current = mktime();
$today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current)); $today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current));
## Initiate connection // Initiate connection
$connection = mysqli_connect($hostname, $username, $password, $database, $port); $connection = mysqli_connect($hostname, $username, $password, $database, $port);
## Check connection // Check connection
if (mysqli_connect_errno()) { if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error()); printf("Connect failed: %s\n", mysqli_connect_error());
exit(); exit();
} }
## Select queries for enderman and return the amount of rows // Select queries for enderman and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Enderman'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Enderman'")) {
## Print values // Print values
print('enderman.value ' . mysqli_num_rows($result) . "\n"); print('enderman.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for wolf kills and return the amount of rows // Select queries for wolf kills and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Wolf'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Wolf'")) {
## Print values // Print values
print('wolf.value ' . mysqli_num_rows($result) . "\n"); print('wolf.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for zombie pigman kills and return the amount of rows // Select queries for zombie pigman kills and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Zombie Pigman'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Zombie Pigman'")) {
## Print values // Print values
print('zombiepigman.value ' . mysqli_num_rows($result) . "\n"); print('zombiepigman.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for zombie snowman kills and return the amount of rows // Select queries for zombie snowman kills and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Snowman'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Snowman'")) {
## Print values // Print values
print('snowman.value ' . mysqli_num_rows($result) . "\n"); print('snowman.value ' . mysqli_num_rows($result) . "\n");
} }
## Close connection // Close connection
mysqli_close($connection); mysqli_close($connection);
?> ?>

View file

@ -1,14 +1,23 @@
#!/usr/bin/php #!/usr/bin/php
<?php <?php
########################################################### /**
## - Bukkit passive mob kills per day Munin plugin - ## * Bukkit/MySQL Munin plugin
########################################################### * ---------------------------------
## Script by: ## * Passive mob kills per day
## Jonas Friedmann (@frdmn) ## *
## http://frd.mn ## * Shows the passive kills of neutral mobs
########################################################### * via Statistician (http://s.frd.mn/14qKXTM)
## MySQL ## *
########################################################### * Read more about my plugins on my blog:
* http://s.frd.mn/XJsryR
*
* Author: Jonas Friedmann (http://frd.mn)
*
*/
/**
* MySQL configuration
*/
$hostname = 'localhost'; $hostname = 'localhost';
$username = 'sql'; $username = 'sql';
@ -16,9 +25,10 @@ $password = 'pass';
$database = 'sql'; $database = 'sql';
$port = 3306; $port = 3306;
########################################################### /**
## DON'T EDIT THIS ## * !!! DO NOT EDIT THIS PART BELOW !!!
########################################################### */
if ((count($argv) > 1) && ($argv[1] == 'config')) if ((count($argv) > 1) && ($argv[1] == 'config'))
{ {
print("graph_title Bukkit / Statistician - passive mob kills per day print("graph_title Bukkit / Statistician - passive mob kills per day
@ -47,73 +57,73 @@ villager.label killed villager
exit(); exit();
} }
## Construct 'minumum' timstamp // Construct 'minumum' timstamp
$current = mktime(); $current = mktime();
$today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current)); $today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current));
## Initiate connection // Initiate connection
$connection = mysqli_connect($hostname, $username, $password, $database, $port); $connection = mysqli_connect($hostname, $username, $password, $database, $port);
## Check connection // Check connection
if (mysqli_connect_errno()) { if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error()); printf("Connect failed: %s\n", mysqli_connect_error());
exit(); exit();
} }
## Select queries for bat kills and return the amount of rows // Select queries for bat kills and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Bat'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Bat'")) {
## Print values // Print values
print('bat.value ' . mysqli_num_rows($result) . "\n"); print('bat.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for chicken kills and return the amount of rows // Select queries for chicken kills and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Chicken'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Chicken'")) {
## Print values // Print values
print('chicken.value ' . mysqli_num_rows($result) . "\n"); print('chicken.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for mooshroom kills and return the amount of rows // Select queries for mooshroom kills and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'MushroomCow'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'MushroomCow'")) {
## Print values // Print values
print('mooshroom.value ' . mysqli_num_rows($result) . "\n"); print('mooshroom.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for cow kills and return the amount of rows // Select queries for cow kills and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Cow'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Cow'")) {
## Print values // Print values
print('cow.value ' . mysqli_num_rows($result) . "\n"); print('cow.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for ocelot kills and return the amount of rows // Select queries for ocelot kills and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Ocelot'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Ocelot'")) {
## Print values // Print values
print('ocelot.value ' . mysqli_num_rows($result) . "\n"); print('ocelot.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for pig kills and return the amount of rows // Select queries for pig kills and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Pig'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Pig'")) {
## Print values // Print values
print('pig.value ' . mysqli_num_rows($result) . "\n"); print('pig.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for sheep and return the amount of rows // Select queries for sheep and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Sheep'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Sheep'")) {
## Print values // Print values
print('sheep.value ' . mysqli_num_rows($result) . "\n"); print('sheep.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for squid kills and return the amount of rows // Select queries for squid kills and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Squid'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Squid'")) {
## Print values // Print values
print('squid.value ' . mysqli_num_rows($result) . "\n"); print('squid.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for villager and return the amount of rows // Select queries for villager and return the amount of rows
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Villager'")) { if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Villager'")) {
## Print values // Print values
print('villager.value ' . mysqli_num_rows($result) . "\n"); print('villager.value ' . mysqli_num_rows($result) . "\n");
} }
## Close connection // Close connection
mysqli_close($connection); mysqli_close($connection);
?> ?>

View file

@ -1,14 +1,23 @@
#!/usr/bin/php #!/usr/bin/php
<?php <?php
########################################################### /**
## - Bukkit new players per day Munin plugin - ## * Bukkit/MySQL Munin plugin
########################################################### * ---------------------------------
## Script by: ## * New players per day
## Jonas Friedmann (@frdmn) ## *
## http://frd.mn ## * Shows the new players / visitors per day
########################################################### * via Statistician (http://s.frd.mn/14qKXTM)
## MySQL ## *
########################################################### * Read more about my plugins on my blog:
* http://s.frd.mn/XJsryR
*
* Author: Jonas Friedmann (http://frd.mn)
*
*/
/**
* MySQL configuration
*/
$hostname = 'localhost'; $hostname = 'localhost';
$username = 'sql'; $username = 'sql';
@ -16,9 +25,10 @@ $password = 'pass';
$database = 'sql'; $database = 'sql';
$port = 3306; $port = 3306;
########################################################### /**
## DON'T EDIT THIS ## * !!! DO NOT EDIT THIS PART BELOW !!!
########################################################### */
if ((count($argv) > 1) && ($argv[1] == 'config')) if ((count($argv) > 1) && ($argv[1] == 'config'))
{ {
print("graph_title Bukkit / Statistician - new players per day print("graph_title Bukkit / Statistician - new players per day
@ -31,25 +41,25 @@ players.label new players
exit(); exit();
} }
## Construct 'minumum' timstamp // Construct 'minumum' timstamp
$current = mktime(); $current = mktime();
$today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current)); $today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current));
## Initiate connection // Initiate connection
$connection = mysqli_connect($hostname, $username, $password, $database, $port); $connection = mysqli_connect($hostname, $username, $password, $database, $port);
## Check connection // Check connection
if (mysqli_connect_errno()) { if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error()); printf("Connect failed: %s\n", mysqli_connect_error());
exit(); exit();
} }
## Select queries return the amount of rows // Select queries return the amount of rows
if ($result = mysqli_query($connection, "SELECT player_name FROM players WHERE firstever_login > $today")) { if ($result = mysqli_query($connection, "SELECT player_name FROM players WHERE firstever_login > $today")) {
## Print values // Print values
print('players.value ' . mysqli_num_rows($result) . "\n"); print('players.value ' . mysqli_num_rows($result) . "\n");
} }
## Close connection // Close connection
mysqli_close($connection); mysqli_close($connection);
?> ?>

View file

@ -1,14 +1,24 @@
#!/usr/bin/php #!/usr/bin/php
<?php <?php
########################################################### /**
## - Bukkit shame per day Munin plugin - ## * Bukkit/MySQL Munin plugin
########################################################### * ---------------------------------
## Script by: ## * Kicks/bans/jails/etc. per day
## Jonas Friedmann (@frdmn) ## *
## http://frd.mn ## * Shows the amount and kind of shame that
########################################################### * happens on your server via Ultrabans
## MySQL ## * (http://s.frd.mn/14qLR2B)
########################################################### *
* Read more about my plugins on my blog:
* http://s.frd.mn/XJsryR
*
* Author: Jonas Friedmann (http://frd.mn)
*
*/
/**
* MySQL configuration
*/
$hostname = 'localhost'; $hostname = 'localhost';
$username = 'sql'; $username = 'sql';
@ -16,9 +26,10 @@ $password = 'pass';
$database = 'sql'; $database = 'sql';
$port = 3306; $port = 3306;
########################################################### /**
## DON'T EDIT THIS ## * !!! DO NOT EDIT THIS PART BELOW !!!
########################################################### */
if ((count($argv) > 1) && ($argv[1] == 'config')) if ((count($argv) > 1) && ($argv[1] == 'config'))
{ {
print("graph_title Bukkit / Ultrabans - shame per day print("graph_title Bukkit / Ultrabans - shame per day
@ -47,76 +58,76 @@ mute.label mutes
exit(); exit();
} }
## Construct 'minumum' timstamp // Construct 'minumum' timstamp
$current = mktime(); $current = mktime();
$today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current)); $today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current));
## Initiate connection // Initiate connection
$connection = mysqli_connect($hostname, $username, $password, $database, $port); $connection = mysqli_connect($hostname, $username, $password, $database, $port);
## Check connection // Check connection
if (mysqli_connect_errno()) { if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error()); printf("Connect failed: %s\n", mysqli_connect_error());
exit(); exit();
} }
## Select queries for unbans return the amount of rows // Select queries for unbans return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 5 AND time > $today")) { if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 5 AND time > $today")) {
## Print values // Print values
print('unban.value ' . mysqli_num_rows($result) . "\n"); print('unban.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for kicks return the amount of rows // Select queries for kicks return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 3 AND time > $today")) { if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 3 AND time > $today")) {
## Print values // Print values
print('kick.value ' . mysqli_num_rows($result) . "\n"); print('kick.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for warnings return the amount of rows // Select queries for warnings return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 2 AND time > $today")) { if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 2 AND time > $today")) {
## Print values // Print values
print('warning.value ' . mysqli_num_rows($result) . "\n"); print('warning.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for bans return the amount of rows // Select queries for bans return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 0 AND time > $today")) { if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 0 AND time > $today")) {
## Print values // Print values
print('ban.value ' . mysqli_num_rows($result) . "\n"); print('ban.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for ipbans return the amount of rows // Select queries for ipbans return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 1 AND time > $today")) { if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 1 AND time > $today")) {
## Print values // Print values
print('ipban.value ' . mysqli_num_rows($result) . "\n"); print('ipban.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for fines return the amount of rows // Select queries for fines return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 4 AND time > $today")) { if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 4 AND time > $today")) {
## Print values // Print values
print('fine.value ' . mysqli_num_rows($result) . "\n"); print('fine.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for jails return the amount of rows // Select queries for jails return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 6 AND time > $today")) { if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 6 AND time > $today")) {
## Print values // Print values
print('jail.value ' . mysqli_num_rows($result) . "\n"); print('jail.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for permbans return the amount of rows // Select queries for permbans return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 9 AND time > $today")) { if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 9 AND time > $today")) {
## Print values // Print values
print('permban.value ' . mysqli_num_rows($result) . "\n"); print('permban.value ' . mysqli_num_rows($result) . "\n");
} }
## Select queries for mutes - part 1 return the amount of rows // Select queries for mutes - part 1 return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 7 AND time > $today")) { if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 7 AND time > $today")) {
## Store result // Store result
$tmp1 = mysqli_num_rows($result); $tmp1 = mysqli_num_rows($result);
} }
## Select queries for mutes - part 2 return the amount of rows // Select queries for mutes - part 2 return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 8 AND time > $today")) { if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 8 AND time > $today")) {
## Store result // Store result
$tmp2 = mysqli_num_rows($result); $tmp2 = mysqli_num_rows($result);
} }
@ -124,6 +135,6 @@ $mutes = $tmp1 + $tmp2;
print('mute.value ' . $mutes . "\n"); print('mute.value ' . $mutes . "\n");
## Close connection // Close connection
mysqli_close($connection); mysqli_close($connection);
?> ?>