2017-10-27 20:40:30 +02:00
|
|
|
<?php
|
|
|
|
session_start();
|
|
|
|
include_once('../../includes/config.php');
|
|
|
|
include_once('../../includes/functions.php');
|
|
|
|
|
|
|
|
|
2019-07-30 17:05:41 +02:00
|
|
|
if(isset($_POST['interface'])) {
|
2018-08-06 15:02:57 +02:00
|
|
|
$int = preg_replace('/[^a-z0-9]/', '', $_POST['interface']);
|
2017-10-29 19:21:34 +01:00
|
|
|
if(!file_exists(RASPI_CONFIG_NETWORKING.'/'.$int.'.ini')) {
|
|
|
|
touch(RASPI_CONFIG_NETWORKING.'/'.$int.'.ini');
|
2017-10-27 20:40:30 +02:00
|
|
|
}
|
|
|
|
|
2017-10-29 19:21:34 +01:00
|
|
|
$intConfig = parse_ini_file(RASPI_CONFIG_NETWORKING.'/'.$int.'.ini');
|
|
|
|
$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);
|
|
|
|
}
|
|
|
|
|