Advertisement
wis4nto

Untitled

Feb 9th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 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 `supplier` WHERE `NoSupplier` = ".$_GET["id"];
  9. $ambil=mysql_query($act,$server_connect);
  10. header("Location:../index.php?what=supplier&delete_success=true");
  11. }else if($_GET["action"]=="save"){
  12. if(!empty($_POST["NmSupplier"])&&!empty($_POST["AlmtSupplier"])&&!empty($_POST["TlpSupplier"])){
  13. $perintah="INSERT INTO `supplier` (`NoSupplier`, `NmSupplier`, `AlmtSupplier`, `TlpSupplier`) VALUES (NULL, '".$_POST["NmSupplier"]."', '".$_POST["AlmtSupplier"]."', '".$_POST["TlpSupplier"]."')";
  14. $ambil=mysql_query($perintah,$server_connect);
  15. header("Location:../index.php?what=supplier&tab=input&input_success=true");
  16. }else{
  17. header("Location:../index.php?what=supplier&tab=input&empty_fields=true");
  18. }
  19. }else if($_GET["action"]=="edit"&&isset($_GET["id"])){
  20. header("Location:../index.php?what=supplier&tab=input&action=edit&id=".$_GET["id"]);
  21. }else if($_GET["action"]=="update"){
  22. if(!empty($_GET["id"])&&!empty($_POST["NmSupplier"])&&!empty($_POST["AlmtSupplier"])&&!empty($_POST["TlpSupplier"])){
  23. $perintah="UPDATE `supplier` SET `NmSupplier`='".$_POST["NmSupplier"]."', `AlmtSupplier`='".$_POST["AlmtKaryawan"]."', `TlpSupplier` = '".$_POST["TlpSupplier"]."' WHERE `NoSupplier` = '".$_GET["id"]."'";
  24. $ambil=mysql_query($perintah,$server_connect);
  25. header("Location:../index.php?what=supplier&edit_success=true");
  26. }else{
  27. header("Location:../index.php?what=supplier&tab=input&action=edit&id=".$_GET["id"]."&empty_fields=true");
  28. }
  29. }else{
  30. header("Location:../index.php?what=supplier&error=true");
  31. }
  32. }else{header("Location:../index.php?what=supplier&error=true");}
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement