Advertisement
wis4nto

Untitled

Feb 8th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include "../../settings/connection.php";
  4. include "../../settings/auth-admin.php";
  5.  
  6. if(isset($_GET["action"])){
  7. if($_GET["action"]=="delete"&&isset($_GET["id"])){
  8. $act="DELETE from `karyawan` WHERE `NIK` = ".$_GET["id"];
  9. $ambil=mysql_query($act,$server_connect);
  10. header("Location:../index.php?what=karyawan&delete_success=true");
  11. }else if($_GET["action"]=="save"){
  12. if(!empty($_POST["NmKaryawan"])&&!empty($_POST["AlmtKaryawan"])&&!empty($_POST["TlpKaryawan"])&&!empty($_POST["GenderKaryawan"])&&!empty($_POST["UserName"])&&!empty($_POST["Password"])&&!empty($_POST["Level"])){
  13. $perintah="INSERT INTO `karyawan` (`NIK`, `NmKaryawan`, `AlmtKaryawan`, `TlpKaryawan` , `GenderKaryawan`, `UserName`, `Password`, `Level`) VALUES (NULL, '".$_POST["NmKaryawan"]."', '".$_POST["AlmtKaryawan"]."', '".$_POST["TlpKaryawan"]."', '".$_POST["GenderKaryawan"]."', '".$_POST["UserName"]."', '".$_POST["Password"]."', '".$_POST["Level"]."')";
  14. $ambil=mysql_query($perintah,$server_connect);
  15. header("Location:../index.php?what=karyawan&tab=input&input_success=true");
  16. }else{
  17. header("Location:../index.php?what=karyawan&tab=input&empty_fields=true");
  18. }
  19. }else if($_GET["action"]=="edit"&&isset($_GET["id"])){
  20. header("Location:../index.php?what=karyawan&tab=input&action=edit&id=".$_GET["id"]);
  21. }else if($_GET["action"]=="update"){
  22. if(!empty($_GET["id"])&&!empty($_POST["NmKaryawan"])&&!empty($_POST["AlmtKaryawan"])&&!empty($_POST["TlpKaryawan"])&&!empty($_POST["GenderKaryawan"])&&!empty($_POST["UserName"])&&!empty($_POST["Password"])&&!empty($_POST["Level"])){
  23. $perintah="UPDATE `karyawan` SET `NmKaryawan`='".$_POST["NmKaryawan"]."', `AlmtKaryawan`='".$_POST["AlmtKaryawan"]."', `TlpKaryawan` = '".$_POST["TlpKaryawan"]."',
  24. `GenderKaryawan` = '".$_POST["GenderKaryawan"]."', `UserName` = '".$_POST["UserName"]."', `Password` = '".$_POST["Password"]."', `Level` = '".$_POST["Level"]."' WHERE `NIK` = '".$_GET["id"]."'";
  25. $ambil=mysql_query($perintah,$server_connect);
  26. header("Location:../index.php?what=karyawan&edit_success=true");
  27. }else{
  28. header("Location:../index.php?what=karyawan&tab=input&action=edit&id=".$_GET["id"]."&empty_fields=true");
  29. }
  30. }else{
  31. header("Location:../index.php?what=karyawan&error=true");
  32. }
  33. }else{header("Location:../index.php?what=karyawan&error=true");}
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement