Initial Commit
This commit is contained in:
72
logs/postgres.php
Normal file
72
logs/postgres.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Archivos de log Postgres</title>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
|
||||
integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
<?php
|
||||
$ruta = "../";
|
||||
include '../import/html_css_files.php';
|
||||
include '../import/html_header.php';
|
||||
|
||||
html_header(
|
||||
"Archivos de log Postgres",
|
||||
"Archivos de log Postgres",
|
||||
);
|
||||
?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main class="content marco">
|
||||
<form method="POST" class="mb-3">
|
||||
<label for="logDay">Select a day:</label>
|
||||
<select name="logDay" id="logDay" class="form-control">
|
||||
|
||||
<option value="Mon">Monday</option>
|
||||
<option value="Tue">Tuesday</option>
|
||||
<option value="Wed">Wednesday</option>
|
||||
<option value="Thu">Thursday</option>
|
||||
<option value="Fri">Friday</option>
|
||||
<option value="Sat">Saturday</option>
|
||||
<option value="Sun">Sunday</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-primary mt-2">View Log</button>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$password = 'admin';
|
||||
echo "Output: <pre>" . shell_exec("sh ../pgsql-log/get-logs.sh 2>&1") . "</pre>";
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['logDay'])) {
|
||||
$fileName = "../pgsql-log/postgresql-{$_POST['logDay']}.log";
|
||||
echo "<h3>Log file for {$_POST['logDay']}:</h3>";
|
||||
echo "<p>File path: $fileName</p>";
|
||||
|
||||
// execute a command in the shell: sudo sh get-logs.sh
|
||||
|
||||
|
||||
if (file_exists($fileName)) {
|
||||
$fileContents = file_get_contents($fileName);
|
||||
echo "<pre>" . htmlspecialchars($fileContents) . "</pre>";
|
||||
} else {
|
||||
echo "Log file for " . $_POST['logDay'] . " does not exist.";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</main>
|
||||
<?php
|
||||
include "../import/html_footer.php";
|
||||
?>
|
||||
<script src="<?= $ruta ?? '' ?>js/jquery.min.js"></script>
|
||||
<script src="<?= $ruta ?? '' ?>js/bootstrap/bootstrap.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user