Advertisement
Mardydu

Untitled

Dec 3rd, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.69 KB | None | 0 0
  1. <?php
  2. include 'koneksi.php';
  3. include 'navbar.php';
  4. $lapid = $_GET['id'];
  5. $id = $_SESSION['id'];
  6. $sql2 = "SELECT customer.nama, customer.email, customer.notelp, lapangan.namalap, lapangan.tarif, booking.mulai, booking.beres, booking.id, lapangan.open, lapangan.close, lapangan.id
  7.      FROM booking
  8.      INNER JOIN customer on booking.cust_id=customer.id
  9.      INNER JOIN lapangan on booking.lap_id=lapangan.id
  10.      WHERE cust_id = $id AND lap_id=$lapid";
  11. $hasil1 = $pdo->query($sql2);
  12. $row = $hasil1->fetch();
  13.  
  14. $main = date("h", strtotime($row['mulai']));
  15. $udahan = date("h", strtotime($row['beres']));
  16. $main1 = idate("h", $main);
  17. $udahan1 = idate("h", $udahan);
  18. $q = $udahan1 - $main1;
  19.  
  20. require_once(dirname(__FILE__) . '../Veritrans.php');
  21. //Set Your server key
  22. Veritrans_Config::$serverKey = "SB-Mid-server-ZX5_Q628ETGoodcnP9TC5669";
  23. // Uncomment for production environment
  24. // Veritrans_Config::$isProduction = true;
  25. // Enable sanitization
  26. Veritrans_Config::$isSanitized = true;
  27. // Enable 3D-Secure
  28. Veritrans_Config::$is3ds = true;
  29. // Required
  30. $transaction_details = array(
  31.   'order_id' => rand(),
  32.   'gross_amount' => 1000000, // no decimal allowed for creditcard
  33. );
  34. // Optional
  35. $item1_details = array(
  36.   'id' => $row['id'],
  37.   'quantity' => 2,
  38.   'price' => 2000,
  39.   'name' => $row['namalap'],
  40. );
  41.  
  42. // Optional
  43. $item_details = array ($item1_details);
  44.  
  45. // Optional
  46. $customer_details = array(
  47.   'first_name'    => $row['nama'],
  48.   'last_name'     => "",
  49.   'email'         => "[email protected]",
  50.   'phone'         => $row['notelp'],
  51. );
  52. // Optional, remove this to display all available payment methods
  53. $enable_payments = array('credit_card','gopay', 'cimb_clicks','mandiri_clickpay','echannel');
  54. // Fill transaction details
  55. $transaction = array(
  56.   'enabled_payments' => $enable_payments,
  57.   'transaction_details' => $transaction_details,
  58.   'customer_details' => $customer_details,
  59.   'item_details' => $item_details,
  60. );
  61. $snapToken = Veritrans_Snap::getSnapToken($transaction);
  62. ?>
  63. <body style="width: 100%;">
  64.     <div class="container" style="margin-top: 20px;">
  65.         <?php
  66.         if($_SESSION['user_id']==null){
  67.             ?>
  68.             <h1 style='text-align:center'>Silahkan login terlebih dahulu.</h1>
  69.             <form action="verifikasi.php" method="post">
  70.                 <div class="form-group">
  71.                     <label for="exampleDropdownFormEmail1">Email address</label>
  72.                     <input type="email" class="form-control" id="exampleDropdownFormEmail1" name="email" placeholder="[email protected]">
  73.                 </div>
  74.                 <div class="form-group">
  75.                     <label for="exampleDropdownFormPassword1">Password</label>
  76.                     <input type="password" name="pw" class="form-control" id="exampleDropdownFormPassword1" placeholder="Password">
  77.                 </div>
  78.                 <button type="submit" class="btn btn-primary">Sign in</button>
  79.             </form>
  80.  
  81.             <?php
  82.         }else{ ?>
  83.             <?php include 'liatjadwal.php';
  84.             ?>
  85.             <br/>
  86.             <br/>
  87.             <br/>
  88.             <br/>
  89.             <br/>
  90.  
  91.             <form action="jadwal.php?id=<?php echo $_GET['id']; ?>" method="post" enctype="multipart/form-data">
  92.                 <div class="row">
  93.                     <div class="form-group col-md-6">
  94.                         <label for="exampleInputDate1">Silakan pilih tanggal</label>
  95.                         <input type="date" class="form-control" id="exampleInputDate1" name="tgl">
  96.                     </div>
  97.                     <div class="form-group col-md-3">
  98.                         <label for="exampleInputTime1">Waktu mulai</label>
  99.                         <br>
  100.                         <select class="form-control" name="mulai">
  101.                             <option>00:00</option>
  102.                             <option>01:00</option>
  103.                             <option>02:00</option>
  104.                             <option>03:00</option>
  105.                             <option>04:00</option>
  106.                             <option>05:00</option>
  107.                             <option>06:00</option>
  108.                             <option>07:00</option>
  109.                             <option>08:00</option>
  110.                             <option>09:00</option>
  111.                             <option>10:00</option>
  112.                             <option>11:00</option>
  113.                             <option>12:00</option>
  114.                             <option>13:00</option>
  115.                             <option>14:00</option>
  116.                             <option>15:00</option>
  117.                             <option>16:00</option>
  118.                             <option>17:00</option>
  119.                             <option>18:00</option>
  120.                             <option>19:00</option>
  121.                             <option>20:00</option>
  122.                             <option>21:00</option>
  123.                             <option>22:00</option>
  124.                             <option>23:00</option>
  125.                             <option>24:00</option>
  126.                         </select>
  127.                     </div>
  128.                     <div class="form-group col-md-3">
  129.                         <label for="exampleInputTime2">Waktu selesai</label>
  130.                         <br>
  131.                         <select class="form-control" name="beres">
  132.                             <option>00:00</option>
  133.                             <option>01:00</option>
  134.                             <option>02:00</option>
  135.                             <option>03:00</option>
  136.                             <option>04:00</option>
  137.                             <option>05:00</option>
  138.                             <option>06:00</option>
  139.                             <option>07:00</option>
  140.                             <option>08:00</option>
  141.                             <option>09:00</option>
  142.                             <option>10:00</option>
  143.                             <option>11:00</option>
  144.                             <option>12:00</option>
  145.                             <option>13:00</option>
  146.                             <option>14:00</option>
  147.                             <option>15:00</option>
  148.                             <option>16:00</option>
  149.                             <option>17:00</option>
  150.                             <option>18:00</option>
  151.                             <option>19:00</option>
  152.                             <option>20:00</option>
  153.                             <option>21:00</option>
  154.                             <option>22:00</option>
  155.                             <option>23:00</option>
  156.                             <option>24:00</option>
  157.                         </select>
  158.                     </div>
  159.                 </div>
  160.                 <div class="input-group mb-3">
  161.                     <div class="custom-file">
  162.                         <input type="file" id="inputGroupFile02" name="bukti">
  163.                     </div>
  164.                 </div>
  165.                 <div class="form-group notif col-md-4"><h4>NOTICE</h4><p>Please transfer your payment to <b>917398219 a/n Rio Alexander</b> to book this field, then we will confirm your booking in maximum 24 hours. Down payment is accepted 40% from the actual tariff.<br/><br/>Thank you and have a nice day! :)</p>
  166.                 </div>
  167.                
  168.                 <input class="btn btn-primary" type="submit" name="submit" value="Book!">
  169.             </form>
  170.             <br><button class="btn btn-success" id="pay-button">Other Payments</button>
  171.         <?php } ?>
  172.     </div>
  173.     <!-- TODO: Remove ".sandbox" from script src URL for production environment. Also input your client key in "data-client-key" -->
  174.     <script src="https://app.sandbox.midtrans.com/snap/snap.js" data-client-key="SB-Mid-client-P5eDYUVOJcQHU5DR"></script>
  175.     <script type="text/javascript">
  176.         document.getElementById('pay-button').onclick = function(){
  177.         // SnapToken acquired from previous step
  178.         snap.pay('<?= $snapToken ?>', {
  179.           // Optional
  180.           onSuccess: function(result){
  181.             /* You may add your own js here, this is just example */
  182.           },
  183.           // Optional
  184.           onPending: function(result){
  185.             /* You may add your own js here, this is just example */
  186.           },
  187.           // Optional
  188.           onError: function(result){
  189.             /* You may add your own js here, this is just example */
  190.           }
  191.       });
  192.     };
  193. </script>
  194. <?php include 'footer.php' ?>
  195. </body>
  196. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement