add header and dashboard

This commit is contained in:
Chester Bak 2024-07-22 15:20:40 +07:00
parent c19fae358a
commit ccd57f7fdf
3 changed files with 36 additions and 0 deletions

View File

@ -9,6 +9,8 @@ mapfile -t lines < <(crontab -l |grep -v '^#' |grep ' *\s/var/www/stream ')
#echo "User: $1" #echo "User: $1"
#now=$(date '+%Y-%m-%d %H:%M') #now=$(date '+%Y-%m-%d %H:%M')
#retrieve and display cron entries
crondisplay() {
for line in "${lines[@]}" for line in "${lines[@]}"
do do
#tag=${line##* } _=${tag#*.} dt="${_:0:10} ${_:11:2}:${_:13:2}" _=${_:16} user=${_%%[@:]*} #tag=${line##* } _=${tag#*.} dt="${_:0:10} ${_:11:2}:${_:13:2}" _=${_:16} user=${_%%[@:]*}
@ -18,3 +20,5 @@ do
dt=$(printf "%02d:%02d %s %d" $h $m $(date -d 2022-$M-01 +%B) $d) dt=$(printf "%02d:%02d %s %d" $h $m $(date -d 2022-$M-01 +%B) $d)
[[ -z $1 || $user = $1 ]] && printf "%-20s %s\n" "$dt" $tag [[ -z $1 || $user = $1 ]] && printf "%-20s %s\n" "$dt" $tag
done |sort done |sort
}
crondisplay 2>&1 |tee ./web/log.txt

3
web/dashboard.php Normal file
View File

@ -0,0 +1,3 @@
<?php
include_once 'header.php';
echo nl2br(file_get_contents( "log.txt" ));

29
web/header.php Normal file
View File

@ -0,0 +1,29 @@
<?php
require "check.php";
$user=@$_SESSION['user'];
if(empty($user)){
header('Location: login.php');
}
print('<!DOCTYPE html>
<meta charset="utf-8">
<title>Stream Upload</title>
<link rel="icon" href="favicon.png">
<link rel="stylesheet" href="page.css">
<script>
function respond(){
const feedback = document.getElementById("response");
feedback.innerHTML = "<b>File is uploading</b>";
}
function filename(){
var name = document.getElementById("name");
name.innerHTML = document.getElementById("input").files[0].name;
name.style.fontWeight = "normal";
}
</script>
<div class="user"><p class="user">User:&nbsp;<b>'.$user.'</b></p><p class="title">Dashboard</p>
<form action="login.php" method="post">
<input id="logoff" type="submit" name="logoff" value="Logoff">
</form></div>');
?>