Upload files to "/"
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
// Alias agar halaman admin mudah dibuka lewat /admin_login.php
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
?>
|
||||
+2
-458
@@ -1,460 +1,4 @@
|
||||
<?php
|
||||
include 'koneksi.php';
|
||||
|
||||
$hasil = null;
|
||||
$riwayat = [];
|
||||
$error = '';
|
||||
$nik_input = '';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$nik_input = trim($_POST['nik'] ?? '');
|
||||
|
||||
if (empty($nik_input)) {
|
||||
$error = 'NIK wajib diisi.';
|
||||
} else {
|
||||
$nik_safe = mysqli_real_escape_string($conn, $nik_input);
|
||||
|
||||
// Cari data penduduk
|
||||
$q = mysqli_query($conn, "SELECT * FROM penduduk_miskin WHERE nik = '$nik_safe' LIMIT 1");
|
||||
if ($q && mysqli_num_rows($q) > 0) {
|
||||
$hasil = mysqli_fetch_assoc($q);
|
||||
|
||||
// Ambil riwayat bantuan
|
||||
$qb = mysqli_query($conn, "
|
||||
SELECT jenis_bantuan, jumlah_bantuan, tanggal_bantuan, keterangan
|
||||
FROM bantuan
|
||||
WHERE penduduk_id = {$hasil['id']}
|
||||
ORDER BY tanggal_bantuan DESC
|
||||
");
|
||||
while ($rb = mysqli_fetch_assoc($qb)) {
|
||||
$riwayat[] = $rb;
|
||||
}
|
||||
} else {
|
||||
$error = 'NIK tidak ditemukan dalam sistem. Pastikan NIK yang kamu masukkan sudah benar.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nama_bulan = ['01'=>'Januari','02'=>'Februari','03'=>'Maret','04'=>'April','05'=>'Mei',
|
||||
'06'=>'Juni','07'=>'Juli','08'=>'Agustus','09'=>'September','10'=>'Oktober',
|
||||
'11'=>'November','12'=>'Desember'];
|
||||
|
||||
function formatTanggal($tgl) {
|
||||
global $nama_bulan;
|
||||
if (!$tgl) return '-';
|
||||
$parts = explode('-', $tgl);
|
||||
if (count($parts) !== 3) return $tgl;
|
||||
return $parts[2] . ' ' . ($nama_bulan[$parts[1]] ?? $parts[1]) . ' ' . $parts[0];
|
||||
}
|
||||
|
||||
function formatRupiah($angka) {
|
||||
return 'Rp ' . number_format((int)$angka, 0, ',', '.');
|
||||
}
|
||||
|
||||
$jenis_icon = ['Beras'=>'🌾','Sembako'=>'🛒','Uang Tunai'=>'💰','Pendidikan'=>'📚','Kesehatan'=>'🏥'];
|
||||
$jenis_warna = ['Beras'=>'#f39c12','Sembako'=>'#3498db','Uang Tunai'=>'#27ae60','Pendidikan'=>'#9b59b6','Kesehatan'=>'#e74c3c'];
|
||||
$kategori_warna = ['Miskin Ekstrem'=>'#e74c3c','Miskin'=>'#e67e22','Hampir Miskin'=>'#f1c40f'];
|
||||
$status_warna = ['Sedang'=>'#27ae60','Pernah'=>'#3498db','Belum'=>'#95a5a6'];
|
||||
$status_label = ['Sedang'=>'Sedang Menerima','Pernah'=>'Pernah Menerima','Belum'=>'Belum Menerima'];
|
||||
// Alias untuk jaga-jaga kalau link lama memakai huruf besar C.
|
||||
require __DIR__ . '/cek_bantuan.php';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Cek Status Bantuan - WebGIS Kemiskinan Pontianak</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: 'Segoe UI', Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #1a252f 0%, #2c3e50 40%, #1a6b4a 100%);
|
||||
min-height: 100vh;
|
||||
padding: 30px 16px 50px;
|
||||
color: #2c3e50;
|
||||
position: relative;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
body::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
width: 500px; height: 500px;
|
||||
border-radius: 50%;
|
||||
background: rgba(52, 152, 219, 0.08);
|
||||
top: -150px; left: -150px;
|
||||
pointer-events: none;
|
||||
}
|
||||
body::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
width: 400px; height: 400px;
|
||||
border-radius: 50%;
|
||||
background: rgba(39, 174, 96, 0.08);
|
||||
bottom: -100px; right: -100px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.hero {
|
||||
text-align: center;
|
||||
color: white;
|
||||
margin-bottom: 32px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
.hero .logo { font-size: 52px; margin-bottom: 10px; }
|
||||
.hero h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
|
||||
.hero p { font-size: 14px; color: rgba(255,255,255,0.7); }
|
||||
|
||||
.card {
|
||||
background: white;
|
||||
border-radius: 14px;
|
||||
padding: 28px;
|
||||
box-shadow: 0 10px 40px rgba(0,0,0,0.2);
|
||||
max-width: 580px;
|
||||
margin: 0 auto 22px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* FORM PENCARIAN */
|
||||
.search-label {
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
margin-bottom: 6px;
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
}
|
||||
.search-wrap {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.search-wrap input {
|
||||
flex: 1;
|
||||
padding: 13px 16px;
|
||||
border: 2px solid #ddd;
|
||||
border-radius: 8px;
|
||||
font-size: 15px;
|
||||
outline: none;
|
||||
transition: border 0.2s;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.search-wrap input:focus { border-color: #3498db; }
|
||||
.search-wrap button {
|
||||
padding: 13px 22px;
|
||||
background: #3498db;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.search-wrap button:hover { background: #2980b9; }
|
||||
|
||||
.hint { font-size: 12px; color: #aaa; margin-top: 8px; }
|
||||
|
||||
/* ERROR */
|
||||
.alert-error {
|
||||
background: #fdf0f0;
|
||||
border: 1px solid #f5c6cb;
|
||||
border-left: 4px solid #e74c3c;
|
||||
border-radius: 8px;
|
||||
padding: 14px 16px;
|
||||
color: #721c24;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* PROFIL */
|
||||
.profil-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 18px;
|
||||
border-bottom: 2px solid #f0f0f0;
|
||||
}
|
||||
.profil-foto {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
border: 3px solid #3498db;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.profil-foto-placeholder {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
border-radius: 50%;
|
||||
background: #ecf0f1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 30px;
|
||||
flex-shrink: 0;
|
||||
border: 3px solid #ddd;
|
||||
}
|
||||
.profil-nama { font-size: 20px; font-weight: 700; color: #2c3e50; }
|
||||
.profil-nik { font-size: 13px; color: #888; margin-top: 3px; }
|
||||
|
||||
.badge-status {
|
||||
display: inline-block;
|
||||
padding: 5px 14px;
|
||||
border-radius: 20px;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.info-item {
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
padding: 11px 14px;
|
||||
}
|
||||
.info-item .lbl { font-size: 11px; color: #999; margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.5px; }
|
||||
.info-item .val { font-size: 14px; font-weight: 600; color: #2c3e50; }
|
||||
.info-item.full { grid-column: 1 / -1; }
|
||||
|
||||
/* BADGE KATEGORI */
|
||||
.badge-kategori {
|
||||
display: inline-block;
|
||||
padding: 3px 10px;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* RIWAYAT */
|
||||
.section-title {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #2c3e50;
|
||||
border-bottom: 2px solid #3498db;
|
||||
padding-bottom: 8px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.bantuan-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 14px;
|
||||
padding: 14px;
|
||||
border-radius: 10px;
|
||||
background: #f8f9fa;
|
||||
margin-bottom: 10px;
|
||||
border-left: 4px solid #3498db;
|
||||
transition: transform 0.15s;
|
||||
}
|
||||
.bantuan-item:hover { transform: translateX(3px); }
|
||||
.bantuan-icon {
|
||||
font-size: 26px;
|
||||
flex-shrink: 0;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.bantuan-jenis { font-size: 14px; font-weight: 700; color: #2c3e50; }
|
||||
.bantuan-jumlah { font-size: 13px; color: #555; margin-top: 2px; }
|
||||
.bantuan-tanggal { font-size: 12px; color: #aaa; margin-top: 3px; }
|
||||
.bantuan-ket { font-size: 12px; color: #888; margin-top: 3px; font-style: italic; }
|
||||
|
||||
.kosong-bantuan {
|
||||
text-align: center;
|
||||
padding: 30px;
|
||||
color: #bbb;
|
||||
font-size: 14px;
|
||||
}
|
||||
.kosong-bantuan .big { font-size: 40px; display: block; margin-bottom: 8px; }
|
||||
|
||||
/* FOOTER */
|
||||
.footer-card {
|
||||
text-align: center;
|
||||
color: rgba(255,255,255,0.6);
|
||||
font-size: 12px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.footer-card a { color: #3498db; text-decoration: none; }
|
||||
|
||||
/* LOADING */
|
||||
.btn-loading { opacity: 0.7; pointer-events: none; }
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.info-grid { grid-template-columns: 1fr; }
|
||||
.profil-header { flex-direction: column; text-align: center; }
|
||||
.search-wrap { flex-direction: column; }
|
||||
.search-wrap button { width: 100%; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- HERO -->
|
||||
<div class="hero">
|
||||
<div class="logo">🏛️</div>
|
||||
<h1>Cek Status Bantuan</h1>
|
||||
<p>WebGIS Kemiskinan Kota Pontianak · Masukkan NIK untuk melihat status bantuan Anda</p>
|
||||
</div>
|
||||
|
||||
<!-- FORM PENCARIAN -->
|
||||
<div class="card">
|
||||
<label class="search-label">🔍 Cari berdasarkan NIK (Nomor Induk Kependudukan)</label>
|
||||
<form method="POST" onsubmit="tombolCari(this)">
|
||||
<div class="search-wrap">
|
||||
<input
|
||||
type="text"
|
||||
name="nik"
|
||||
id="inputNik"
|
||||
placeholder="Masukkan 16 digit NIK..."
|
||||
maxlength="20"
|
||||
value="<?= htmlspecialchars($nik_input) ?>"
|
||||
autocomplete="off"
|
||||
inputmode="numeric"
|
||||
autofocus
|
||||
>
|
||||
<button type="submit" id="btnCari">🔍 Cek Sekarang</button>
|
||||
</div>
|
||||
<p class="hint">Contoh: 6171010203980001 · NIK terdiri dari 16 angka sesuai KTP</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<!-- ERROR -->
|
||||
<div class="card">
|
||||
<div class="alert-error">
|
||||
<span style="font-size:20px;">⚠️</span>
|
||||
<div>
|
||||
<strong>Data tidak ditemukan</strong><br>
|
||||
<?= htmlspecialchars($error) ?>
|
||||
<br><br>
|
||||
<small>Jika kamu merasa sudah terdaftar, hubungi petugas kelurahan setempat untuk konfirmasi.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($hasil): ?>
|
||||
<!-- PROFIL -->
|
||||
<div class="card">
|
||||
<div class="profil-header">
|
||||
<?php if (!empty($hasil['foto']) && file_exists($hasil['foto'])): ?>
|
||||
<img src="<?= htmlspecialchars($hasil['foto']) ?>" class="profil-foto" alt="Foto">
|
||||
<?php else: ?>
|
||||
<div class="profil-foto-placeholder">👤</div>
|
||||
<?php endif; ?>
|
||||
<div>
|
||||
<div class="profil-nama"><?= htmlspecialchars($hasil['nama']) ?></div>
|
||||
<div class="profil-nik">NIK: <?= htmlspecialchars($hasil['nik'] ?? '-') ?></div>
|
||||
<?php
|
||||
$sb = $hasil['status_bantuan'] ?? 'Belum';
|
||||
$sw = $status_warna[$sb] ?? '#95a5a6';
|
||||
$sl = $status_label[$sb] ?? $sb;
|
||||
?>
|
||||
<span class="badge-status" style="background:<?= $sw ?>;">
|
||||
<?= $sl ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="info-grid">
|
||||
<div class="info-item full">
|
||||
<div class="lbl">Alamat</div>
|
||||
<div class="val"><?= htmlspecialchars($hasil['alamat'] ?? '-') ?></div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="lbl">Pekerjaan</div>
|
||||
<div class="val"><?= htmlspecialchars($hasil['pekerjaan'] ?? '-') ?></div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="lbl">Penghasilan</div>
|
||||
<div class="val"><?= formatRupiah($hasil['penghasilan'] ?? 0) ?>/bulan</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="lbl">Anggota Keluarga</div>
|
||||
<div class="val"><?= (int)($hasil['jumlah_anggota_keluarga'] ?? 1) ?> orang</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="lbl">Jumlah Tanggungan</div>
|
||||
<div class="val"><?= (int)($hasil['jumlah_tanggungan'] ?? 0) ?> orang</div>
|
||||
</div>
|
||||
<div class="info-item full">
|
||||
<div class="lbl">Kategori Kemiskinan</div>
|
||||
<div class="val">
|
||||
<?php $kw = $kategori_warna[$hasil['kategori_kemiskinan']] ?? '#7f8c8d'; ?>
|
||||
<span class="badge-kategori" style="background:<?= $kw ?>;">
|
||||
<?= htmlspecialchars($hasil['kategori_kemiskinan'] ?? '-') ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (!empty($hasil['keterangan'])): ?>
|
||||
<div class="info-item full">
|
||||
<div class="lbl">Keterangan</div>
|
||||
<div class="val" style="font-weight:normal;color:#555;"><?= htmlspecialchars($hasil['keterangan']) ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RIWAYAT BANTUAN -->
|
||||
<div class="card">
|
||||
<div class="section-title">
|
||||
🎁 Riwayat Bantuan yang Diterima
|
||||
<span style="float:right;font-size:12px;color:#3498db;font-weight:normal;"><?= count($riwayat) ?> kali</span>
|
||||
</div>
|
||||
|
||||
<?php if (empty($riwayat)): ?>
|
||||
<div class="kosong-bantuan">
|
||||
<span class="big">📭</span>
|
||||
Belum ada riwayat bantuan yang tercatat.<br>
|
||||
<small>Hubungi petugas untuk informasi lebih lanjut.</small>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($riwayat as $b):
|
||||
$jenis = $b['jenis_bantuan'] ?? 'Lainnya';
|
||||
$icon = $jenis_icon[$jenis] ?? '📦';
|
||||
$warna = $jenis_warna[$jenis] ?? '#7f8c8d';
|
||||
?>
|
||||
<div class="bantuan-item" style="border-left-color:<?= $warna ?>;">
|
||||
<div class="bantuan-icon"><?= $icon ?></div>
|
||||
<div>
|
||||
<div class="bantuan-jenis"><?= htmlspecialchars($jenis) ?></div>
|
||||
<div class="bantuan-jumlah">Jumlah: <strong><?= htmlspecialchars($b['jumlah_bantuan'] ?? '-') ?></strong></div>
|
||||
<div class="bantuan-tanggal">📅 <?= formatTanggal($b['tanggal_bantuan']) ?></div>
|
||||
<?php if (!empty($b['keterangan'])): ?>
|
||||
<div class="bantuan-ket">📝 <?= htmlspecialchars($b['keterangan']) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- FOOTER -->
|
||||
<div class="footer-card">
|
||||
<p>WebGIS Kemiskinan Kota Pontianak · Data bersumber dari sistem pendataan resmi</p>
|
||||
<p style="margin-top:6px;"><a href="../02/index.html">🗺️ Lihat Peta</a> · <a href="../02/login.php">🔐 Login Admin</a></p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Hanya izinkan angka pada input NIK
|
||||
document.getElementById('inputNik').addEventListener('input', function() {
|
||||
this.value = this.value.replace(/\D/g, '');
|
||||
});
|
||||
function tombolCari(form) {
|
||||
var btn = document.getElementById('btnCari');
|
||||
btn.textContent = '⏳ Mencari...';
|
||||
btn.classList.add('btn-loading');
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user