MMDVM/html/editor.php

81 lines
1.8 KiB
PHP
Raw Permalink Normal View History

2022-08-24 08:10:10 +02:00
<!DOCTYPE html>
<?php
if (!empty($_POST['data'])) {
/*
print_r($_POST);
exit;
*/
$nomfile=$_POST['nomfile'];
$data=$_POST['data'];
$path="/var/www/html/configfile/";
$data=str_replace("<br>","\n",$data);
$data=str_replace("<br />","\n",$data);
$data=strip_tags($data);
$myfile = fopen($path.$nomfile, "w") or die("Enregistrement impossible!");
fwrite($myfile, $data);
fclose($myfile);
$path2="/home/pi/";
//echo "<br>path=".$path.$nomfile."<br>path2=".$path2.$nomfile;
//redemarrage obligatoire
//redirection sur le index.html
echo "<script>alert('Redemarrage Obligatoire!');window.open('index.php','_self');</script>";
exit;
}
?>
<html>
<head>
<script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
!--
tinyMCE.init({
mode : "textareas",
valid_elements : "em/i,strike,u,strong/b,div[align],br,#p[align],-ol[type|compact],-ul[type|compact],-li"
});
//-->
</script>
</head>
<body>
<b>CONFIGURATION WIFI</b>
<br>
<form id="form1" method="post" action="editor.php">
<textarea name="data" id="data" cols="50" rows="15">
<?php
$lines = file("/etc/wpa_supplicant/wpa_supplicant.conf");
foreach($lines as $n => $line){
echo $line."<br>";
}
?>
</textarea>
<input name="nomfile" type="hidden" value="wpa_supplicant.conf">
<br />
<input name="Submit" type="submit" Value="modifier" />
</form>
<br>
<b>CONFIGURATION MMDVM</b>
<br>
<form id="form2" method="post" action="editor.php">
<textarea name="data" id="data2" cols="50" rows="15">
<?php
$lines = file("/etc/mmdvmhost/MMDVM.ini");
foreach($lines as $n => $line){
echo $line."<br>";
}
?>
</textarea>
<input name="nomfile" type="hidden" value="MMDVM.ini">
<br />
<input name="Submit" type="submit" Value="modifier" />
</form>
<input name="Retour" type="button" Value="retour" onclick="javascript:window.open('index.php','_self');"/>
</body>
</html>