release 1.1.12
git-svn-id: svn://192.168.202.10@10 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
#
|
||||
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
# 60619-1732 - Added variable filtering to eliminate SQL injection attack threat
|
||||
# - Added required user/pass to gain access to this page
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
@@ -20,6 +25,23 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
|
||||
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
|
||||
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
|
||||
|
||||
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
|
||||
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
|
||||
{
|
||||
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
|
||||
Header("HTTP/1.0 401 Unauthorized");
|
||||
echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# path from root to where ploticus files will be stored
|
||||
$DOCroot = "$WeBServeRRooT/vicidial/ploticus/";
|
||||
|
||||
@@ -73,6 +95,7 @@ echo "<option selected value=\"AM\">AM</option>\n";
|
||||
echo "<option value=\"PM\">PM</option>\n";
|
||||
echo "</SELECT>\n";
|
||||
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
|
||||
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> <a href=\"./server_stats.php\">REPORTS</a> </FONT>\n";
|
||||
echo "</FORM>\n\n";
|
||||
|
||||
echo "<PRE><FONT SIZE=2>\n";
|
||||
@@ -107,7 +130,7 @@ echo "VICIDIAL: Server Performance $NOW_TIME\n";
|
||||
echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
|
||||
echo "---------- TOTALS, PEAKS and AVERAGES\n";
|
||||
|
||||
$stmt="select sysload from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by sysload desc limit 1;";
|
||||
$stmt="select sysload from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "' order by sysload desc limit 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
@@ -115,14 +138,14 @@ $HIGHload = sprintf("%10s", $row[0]);
|
||||
$HIGHmulti = intval($HIGHload / 100);
|
||||
#$HIGHmulti = ($HIGHload / 100);
|
||||
|
||||
$stmt="select AVG(sysload),AVG(channels_total) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
|
||||
$stmt="select AVG(sysload),AVG(channels_total) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$AVGload = sprintf("%10s", $row[0]);
|
||||
$AVGchannels = sprintf("%10s", $row[1]);
|
||||
|
||||
$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
|
||||
$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
@@ -130,13 +153,13 @@ $AVGcpuUSER = sprintf("%10s", $row[0]);
|
||||
$AVGcpuSYSTEM = sprintf("%10s", $row[1]);
|
||||
$AVGcpuIDLE = sprintf("%10s", $row[2]);
|
||||
|
||||
$stmt="select usedram from server_performance where start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group' order by usedram desc limit 1;";
|
||||
$stmt="select usedram from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "' order by usedram desc limit 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$USEDram = sprintf("%10s", $row[0]);
|
||||
|
||||
$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365','8366','8367') and start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' and server_ip='$group';";
|
||||
$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365','8366','8367') and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
@@ -173,7 +196,7 @@ $PNGfile = "$group$query_date$shift$filedate$PNG";
|
||||
$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
|
||||
$DATfp = fopen ("$DOCroot/$DATfile", "a");
|
||||
|
||||
$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='$group' and start_time <= '$query_date_END' and start_time >= '$query_date_BEGIN' order by timex;";
|
||||
$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='" . mysql_real_escape_string($group) . "' and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' order by timex;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rows_to_print = mysql_num_rows($rslt);
|
||||
|
||||
Reference in New Issue
Block a user