Advertisement
Yayas

Untitled

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