forked from agperson/zabbix-webroots-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.php
32 lines (30 loc) · 1.06 KB
/
data.php
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
29
30
31
32
<?php
require 'lib/php/config.php';
require 'lib/php/zabbix-connect.php';
# Get inputs and filter them
$type = filter_input(INPUT_GET, 'type', FILTER_SANITIZE_STRING);
$service = filter_input(INPUT_GET, 'service', FILTER_SANITIZE_STRING);
$port = filter_input(INPUT_GET, 'port', FILTER_SANITIZE_NUMBER_INT);
$host_ids = filter_input(INPUT_GET, 'hosts', FILTER_SANITIZE_NUMBER_FLOAT, array('flags' => FILTER_FLAG_ALLOW_THOUSAND));
$host_ids = explode(',', $host_ids);
# Ensure values passed validation
if($type == "host") {
if(!is_array($host_ids)) {
print "<strong>Invalid or missing request data.</strong>";
exit;
} else {
require 'data-node.php';
exit;
}
} elseif($type == "service") {
if($service == "" || $port == "" || !is_array($host_ids)) {
print "<strong>Invalid or missing request data.</strong>";
exit;
} else {
require 'data-service.php';
exit;
}
} else {
print "<strong>Invalid request type</strong> ($type $service $port $host_ids).";
exit;
}