Jump to content
Sign in to follow this  
Roxas

expérimenté Script Server Statistics (STATIC)

Recommended Posts

I share for you these scripts (static) for those who doesnt know oop programming

 

Config
image.png

Script
image.png

Callout
image.png

 

CODE

$host = "192.168.0.100";
$user = "root";
$password = "pwd";
$conn = new mysqli($host, $user, $password);
$contador = 0;

function obtenerCuentas($nombre_tabla){
	global $conn, $contador;
	mysqli_select_db ($conn, $nombre_tabla);
		$result = mysqli_query($conn, "SELECT COUNT(*) FROM account");
		$extraido = mysqli_fetch_array($result);
		$contador=$extraido['0']; 
	return $contador;
}

function obtenerPlayers($nombre_tabla){
	global $conn, $contador;
	mysqli_select_db ($conn, $nombre_tabla);
		$result = mysqli_query($conn, "SELECT COUNT(*) FROM player");
		$extraido = mysqli_fetch_array($result);
		$contador=$extraido['0']; 
	return $contador;
}

function obtenerGremios($nombre_tabla){
	global $conn, $contador;
	mysqli_select_db ($conn, $nombre_tabla);
		$result = mysqli_query($conn, "SELECT COUNT(*) FROM guild");
		$extraido = mysqli_fetch_array($result);
		$contador=$extraido['0']; 
	return $contador;
}

function obtenerOfflineShop($nombre_tabla){
	global $conn, $contador;
	mysqli_select_db ($conn, $nombre_tabla);
		$result = mysqli_query($conn, "SELECT COUNT(*) FROM offline_shop_npc");
		$extraido = mysqli_fetch_array($result);
		$contador=$extraido['0']; 
	return $contador;
}

print obtenerCuentas("account");
print "<br>";
print obtenerPlayers("player");
print "<br>";
print obtenerGremios("player");
print "<br>";
print obtenerOfflineShop("player");

 

 

  • Like 2

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.