Initial commit
This commit is contained in:
78
logfile.php
Normal file
78
logfile.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
defined(page_security_key) or exit;
|
||||
|
||||
//Check if allowed
|
||||
if (isAllowed('logfile',$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
|
||||
header('location: index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$filelocation = $_SERVER['DOCUMENT_ROOT'].'/log/log_'.date('d').'.txt';
|
||||
$filelocation_webserver = '/var/www/vhosts/veliti.nl/logs/'.$_SERVER['HTTP_HOST'].'/access_ssl_log';
|
||||
|
||||
// Capture post data
|
||||
if (isset($_POST['logfile'])) {
|
||||
// Save templates
|
||||
file_put_contents($filelocation, $_POST['logfile']);
|
||||
header('Location: index.php?page=logfile&success_msg=1');
|
||||
exit;
|
||||
}
|
||||
// Read language_US template PHP file
|
||||
if (file_exists($filelocation)){
|
||||
$contents = file_get_contents($filelocation);
|
||||
} else {$contents = '';}
|
||||
|
||||
if (file_exists($filelocation_webserver)){
|
||||
$contents_webserver = file_get_contents($filelocation_webserver);
|
||||
} else {$contents_webserver = '';}
|
||||
|
||||
// Handle success messages
|
||||
if (isset($_GET['success_msg'])) {
|
||||
if ($_GET['success_msg'] == 1) {
|
||||
$success_msg = 'Updated successfully!';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?=template_header('Log', 'log','view')?>
|
||||
|
||||
<form action="" method="post">
|
||||
|
||||
<div class="content-title responsive-flex-wrap responsive-pad-bot-3">
|
||||
<h2 class="responsive-width-100">Debuglog</h2>
|
||||
<input type="submit" name="submit" value="Save" class="btn">
|
||||
</div>
|
||||
|
||||
<?php if (isset($success_msg)): ?>
|
||||
<div class="msg success">
|
||||
<i class="fas fa-check-circle"></i>
|
||||
<p><?=$success_msg?></p>
|
||||
<i class="fas fa-times"></i>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="tabs">
|
||||
<a href="#" class="active">Application <?php echo date('d'); ?></a>
|
||||
<a href="#" class="">Webserver</a>
|
||||
|
||||
</div>
|
||||
<div class="content-block">
|
||||
<div class="form responsive-width-100">
|
||||
<div class="tab-content active">
|
||||
<label for="Logfile"></label>
|
||||
<textarea name="logfile" id="logfile" style="min-height: 100vh;"><?=$contents?></textarea>
|
||||
</div>
|
||||
<div class="tab-content active">
|
||||
<label for="Logfile"></label>
|
||||
<textarea name="" id="" style="min-height: 100vh;"><?=$contents_webserver?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<script>
|
||||
document.querySelectorAll("input[type='checkbox']").forEach(checkbox => {
|
||||
checkbox.onclick = () => checkbox.value = checkbox.checked ? 'true' : 'false';
|
||||
});
|
||||
</script>
|
||||
|
||||
<?=template_footer()?>
|
||||
Reference in New Issue
Block a user