added debugging feature, fix graph misreporting request ranges in header
This commit is contained in:
+31
-18
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
header("Content-Type: image/png");
|
||||
date_default_timezone_set('America/Toronto');
|
||||
include "../../data/config.php";
|
||||
|
||||
@@ -40,25 +41,37 @@ function get_requests($slug){
|
||||
$bot_requests = get_requests("bot_requests");
|
||||
$real_requests = get_requests("real_requests");
|
||||
|
||||
$real_reqs_24h = 0;
|
||||
for($i=0; $i<count($real_requests); $i++){
|
||||
|
||||
if($real_requests[$i][1] !== false){
|
||||
|
||||
$real_reqs_24h += $real_requests[$i][1];
|
||||
}
|
||||
}
|
||||
$real_reqs_8h =
|
||||
array_sum(
|
||||
array_column(
|
||||
array_slice(
|
||||
$real_requests,
|
||||
0,
|
||||
8
|
||||
),
|
||||
1
|
||||
)
|
||||
);
|
||||
|
||||
$real_reqs_72h = 0;
|
||||
for($i=0; $i<count($real_requests); $i++){
|
||||
|
||||
if($real_requests[$i][1] !== false){
|
||||
|
||||
$real_reqs_72h += $real_requests[$i][1];
|
||||
}
|
||||
}
|
||||
$real_reqs_24h =
|
||||
array_sum(
|
||||
array_column(
|
||||
array_slice(
|
||||
$real_requests,
|
||||
0,
|
||||
24
|
||||
),
|
||||
1
|
||||
)
|
||||
);
|
||||
|
||||
header("Content-Type: image/png");
|
||||
$real_reqs_72h =
|
||||
array_sum(
|
||||
array_column(
|
||||
$real_requests,
|
||||
1
|
||||
)
|
||||
);
|
||||
|
||||
include "../../lib/graph_gen.php";
|
||||
$graph = new graph();
|
||||
@@ -75,7 +88,7 @@ if($c > 25){
|
||||
|
||||
echo $graph->render([
|
||||
"title" => "Number of requests within the last 72 hours (non-cummulative)",
|
||||
"subtitle" => date("jS M y @ g:ia", time()) . " || 24h=" . number_format($real_reqs_24h) . ", 72h=" . number_format($real_reqs_72h) . " || " . config::SERVER_NAME,
|
||||
"subtitle" => date("jS M y @ g:ia", time()) . " || 8h=" . number_format($real_reqs_8h) . " - 24h=" . number_format($real_reqs_24h) . " - 72h=" . number_format($real_reqs_72h) . " || " . config::SERVER_NAME,
|
||||
"x_label" => "<= Hours passed =>",
|
||||
"y_label" => "<= Request count/hour =>",
|
||||
"grad_x" => $c,
|
||||
|
||||
Reference in New Issue
Block a user