Files
H1502_website/acsreaderlog.php
2019-08-14 15:01:16 +02:00

56 lines
1.8 KiB
PHP

<?php include('partialpage/header.php');?>
<?php include('partialpage/sidebar.php');?>
<?php
$filename = "/var/log/acsreader.log";
if($_SERVER['REQUEST_METHOD'] == 'POST' ){
if ($_POST['filename']){
if(strpos($_POST['filename'], '-') == false){
$filename = "/var/log/".$_POST['filename'];
}else{
$filename = "/acsreader-log/".$_POST['filename'];
}
}
};
?>
<!-- !PAGE CONTENT! -->
<div class="w3-main" style="margin-left:340px;margin-right:40px">
<!-- acsreaderlog output -->
<div class="w3-container" id="acsreaderlog" style="margin-top:75px">
<h1 class="w3-jumbo"><b>ACSreader Logging</b></h1>
<br>
<div style="border:5px solid red; width:100px" class="w3-round"></div>
<div class="w3-container" id="filelist" style="margin-top:75px">
<div class="w3-col l6">
<form action="acsreaderlog.php" method="post">
<div class="w3-section">
<select name="filename" class="w3-select">
<?php foreach (glob("/acsreader-log/*.*") as $filelistname) {
echo "<option value='".basename($filelistname)."'>".basename($filelistname)."</option>";
}?>
</select>
</div>
<button type="submit" class="w3-button w3-block w3-padding-large w3-red w3-margin-bottom">Read logfile</button>
</form>
</div>
</div>
<p>Logfile from ACSreader (<?php echo $filename;?>).</p>
<div class="w3-section">
<textarea class="w3-input w3-border" type="text" name="acsreaderlog" rows="50">
<?php if (file_exists($filename)) {
echo file_get_contents($filename);
} else {
echo "File ".$filename." not found";
}?></textarea>
</div>
</div>
<!-- End page content -->
</div>
<?php include('partialpage/footer.php');?>