Create mtr.php

mtr.php file is created to perform "mtr" functions
This commit is contained in:
Carlos V
2023-08-19 10:19:47 +02:00
committed by GitHub
parent f93b8b2e10
commit e7ff1a7954

40
front/php/server/mtr.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
###################################################################################
# Pi.Alert #
# Open Source Network Guard / WIFI & LAN intrusion detector #
# #
# mtr.php # Front module. Server side. System Information #
###################################################################################
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3 #
# jokob#sk 2022 jokob.sk@gmail.com GNU GPLv3 #
# leiweibau 2022 https://github.com/leiweibau GNU GPLv3 #
# cvc90 2023 https://github.com/cvc90 GNU GPLv3 #
###################################################################################
// Get init.php
require dirname(__FILE__).'/../server/init.php';
// Get IP
$ip = $_GET['ip'];
// Check if IP is valid
if (!filter_var($ip, FILTER_VALIDATE_IP)) {
// Error message
$output = lang('DevDetail_Tab_Tools_Mtr_Error');
// Show the result
echo "<pre>";
echo $output;
echo "</pre>";
exit;
}
// Test with the "Mtr" command
$output = shell_exec("mtr --report -c 4 $ip");
// Show the result
echo "<pre>";
echo $output;
echo "</pre>";
?>