<?php
session_start();
include "../../config/koneksi.php";

$module=$_GET[module];
$act=$_GET[act];

// Update pegawai
if ($module=='pegawai' AND $act=='update'){
    mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE pegawai SET nip  = '$_POST[nip]',
								 nama = '$_POST[nama]',
								 id_pangkat = '$_POST[pangkat]',
								 id_jabatan = '$_POST[jabatan]',
								 unitkerja = '$_POST[unitkerja]',
								 foto = '$_POST[foto]'
								 WHERE  id_pegawai     = '$_POST[id]'");
	
  header('location:../../media.php?module='.$module);
}
elseif ($module=='pegawai' AND $act=='hapus') {
	mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM pegawai WHERE id_pegawai='$_GET[id]'");
  header('location:../../media.php?module='.$module);
}
elseif ($module=='pegawai' AND $act=='input'){
	  mysqli_query($GLOBALS["___mysqli_ston"], "INSERT INTO pegawai(nip,nama,id_pangkat,id_jabatan,unitkerja,username,password,foto) 
	  VALUES('$_POST[nip]','$_POST[nama]','$_POST[pangkat]','$_POST[jabatan]','$_POST[unitkerja]',
	  '$_POST[nip]','$_POST[nip]','$_POST[foto]')");
  header('location:../../media.php?module='.$module);
}

?>

