« Back to History
sidebar.php
|
20260722_120325.php
Initial Domain Snapshot
Copy Code
<?php // assume $pdo and $USER_ROLE ('admin' or 'editor') are available $st = $pdo->prepare(" SELECT * FROM admin_menu WHERE is_active=1 AND (role_required='both' OR role_required=?) ORDER BY section, sort_order "); $st->execute([$USER_ROLE]); $menus = $st->fetchAll(); $current = basename($_SERVER['PHP_SELF']); $sections = []; foreach ($menus as $m) { $sections[$m['section']][] = $m; } ?> <aside class="admin-sidebar"> <div class="brand">Shayari Admin</div> <nav> <?php foreach ($sections as $section=>$items): ?> <h4><?= htmlspecialchars(ucfirst($section)) ?></h4> <?php foreach ($items as $m): ?> <a href="<?= htmlspecialchars($m['link']) ?>" class="<?= $current===$m['link']?'active':'' ?>"> <?= htmlspecialchars($m['label']) ?> </a> <?php endforeach; ?> <?php endforeach; ?> </nav> </aside>