2017-10-27 20:40:30 +02:00
|
|
|
<?php
|
2019-08-06 21:34:58 +02:00
|
|
|
|
2020-02-15 18:57:46 +01:00
|
|
|
require '../../includes/csrf.php';
|
2019-08-06 21:34:58 +02:00
|
|
|
|
2020-02-15 18:57:46 +01:00
|
|
|
require_once '../../includes/config.php';
|
|
|
|
require_once '../../includes/functions.php';
|
2017-10-27 20:40:30 +02:00
|
|
|
|
|
|
|
|
2019-08-12 12:02:40 +02:00
|
|
|
if (isset($_POST['interface'])) {
|
2018-08-06 15:02:57 +02:00
|
|
|
$int = preg_replace('/[^a-z0-9]/', '', $_POST['interface']);
|
2019-08-12 12:02:40 +02:00
|
|
|
if (!file_exists(RASPI_CONFIG_NETWORKING.'/'.$int.'.ini')) {
|
2017-10-29 19:21:34 +01:00
|
|
|
touch(RASPI_CONFIG_NETWORKING.'/'.$int.'.ini');
|
2017-10-27 20:40:30 +02:00
|
|
|
}
|
|
|
|
|
2019-08-10 12:38:44 +02:00
|
|
|
$intConfig = parse_ini_file(RASPI_CONFIG_NETWORKING.'/'.$int.'.ini', false, INI_SCANNER_RAW);
|
2017-10-29 19:21:34 +01:00
|
|
|
$jsonData = ['return'=>1,'output'=>['intConfig'=>$intConfig]];
|
2017-10-27 20:40:30 +02:00
|
|
|
echo json_encode($jsonData);
|
|
|
|
|
2017-10-29 19:21:34 +01:00
|
|
|
// Todo - get dhcp lease information from `dhcpcd -U eth0` ? maybe ?
|
2017-10-27 20:40:30 +02:00
|
|
|
} else {
|
|
|
|
$jsonData = ['return'=>2,'output'=>['Error getting data']];
|
|
|
|
echo json_encode($jsonData);
|
|
|
|
}
|