Add admin logoff button

This commit is contained in:
hbrain 2026-05-25 22:26:39 +02:00
parent e299afc4ef
commit 446d484296
3 changed files with 12 additions and 2 deletions

10
logout.php Normal file
View file

@ -0,0 +1,10 @@
<?php
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
?>
<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Log off MVLog</title><link rel="stylesheet" href="style.css"></head><body>
<header class="site-header"><a class="brand" href="index.php"><h1>MVLog</h1><p>Bubulescu.Org</p></a></header>
<main><section><p>Logging off…</p><p class="details">If your browser keeps the session, close the browser tab/window.</p></section></main>
<script>
fetch("new.php?logout=1", {headers: {"Authorization": "Basic " + btoa("logout:logout")}, cache: "no-store"}).finally(function(){ location.href = "index.php"; });
</script>
</body></html>

View file

@ -156,7 +156,7 @@ $editDir = null; $editData = ['title'=>'','date'=>'','place'=>'','description'=>
if ($editName !== '') { try { $editDir = safe_input_dir($config['uploads_dir'], $editName); $editData = read_data($editDir); $editFiles = list_files($editDir); } catch (Throwable $e) { $err = $e->getMessage(); } }
?>
<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Admin - <?=h($config['site_name'])?></title><link rel="stylesheet" href="style.css"></head><body>
<header class="site-header admin-header"><nav class="tabs"><a class="<?= $tab==='new'?'active':'' ?>" href="new.php?tab=new">New</a><a class="<?= $tab==='edit'?'active':'' ?>" href="new.php?tab=edit">Edit</a><a class="<?= $tab==='videos'?'active':'' ?>" href="new.php?tab=videos">Videos</a></nav><a class="brand" href="index.php"><h1>MVLog Admin</h1><p>Bubulescu.Org</p></a></header><main>
<header class="site-header admin-header"><nav class="tabs"><a class="<?= $tab==='new'?'active':'' ?>" href="new.php?tab=new">New</a><a class="<?= $tab==='edit'?'active':'' ?>" href="new.php?tab=edit">Edit</a><a class="<?= $tab==='videos'?'active':'' ?>" href="new.php?tab=videos">Videos</a></nav><a class="brand" href="index.php"><h1>MVLog Admin</h1><p>Bubulescu.Org</p></a><a class="logout-link" href="logout.php">Log off</a></header><main>
<?php if($msg): ?><div class="ok"><?=h($msg)?></div><?php endif; ?><?php if($err): ?><div class="err"><?=h($err)?></div><?php endif; ?>
<?php if($tab==='videos'): ?><section><h2>Videos without input dir</h2><?php if(!$orphanVideos): ?><p>No orphan videos.</p><?php endif; ?><div class="admin-list"><?php foreach($orphanVideosPage as $v): $vn=basename($v); ?><form method="post" class="admin-item" onsubmit="return confirm('Delete this generated video?')"><div><strong><?=h($vn)?></strong><br><span><?=h(round(filesize($v)/1048576,1))?> MB</span></div><input type="hidden" name="action" value="delete_video"><input type="hidden" name="video" value="<?=h($vn)?>"><button type="submit">Delete video</button></form><?php endforeach; ?></div><?=page_links('videos',$videoPage,$videoPages)?></section><?php endif; ?>

File diff suppressed because one or more lines are too long