2017-10-27 18:40:30 +00:00
|
|
|
<?php
|
|
|
|
session_start();
|
|
|
|
include_once('../../includes/config.php');
|
|
|
|
include_once('../../includes/functions.php');
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_POST['interface']) && isset($_POST['csrf_token']) && CSRFValidate()) {
|
|
|
|
$int = $_POST['interface'];
|
2017-10-29 18:21:34 +00:00
|
|
|
if(!file_exists(RASPI_CONFIG_NETWORKING.'/'.$int.'.ini')) {
|
|
|
|
touch(RASPI_CONFIG_NETWORKING.'/'.$int.'.ini');
|
2017-10-27 18:40:30 +00:00
|
|
|
}
|
|
|
|
|
2017-10-29 18:21:34 +00:00
|
|
|
$intConfig = parse_ini_file(RASPI_CONFIG_NETWORKING.'/'.$int.'.ini');
|
|
|
|
$jsonData = ['return'=>1,'output'=>['intConfig'=>$intConfig]];
|
2017-10-27 18:40:30 +00:00
|
|
|
echo json_encode($jsonData);
|
|
|
|
|
2017-10-29 18:21:34 +00:00
|
|
|
// Todo - get dhcp lease information from `dhcpcd -U eth0` ? maybe ?
|
|
|
|
|
2017-10-27 18:40:30 +00:00
|
|
|
} else {
|
|
|
|
$jsonData = ['return'=>2,'output'=>['Error getting data']];
|
|
|
|
echo json_encode($jsonData);
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|