Moved files to new directories to allow for more logical organization (and for easier use on my side).

This commit is contained in:
Tristan Ancelet 2023-05-13 13:17:50 -05:00
parent 8c686409be
commit 0bfb668e95
5 changed files with 63 additions and 57 deletions

5
api/crontab_stats.php Normal file
View File

@ -0,0 +1,5 @@
<?php
echo "Total Crontabs:<br>";
$crontab_counts=shell_exec('./count-crontabs.sh');
echo "$crontab_counts";
?>

58
api/table.php Normal file
View File

@ -0,0 +1,58 @@
<?php
/*
This endpoint will get specific tables from the db
Args will be:
name: Table Name
limit: number of entries to return (default all)
*/
if ( ! array_key_exists("name", $_GET) ){
echo "A tablename was not provided with the request";
return 1;
} else {
$name=$_GET['name'];
}
if ( array_key_exists("limit", $_GET)){
$limit=$_GET['limit'];
} else {
$limit=0;
}
$query_modifier="";
if (filter_var($limit, FILTER_VALIDATE_INT)){
if ($limit > 0){
$query_modifier="WHERE LIMIT $limit";
}
}else {
$query_modifier="";
}
$db = new SQLite3("../../webcron.db");
$res = $db->query("SELECT * FROM $name $query_modifier");
echo '<div class="wrapper bordered center_text">';
echo '<div class="log_table bordered">';
echo '<div class="table_row">';
$counter=0;
for ($i = 0; $i < $res->numColumns(); $i++ ){
echo "<div class=\"table_header\">{$res->columnName($i)}</div>";
$counter++;
}
echo '</div>';
while ($row = $res->fetchArray()){
echo "<div class=\"table_row\">";
for ($i = 0; $i < $counter; $i++){
echo "<div class=\"table_cell\">{$row[$i]}</div>";
}
echo "</div>";
}
echo '</div>';
echo '</div>';
?>

View File

@ -1,57 +0,0 @@
<!Doctype html>
<html>
<head>
<!-- <script src="https://cdn.tailwindcss.com"></script> -->
<link rel="stylesheet" href="css/main.css">
<script src="main.js"> </script>
<title>This is a test</title>
</head>
<body>
<nav>
<a class="nav-button" href='/'>Logs/Statistics</a>
<a class="nav-button" href='/crontabs.php'>Crontab Management</a>
<a class="nav-button" href='contact.php'>Contact</a>
</nav>
<div class="content_area bordered rounded_border">
<div class="menu_bar bordered_right cell">
<button class="menu_button"> Check Logs </button>
<button class="menu_button"> View Crontab Statistics</button>
<button class="menu_button" onclick="setInfoSection()"> View Database Version</button>
</div>
<div id="content" class="content cell">
Total Crontabs:<br>
<?php
$crontab_counts=shell_exec('./count-crontabs.sh');
echo "$crontab_counts";
?>
</div>
<div class="double_width_menu_bar bordered_left cell">
<div class="wrapper bordered center_text">
All Crontabs
<div id="log_statistics_table" class="log_table bordered">
<div class="table_row">
<div class="table_header">Crontab</div> <div class="table_header">Created At</div><div class="table_header">Last Modified</div>
</div>
<?php
$db = new SQLite3('../webcron.db');
$res = $db->query("SELECT crontab_path, crontab_created_timestamp, crontab_modified_timestamp FROM crontabs;");
while ($row = $res->fetchArray()){
echo "<div class=\"table_row\">";
echo "<div class=\"table_cell\">{$row['crontab_path']}</div> <div class=\"table_cell\">{$row['crontab_created_timestamp']}</div><div class=\"table_cell\">{$row['crontab_modified_timestamp']}</div>";
echo "</div>";
}
?>
</div>
</div>
</div>
</div>
</body>
</html>

0
pages/login.php Normal file
View File