2017-10-27 20:40:30 +02:00
|
|
|
<?php
|
2019-08-06 21:34:58 +02:00
|
|
|
|
2019-08-07 23:21:14 +02:00
|
|
|
require('../../includes/csrf.php');
|
2019-08-06 21:34:58 +02:00
|
|
|
|
2017-10-27 20:40:30 +02:00
|
|
|
include_once('../../includes/config.php');
|
|
|
|
include_once('../../includes/functions.php');
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|