-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinc.requests.php
More file actions
28 lines (23 loc) · 1.01 KB
/
inc.requests.php
File metadata and controls
28 lines (23 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
$pageNameIO = "inc.requests.php";
$currentConnections = 0;
$currentServerLoad = 0;
if(!$mySQLiConn->connect_error){
$selectCurrentConnections = "SELECT COUNT(`USER`) AS `Connections` FROM `INFORMATION_SCHEMA`.`PROCESSLIST` WHERE `USER` = '" . $dbReader . "'";
if($resultCurrentConnections = $mySQLiConn->query($selectCurrentConnections)){
if($resultCurrentConnections->num_rows > 0){
while($rowCurrentConnections = $resultCurrentConnections->fetch_assoc()){
$currentConnections = $rowCurrentConnections["Connections"];
}
}
$resultCurrentConnections->free();
}
if($currentConnections > 1){
$currentConnections --;
}
$mysqliStats = explode(" ", $mySQLiConn->stat());
$currentServerLoad = str_ireplace("Queries per second avg: ", "",$mysqliStats[7]);
}else{
writeErrorLog($pageNameIO, "Connect to sql server", "ERROR: (" . $mySQLiConn->connect_error . ")");
}
?>