0) { $msg = 'NIK/NITK Pegawai Sudah Ada Di Database'; $_SESSION['error'] = $msg; header("location:pegawai.php"); }else{ $rand = rand(); $allowed = array('gif','png','jpg','jpeg'); $filename = $_FILES['foto']['name']; if($filename == ""){ mysqli_query($koneksi,"INSERT INTO pegawai VALUES(NULL,'$status_kp', '$nik', '$nitk','$nama', '$tpl', '$tgl','$jk', '$agama', '$status', '$bagian', '$fakultas','$jabatan', '$tmtjabatan','$tmtjabatan_selesai','$nojabatan','$golongan', '$tmt_golongan', '$no_golongan','$pendidikan', '$program_studi', '$tahun_lulus', '$almamater','$notmtd', '$tmtd','$kontak', '$alamat', '$email','$gelar','$gelar2','$ktp','$npwp','$bpjs','$kk','$rekening','$darah','$alamat2','$email2','$pasangan','$ibu','$anak','$kompetensi','$vaksin', '$nomor','','$id_user')")or die(mysqli_error($koneksi)); header("location:pegawai.php?alert=berhasil"); }else{ $ext = pathinfo($filename, PATHINFO_EXTENSION); if(!in_array($ext,$allowed) ) { header("location:pegawai.php?alert=gagal"); }else{ move_uploaded_file($_FILES['foto']['tmp_name'], '../file/foto/'.$rand.'_'.$filename); $file_gambar = $rand.'_'.$filename; mysqli_query($koneksi,"INSERT INTO pegawai VALUES(NULL,'$status_kp', '$nik', '$nitk','$nama', '$tpl', '$tgl','$jk', '$agama', '$status', '$bagian', '$fakultas','$jabatan', '$tmtjabatan','$tmtjabatan_selesai','$nojabatan','$golongan', '$tmt_golongan', '$no_golongan','$pendidikan', '$program_studi', '$tahun_lulus', '$almamater','$notmtd', '$tmtd','$kontak', '$alamat', '$email','$gelar','$gelar2','$ktp','$npwp','$bpjs','$kk','$rekening','$darah','$alamat2','$email2','$pasangan','$ibu','$anak','$kompetensi','$vaksin', '$nomor','$file_gambar','$id_user')")or die(mysqli_error($koneksi)); header("location:pegawai.php?alert=berhasil"); } } } ?>