Identity Card Number (NIK) is a collaboration of several unique codes. Reading the Population Identification Number can actually be manually we search. But it will be easier if we read the contents of KTP by using the application. Following is an easy technique to create a Identity Card reader application using the PHP programming language.
Just copy the sintax below and run it :
Easy to Identify Identity Card Number (NIK) Using PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
<?php $nik = ''; if (isset($_POST['nik'])) { $nik = trim($_POST['nik']); } function bulan($i) { $i = intval($i) - 1; $data = array( 'Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember' ); if (isset($data[$i])) { return trim($data[$i]); } return '<span class="error">Invalid</span>'; } function kode_provinsi($i) { $i = intval($i); $data = array( 11 => 'Aceh', 12 => 'Sumatera Utara', 13 => 'Sumatera Barat', 14 => 'Riau', 15 => 'Jambi', 16 => 'Sumatera Selatan', 17 => 'Bengkulu', 18 => 'Lampung', 19 => 'Kep. Bangka Belitung', 21 => 'Kep. Riau', 31 => 'DKI Jakarta', 32 => 'Jawa Barat', 33 => 'Jawa Tengah', 34 => 'Yogyakarta', 35 => 'Jawa Timur', 36 => 'Banten', 51 => 'Bali', 52 => 'Nusa Tenggara Barat', 53 => 'Nusa Tenggara Timur', 61 => 'Kalimantan Barat', 62 => 'Kalimantan Tengah', 63 => 'Kalimantan Selatan', 64 => 'Kalimantan Timur', 71 => 'Sulawesi Utara', 72 => 'Sulawesi Tengah', 73 => 'Sulawesi Selatan', 74 => 'Sulawesi Tenggara', 75 => 'Gorontalo', 76 => 'Sulawesi Barat', 81 => 'Maluku', 82 => 'Maluku Utara', 91 => 'Papua Barat', 94 => 'Papua' ); if (isset($data[$i])) { return trim($data[$i]); } return '<span class="error">Invalid</span>'; } ?> <html> <head> <title>Makna Nomor Induk Kependudukan - Detriamelia.Com</title> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style type="text/css"> body { font-size:1em; padding:1em; } .error { color:#F00; font-weight:900; } </style> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> </head> <body> <div class="text-center p-3 mb-3" style="border-bottom:8px solid #ccc;"> <h1>Detriamelia<span style="font-weight:bold;">.Com</span></h1> <h5>Makna Nomor Induk Kependudukan</h5> </div> <form method="post"> <input type="hidden" name="go" value="1" /> <div class="form-group"> <label>NIK (16 digit) :</label> <input class="form-control" type="number" name="nik" value="<?php echo htmlentities($nik); ?>" placeholder="Ketik Nomor Induk Kependudukan anda..." required> </div> <button type="submit" class="btn bg-primary text-light">Cek Data KTP</button> </form> <?php if (isset($_POST['go'])) { if (strlen($nik) != 16) { echo '<div class="error">Panjang NIK harus 16 angka. Input Anda = '.strlen($nik).' angka.</div>'; } else { $data = array(); $data['provinsi'] = substr($nik, 0, 2); $data['kota'] = substr($nik, 2, 2); $data['kecamatan'] = substr($nik, 4, 2); $data['tanggal_lahir'] = substr($nik, 6, 2); $data['bulan_lahir'] = substr($nik, 8, 2); $data['tahun_lahir'] = substr($nik, 10, 2); $data['unik'] = substr($nik, 12, 4); if (intval($data['tanggal_lahir']) > 40) { $data['tanggal_lahir_2'] = intval($data['tanggal_lahir']) - 40; $gender = 'Wanita'; } else { $data['tanggal_lahir_2'] = intval($data['tanggal_lahir']); $gender = 'Pria'; } //echo '<pre>'; //print_r($data); //echo '</pre>'; ?> <table class="table table-hover table-stripted"> <tr> <th class="bg-dark text-light">Nomor</th> <th class="bg-dark text-light">Keterangan</th> <th class="bg-dark text-light">Makna Nomor</th> </tr> <tr> <td> <?php echo $data['provinsi']; ?> </td> <td> Provinsi </td> <td> <?php echo kode_provinsi($data['provinsi']); ?> </td> </tr> <tr valign="top"> <td> <?php echo $data['kota']; ?> </td> <td> Kota / Kabupaten </td> <td> <a href="http://www.kemendagri.go.id/pages/data-wilayah">Lihat Data</a> <br /> <span style="font-weight:900;color:#00F"> <?php if (intval($data['kota']) > 70) { echo 'Kota'; } else { echo 'Kabupaten'; } ?> </span> </td> </tr> <tr> <td> <?php echo $data['kecamatan']; ?> </td> <td> Kecamatan </td> <td> <a href="http://www.kemendagri.go.id/pages/data-wilayah">Lihat Data</a> </td> </tr> <tr valign="top"> <td> <?php echo $data['tanggal_lahir']; ?> </td> <td> Tanggal Lahir </td> <td> <?php echo $data['tanggal_lahir_2']; ?> <br /> <span style="font-weight:900;color:#00F"><?php echo $gender; ?></span> </td> </tr> <tr> <td> <?php echo $data['bulan_lahir']; ?> </td> <td> Bulan Lahir </td> <td> <?php echo bulan($data['bulan_lahir']); ?> </td> </tr> <tr> <td> <?php echo $data['tahun_lahir']; ?> </td> <td> Tahun Lahir </td> <td> <?php echo $data['tahun_lahir']; ?> </td> </tr> <tr> <td> <?php echo $data['unik']; ?> </td> <td> Nomor Urut </td> <td> <?php echo $data['unik']; ?> </td> </tr> </table> <?php } } ?> </body> </html> |