2017-10-27 20:40:30 +02: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'];
|
2018-08-04 01:58:34 +02:00
|
|
|
// FIXME slashes and other forbidden filename characters not stripped. [security]
|
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);
|
|
|
|
}
|
|
|
|
|