mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Initial commit
This commit is contained in:
parent
bfcb420524
commit
0d0aee916e
34
ajax/networking/do_sys_reset.php
Normal file
34
ajax/networking/do_sys_reset.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../../includes/config.php';
|
||||||
|
require_once '../../includes/session.php';
|
||||||
|
require_once '../../includes/functions.php';
|
||||||
|
|
||||||
|
if (isset($_POST['csrf_token'])) {
|
||||||
|
if (csrfValidateRequest() && !CSRFValidate()) {
|
||||||
|
handleInvalidCSRFToken();
|
||||||
|
}
|
||||||
|
$return = 0;
|
||||||
|
$path = "../../config";
|
||||||
|
$configs = array(
|
||||||
|
array("src" => $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();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user