From 0d0aee916eeb9b500ff9a2c331c1039c7372f8f5 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 4 Apr 2023 22:04:17 +0200 Subject: [PATCH] Initial commit --- ajax/networking/do_sys_reset.php | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 ajax/networking/do_sys_reset.php diff --git a/ajax/networking/do_sys_reset.php b/ajax/networking/do_sys_reset.php new file mode 100644 index 00000000..b5c65481 --- /dev/null +++ b/ajax/networking/do_sys_reset.php @@ -0,0 +1,34 @@ + $path .'/hostapd.conf', "tmp" => "/tmp/hostapddata", "dest" => RASPI_HOSTAPD_CONFIG), + array("src" => $path .'/dhcpcd.conf', "tmp" => "/tmp/dhcpddata", "dest" => RASPI_DHCPCD_CONFIG), + array("src" => $path .'/090_wlan0.conf', "tmp" => "/tmp/dnsmasqdata", "dest" => RASPI_DNSMASQ_PREFIX.'wlan0.conf'), + array("src" => $path .'/090_raspap.conf', "tmp" => "/tmp/dnsmasqdata", "dest" => RASPI_DNSMASQ_PREFIX.'raspap.conf'), + ); + + foreach ($configs as $config) { + try { + $tmp = file_get_contents($config["src"]); + file_put_contents($config["tmp"], $tmp); + system("sudo cp ".$config["tmp"]. " ".$config["dest"]); + } catch (Exception $e) { + $return = $e->getCode(); + } + } + echo json_encode($return); + +} else { + handleInvalidCSRFToken(); +} +