Files
2026-09-16 23:20:08 +07:00

43 lines
1.7 KiB
PHP

<?php
// includes/header.php
?>
<header class="topbar">
<div class="topbar-left">
<h2 style="font-size:1.1rem; color:var(--text-main); font-weight:600;">
<span id="date_time" style="font-weight:400; color:var(--text-muted);"></span>
</h2>
</div>
<div class="topbar-right" style="display:flex; align-items:center; gap:1.5rem;">
<div class="user-info" style="text-align:right;">
<div style="font-weight:600;"><?php echo htmlspecialchars($name ?? $account ?? 'User'); ?></div>
<div style="font-size:0.8rem; color:var(--text-muted);"><?php echo htmlspecialchars($position ?? 'เจ้าหน้าที่'); ?></div>
</div>
<a href="logout.php" class="btn" style="background:#fef2f2; color:var(--danger); border:1px solid #fecaca; padding: 0.5rem 1rem;">
ออกจากระบบ
</a>
</div>
</header>
<script>
function date_time(id) {
let date = new Date();
let year = date.getFullYear() + 543;
let month = date.getMonth();
let months = ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'];
let d = date.getDate();
let h = date.getHours();
if(h<10) h = "0"+h;
let m = date.getMinutes();
if(m<10) m = "0"+m;
let s = date.getSeconds();
if(s<10) s = "0"+s;
let result = d + ' ' + months[month] + ' ' + year + ' เวลา ' + h + ':' + m + ':' + s + ' น.';
document.getElementById(id).innerHTML = result;
setTimeout('date_time("'+id+'");', '1000');
return true;
}
window.onload = function() {
date_time('date_time');
};
</script>