```php getConnection(); if (isAdmin()) { // Admin dashboard data $statsQueries = [ 'total_reports' => "SELECT COUNT(*) as count FROM reports", 'pending_verifications' => "SELECT COUNT(*) as count FROM verifications WHERE result = 'pending'", 'pending_claims' => "SELECT COUNT(*) as count FROM claims WHERE status = 'pending'", 'total_users' => "SELECT COUNT(*) as count FROM users" ]; $stats = []; foreach ($statsQueries as $key => $query) { $stmt = $connection->prepare($query); $stmt->execute(); $stats[$key] = $stmt->fetch(PDO::FETCH_ASSOC)['count']; } // Recent activities $activitiesQuery = " (SELECT 'report' as type, reportID as id, timestamp as date, 'New report submitted' as description FROM reports ORDER BY timestamp DESC LIMIT 5) UNION (SELECT 'claim' as type, claimId as id, createdAt as date, 'New claim submitted' as description FROM claims ORDER BY createdAt DESC LIMIT 5) ORDER BY date DESC LIMIT 10 "; $activitiesStmt = $connection->prepare($activitiesQuery); $activitiesStmt->execute(); $activities = $activitiesStmt->fetchAll(PDO::FETCH_ASSOC); } elseif (isFinder()) { // Finder dashboard data $userId = $_SESSION['user_id']; // User's reports $reportsQuery = "SELECT * FROM reports WHERE userId = :userId ORDER BY timestamp DESC LIMIT 5"; $reportsStmt = $connection->prepare($reportsQuery); $reportsStmt->bindParam(':userId', $userId); $reportsStmt->execute(); $userReports = $reportsStmt->fetchAll(PDO::FETCH_ASSOC); // Notifications $notificationsQuery = "SELECT * FROM notifications WHERE userId = :userId ORDER BY createdAt DESC LIMIT 5"; $notificationsStmt = $connection->prepare($notificationsQuery); $notificationsStmt->bindParam(':userId', $userId); $notificationsStmt->execute(); $notifications = $notificationsStmt->fetchAll(PDO::FETCH_ASSOC); } elseif (isOwner()) { // Owner dashboard data $userId = $_SESSION['user_id']; // User's claims $claimsQuery = " SELECT c.*, i.description, i.category FROM claims c JOIN items i ON c.itemID = i.itemID WHERE c.ownerUserId = :userId ORDER BY c.createdAt DESC LIMIT 5 "; $claimsStmt = $connection->prepare($claimsQuery); $claimsStmt->bindParam(':userId', $userId); $claimsStmt->execute(); $userClaims = $claimsStmt->fetchAll(PDO::FETCH_ASSOC); // Notifications $notificationsQuery = "SELECT * FROM notifications WHERE userId = :userId ORDER BY createdAt DESC LIMIT 5"; $notificationsStmt = $connection->prepare($notificationsQuery); $notificationsStmt->bindParam(':userId', $userId); $notificationsStmt->execute(); $notifications = $notificationsStmt->fetchAll(PDO::FETCH_ASSOC); } ?> Dashboard - Lost & Found

Dashboard

Welcome back, !

Total Reports

Pending Verifications

Pending Claims

Total Users

Recent Activities

Type Description Date

My Recent Reports

Report ID Location Found Status Date Actions
# View
Submit New Report

Recent Notifications

View All

My Recent Claims

Item Category Status Date Actions
... View
Browse Items

Recent Notifications

View All
```