196 lines
8.8 KiB
PHP
196 lines
8.8 KiB
PHP
<?php
|
|
ini_set('display_errors', 1);
|
|
ini_set('display_startup_errors', 1);
|
|
error_reporting(E_ALL);
|
|
?>
|
|
|
|
<?php include('helperpage/writeini.php');?>
|
|
<?php
|
|
$filename = '/settings/wsenconfig.conf';
|
|
if($_SERVER['REQUEST_METHOD'] == 'POST'){
|
|
$filecontent = $_POST;
|
|
if (file_exists($filename)){
|
|
if (!is_writable($filename)) {
|
|
$command = "sudo chmod 666 $filename";
|
|
exec($command);
|
|
}
|
|
$result = write_php_ini($filecontent, $filename);
|
|
if($result === "FALSE"){
|
|
echo "Fail to write file $filename";
|
|
}else {
|
|
$result = shell_exec('sudo /etc/init.d/S51wsen restart 2>&1');
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
|
|
<?php include('partialpage/header.php');?>
|
|
<?php include('partialpage/sidebar.php');?>
|
|
|
|
<!-- !PAGE CONTENT! -->
|
|
<div class="w3-main" style="margin-left:340px;margin-right:40px">
|
|
|
|
<div class="w3-container" style="margin-top:75px">
|
|
<h1 class="w3-jumbo"><b>WSEN config</b></h1>
|
|
<p>Make changes to de WSEN configuration (<?php echo $filename; ?>).</p>
|
|
<div class="w3-row">
|
|
<?php
|
|
if(isset($result)){
|
|
echo "<p>";
|
|
echo nl2br($result);
|
|
echo "</p>";
|
|
}?>
|
|
</div>
|
|
|
|
<!-- WSEN config -->
|
|
<div class="w3-container w3-grey w3-half" id="wsenconfig">
|
|
<form action="/wsenconfig.php" method="POST">
|
|
<?php $settings = parse_ini_file($filename, FALSE, INI_SCANNER_TYPED); ?>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Use PRTG</label>
|
|
<input class="w3-check" type="hidden" name="use_prtg" value="false" >
|
|
<input class="w3-check" type="checkbox" name="use_prtg" value="true"
|
|
<?php if($settings['use_prtg'] == "true"){ echo "checked";}?>>
|
|
</div>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Server address</label>
|
|
<input class="w3-input w3-border" type="text" name="wsenhost" value="<?php echo $settings['wsenhost'] ?>" required>
|
|
</div>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Sensor name</label>
|
|
<input class="w3-input w3-border" type="text" name="sensor" value="<?php echo $settings['sensor'] ?>" required>
|
|
</div>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Interval (minutes)</label>
|
|
<input class="w3-input w3-border" type="number" name="interval" min="1" max="32767" value="<?php echo $settings['interval'] ?>" required>
|
|
</div>
|
|
<!-- Input 1 -->
|
|
<div class="w3-panel w3-light-grey" id="input1">
|
|
<h1 class="w3-xxlarge w3-text-red"><b>Input 1</b></h1>
|
|
<hr style="width:50px;border:5px solid red" class="w3-round">
|
|
<div class="w3-section">
|
|
<label class="w3-label">Enable</label>
|
|
<input class="w3-check" type="hidden" name="input1_enable" value="false" >
|
|
<input class="w3-check" type="checkbox" name="input1_enable" value="true"
|
|
<?php if($settings['input1_enable'] == "true"){ echo "checked";}?>>
|
|
</div>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Channel name</label>
|
|
<input class="w3-input w3-border" type="text" name="input1_name" value="<?php echo $settings['input1_name'] ?>" required>
|
|
</div>
|
|
</div>
|
|
<!-- Input 2 -->
|
|
<div class="w3-panel w3-light-grey" id="input2">
|
|
<h1 class="w3-xxlarge w3-text-red"><b>Input 2</b></h1>
|
|
<hr style="width:50px;border:5px solid red" class="w3-round">
|
|
<div class="w3-section">
|
|
<label class="w3-label">Enable</label>
|
|
<input class="w3-check" type="hidden" name="input2_enable" value="false" >
|
|
<input class="w3-check" type="checkbox" name="input2_enable" value="true"
|
|
<?php if($settings['input2_enable'] == "true"){ echo "checked";}?>>
|
|
</div>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Channel name</label>
|
|
<input class="w3-input w3-border" type="text" name="input2_name" value="<?php echo $settings['input2_name'] ?>" required>
|
|
</div>
|
|
</div>
|
|
<!-- Input 3 -->
|
|
<div class="w3-panel w3-light-grey" id="input3">
|
|
<h1 class="w3-xxlarge w3-text-red"><b>Input 3</b></h1>
|
|
<hr style="width:50px;border:5px solid red" class="w3-round">
|
|
<div class="w3-section">
|
|
<label class="w3-label">Enable</label>
|
|
<input class="w3-check" type="hidden" name="input3_enable" value="false" >
|
|
<input class="w3-check" type="checkbox" name="input3_enable" value="true"
|
|
<?php if($settings['input3_enable'] == "true"){ echo "checked";}?>>
|
|
</div>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Channel name</label>
|
|
<input class="w3-input w3-border" type="text" name="input3_name" value="<?php echo $settings['input3_name'] ?>" required>
|
|
</div>
|
|
</div>
|
|
<!-- Input 4 -->
|
|
<div class="w3-panel w3-light-grey" id="input4">
|
|
<h1 class="w3-xxlarge w3-text-red"><b>Input 4</b></h1>
|
|
<hr style="width:50px;border:5px solid red" class="w3-round">
|
|
<div class="w3-section">
|
|
<label class="w3-label">Enable</label>
|
|
<input class="w3-check" type="hidden" name="input4_enable" value="false" >
|
|
<input class="w3-check" type="checkbox" name="input4_enable" value="true"
|
|
<?php if($settings['input4_enable'] == "true"){ echo "checked";}?>>
|
|
</div>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Channel name</label>
|
|
<input class="w3-input w3-border" type="text" name="input4_name" value="<?php echo $settings['input4_name'] ?>" required>
|
|
</div>
|
|
</div>
|
|
<!-- Input 5 -->
|
|
<div class="w3-panel w3-light-grey" id="input5">
|
|
<h1 class="w3-xxlarge w3-text-red"><b>Input 5</b></h1>
|
|
<hr style="width:50px;border:5px solid red" class="w3-round">
|
|
<div class="w3-section">
|
|
<label class="w3-label">Enable</label>
|
|
<input class="w3-check" type="hidden" name="input5_enable" value="false" >
|
|
<input class="w3-check" type="checkbox" name="input5_enable" value="true"
|
|
<?php if($settings['input5_enable'] == "true"){ echo "checked";}?>>
|
|
</div>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Channel name</label>
|
|
<input class="w3-input w3-border" type="text" name="input5_name" value="<?php echo $settings['input5_name'] ?>" required>
|
|
</div>
|
|
</div>
|
|
<!-- Input 6 -->
|
|
<div class="w3-panel w3-light-grey" id="input6">
|
|
<h1 class="w3-xxlarge w3-text-red"><b>Input 6</b></h1>
|
|
<hr style="width:50px;border:5px solid red" class="w3-round">
|
|
<div class="w3-section">
|
|
<label class="w3-label">Enable</label>
|
|
<input class="w3-check" type="hidden" name="input6_enable" value="false" >
|
|
<input class="w3-check" type="checkbox" name="input6_enable" value="true"
|
|
<?php if($settings['input6_enable'] == "true"){ echo "checked";}?>>
|
|
</div>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Channel name</label>
|
|
<input class="w3-input w3-border" type="text" name="input6_name" value="<?php echo $settings['input6_name'] ?>" required>
|
|
</div>
|
|
</div>
|
|
<!-- Input 7 -->
|
|
<div class="w3-panel w3-light-grey" id="input7">
|
|
<h1 class="w3-xxlarge w3-text-red"><b>Input 7</b></h1>
|
|
<hr style="width:50px;border:5px solid red" class="w3-round">
|
|
<div class="w3-section">
|
|
<label class="w3-label">Enable</label>
|
|
<input class="w3-check" type="hidden" name="input7_enable" value="false" >
|
|
<input class="w3-check" type="checkbox" name="input7_enable" value="true"
|
|
<?php if($settings['input7_enable'] == "true"){ echo "checked";}?>>
|
|
</div>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Channel name</label>
|
|
<input class="w3-input w3-border" type="text" name="input7_name" value="<?php echo $settings['input7_name'] ?>" required>
|
|
</div>
|
|
</div>
|
|
<!-- Input 8 -->
|
|
<div class="w3-panel w3-light-grey" id="input8">
|
|
<h1 class="w3-xxlarge w3-text-red"><b>Input 8</b></h1>
|
|
<hr style="width:50px;border:5px solid red" class="w3-round">
|
|
<div class="w3-section">
|
|
<label class="w3-label">Enable</label>
|
|
<input class="w3-check" type="hidden" name="input8_enable" value="false" >
|
|
<input class="w3-check" type="checkbox" name="input8_enable" value="true"
|
|
<?php if($settings['input8_enable'] == "true"){ echo "checked";}?>>
|
|
</div>
|
|
<div class="w3-section">
|
|
<label class="w3-label">Channel name</label>
|
|
<input class="w3-input w3-border" type="text" name="input8_name" value="<?php echo $settings['input8_name'] ?>" required>
|
|
</div>
|
|
</div>
|
|
<button type="submit" class="w3-button w3-block w3-padding-large w3-red w3-margin-bottom">Save Config</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- End page content -->
|
|
</div>
|
|
|
|
<?php include('partialpage/footer.php');?>
|