0, "resi_valid" => 0, "resi_invalid" => 0, "log_today" => 0, "log_ok" => 0, "log_fail" => 0 ]; $r = $conn->query("SELECT COUNT(*) c, SUM(status='valid') v, SUM(status='invalid') i FROM resi"); if ($r && $row = $r->fetch_assoc()) { $stats["total_resi"] = (int)($row["c"] ?? 0); $stats["resi_valid"] = (int)($row["v"] ?? 0); $stats["resi_invalid"] = (int)($row["i"] ?? 0); } $today = date("Y-m-d"); $r2 = $conn->query(" SELECT COUNT(*) c, SUM(status='berhasil') ok, SUM(status='gagal') fail FROM log_akses WHERE DATE(created_at)='{$today}' "); if ($r2 && $row2 = $r2->fetch_assoc()) { $stats["log_today"] = (int)($row2["c"] ?? 0); $stats["log_ok"] = (int)($row2["ok"] ?? 0); $stats["log_fail"] = (int)($row2["fail"] ?? 0); } // latest logs $latest = $conn->query(" SELECT id, nomor_resi, status, pesan, created_at, foto_path FROM log_akses ORDER BY created_at DESC LIMIT 8 "); ?>
| Waktu | Nomor Resi | Status | Pesan | Foto |
|---|---|---|---|---|
| = htmlspecialchars($x["created_at"]) ?> | = htmlspecialchars($x["nomor_resi"] ?? "-") ?> | Berhasil Gagal | = htmlspecialchars($x["pesan"] ?? "-") ?> |
"
data-caption="= htmlspecialchars(($x["nomor_resi"] ?? "-") . " • " . $x["created_at"]) ?>">
|
| Belum ada log. | ||||