Advertisement
BimoSora

billing-auto-delete

Oct 6th, 2019
541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. <?php
  2. try{
  3. $db = new PDO ("mysql:host=localhost;dbname=;","","");
  4. }catch(PDOException $e){
  5. echo $e->getmessage();
  6. }
  7. ?>
  8.  
  9. <html>
  10.  
  11. <head>
  12. <meta charset="utf-8">
  13. <meta http-equiv="x-ua-compatible" content="ie=edge">
  14. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  15. <title>GONIT - Billing batal auto</title>
  16. <link rel="icon" href="../../id/images/icon.ico">
  17. <link rel="stylesheet" href="../../id/css/foundation.css">
  18. <link rel="stylesheet" href="../../id/css/app.css">
  19. <script type="text/javascript" src="http://code.jquery.com/jquery-2.0.2.js"></script>
  20. </head>
  21.  
  22. <body>
  23. <?php
  24. if ($_POST['submit']) {
  25. $billing_deskripsi = $_POST['billing_deskripsi'];
  26. $billing_status = $_POST['billing_status'];
  27. $nourut = $_POST['nourut'];
  28.  
  29. $tw_billing = $db->prepare("UPDATE tw_billing SET billing_status = :billing_status, billing_deskripsi = :billing_deskripsi WHERE nourut = :nourut");
  30. $tw_billing->BindParam(':nourut',$nourut);
  31. $tw_billing->BindParam(':billing_deskripsi',$billing_deskripsi);
  32. $tw_billing->BindParam(':billing_status',$billing_status);
  33. $tw_billing->execute();
  34.  
  35. $tw_user_vpn_deleted = $db->prepare("DELETE FROM tw_user_vpn WHERE nourut = :nourut");
  36. $tw_user_vpn_deleted->BindParam(':nourut',$nourut);
  37. $tw_user_vpn_deleted->execute();
  38.  
  39. }
  40. ?>
  41.  
  42. <?php
  43. $tw_billing = $db->prepare("SELECT * FROM tw_billing ORDER BY billing_id");
  44. $tw_billing->execute();
  45. while($data = $tw_billing->fetch(PDO::FETCH_ASSOC)){
  46. ?>
  47.  
  48. <?php
  49. if ($data["billing_status"] == "Belum dibayar") { ?>
  50. <?php
  51. $mulai = date($data['billing_tanggal']); // waktu mulai
  52. $exp = date($data['expiredpay']); // batas waktu
  53. if (!(strtotime($mulai) <= time() AND time() >= strtotime($exp))) {
  54.  
  55. } else {
  56. echo '<form method="post" name="form" action="">';
  57. echo '<input type="submit" id="submit" name="submit" value="submit">';
  58. echo '<input type="hidden" name="nourut" value='.$data["nourut"].'>';
  59. echo '<input type="hidden" name="billing_deskripsi" value='.$data["billing_deskripsi"].'>';
  60. echo '<input type="hidden" name="billing_status" value="Batal">';
  61. echo '</form>';
  62. }
  63. ?>
  64. <?php }
  65. else if ($data["billing_status"] == "Dibayar") { ?>
  66.  
  67. <?php }
  68. else if ($data["billing_status"] == "Ditangguhkan") { ?>
  69.  
  70. <?php }
  71. else if ($data["billing_status"] == "Batal") { ?>
  72.  
  73. <?php } ?>
  74. <?php } ?>
  75.  
  76. <script type="text/javascript">
  77. window.setTimeout(function() {
  78. document.getElementById("submit").click();
  79. }, 1); // 1200000 = seconds*1000
  80. </script>
  81. </body>
  82. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement