Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. <?php
  2. include('config.php');
  3. session_start();
  4. $username = $_SESSION['username'];
  5.  
  6. $check = mysqli_query($db, "SELECT * FROM users WHERE username = '$username'");
  7. $row = mysqli_fetch_array($check,MYSQLI_ASSOC);
  8. $count = mysqli_num_rows($check);
  9.  
  10. $balance = $row['balance'];
  11. if(!isset($username)) {
  12. header("Location: ../home");
  13. } else if ($count == 0 || $row['status'] == "Not active") {
  14. header("Location: ../logout.php");
  15. } ?>
  16. <?php
  17.  
  18. include('check.php');
  19. $subtitle = "Topup Otomatis Via Pulsa";
  20.  
  21. if (isset($_POST['tikettelkomsel'])) {
  22.  
  23. $licanse = "Masukkan Licansemu"; // Isi Licanse Web Mu
  24. $buyer = $_POST['buyer']; // Nomor Yang Ingin Di Cek Boleh Diubah
  25. $jumlah = $_POST['jumlah']; // Total Pulsa Yang Ingin Di Konfirmasi Boleh diubah
  26. $url = "http://mypanel.win/access/api/telkomsel.php?licanse=".$licanse."&jumlah=".$jumlah."&dari=".$buyer."&server=".$no;
  27. $get = file_get_contents($url);
  28. $hasil = json_decode($get);
  29.  
  30. if ($hasil->result == "false") {
  31. $error = "Gagal";
  32. } else if ($hasil->result == "true") {
  33. $success = "Tiket Berhasil Dipesan.";
  34. }
  35. }
  36.  
  37. if (isset($_POST['konfirmasitelkomsel'])) {
  38. $licanse = "Masukkan Licansemu"; // Isi Licanse Web Mu
  39. $dari = $_POST['buyer']; // Nomor Yang Ingin Di Cek Boleh Diubah
  40. $jumlah = $_POST['jumlah']; // Total Pulsa Yang Ingin Di Konfirmasi Boleh diubah
  41. $url = "http://mypanel.win/access/api/konfirmtsel.php?licanse=".$licanse."&dari=".$dari."&jumlah=".$jumlah;
  42. $get = file_get_contents($url);
  43. $hasil = json_decode($get);
  44. $quantity = ($jumlah * 0.8);
  45.  
  46. if ($hasil->result == "false") {
  47. $error = "Konfirmasi Gagal Karna $hasil->msg";
  48. } else if ($hasil->result == "true") {
  49. $success = "Konfirmasi Sukses Karna $hasil->msg ";
  50. $update = mysqli_query($db,"UPDATE users SET balance = balance+$quantity WHERE username = '$username'");
  51. } }
  52.  
  53. include('header.php');
  54. ?>
  55. <!-- Start content -->
  56. <div class="content">
  57. <div class="container">
  58. <!-- Page-Title -->
  59. <div class="row">
  60. <div class="col-sm-12">
  61. <h4 class="pull-left page-title"><?php echo $subtitle; ?></h4>
  62. <ol class="breadcrumb pull-right">
  63. <li><a href="#"><?php echo $title; ?></a>
  64. </li>
  65. <li class="active"><?php echo $subtitle; ?></li>
  66. </ol>
  67. </div>
  68. </div>
  69. <div class="row">
  70. <div class="col-lg-12">
  71. <?php if (isset($error)) { ?>
  72. <div class="alert alert-danger">
  73. <b>Gagal : </b><?php echo $error; ?>
  74. </div>
  75. <? } else if (isset($success)) { ?>
  76. <div class="alert alert-success">
  77. <b>Berhasil : </b><?php echo $success; ?>
  78. </div>
  79. <? } ?>
  80. <div class="panel panel-color panel-primary">
  81. <div class="panel-heading">
  82. <h3 class="panel-title"><i class="md md-settings"></i> <?php echo $subtitle; ?></h3>
  83. </div>
  84. <div class="panel-body">
  85. <form class="form-horizontal" role="form" method="POST" action="topuptelkomsel.php">
  86. <div class="form-group">
  87. <label class="col-sm-2 control-label">Nohp</label>
  88. <div class="col-sm-10">
  89. <input type="text" class="form-control" name="buyer" placeholder="Masukkan Nomer Hp Yang Kmu Buat Transfer">
  90. </div>
  91. </div>
  92. <div class="form-group">
  93. <label class="col-sm-2 control-label">Jumlah Pulsa</label>
  94. <div class="col-sm-10">
  95. <input type="number" class="form-control" name="jumlah" placeholder="Masukkan Jumlah Pulsa Yang Akan Kamu Transfer">
  96. </div>
  97. </div>
  98.  
  99. <div class="form-group m-b-0">
  100. <div class="col-sm-offset-2 col-sm-10">
  101. <button name="tikettelkomsel" type="submit" class="btn btn-info waves-effect waves-light"><i class="md md-settings"></i> Pesan Tiket</button><button name="konfirmasitelkomsel" type="submit" class="btn btn-info waves-effect waves-light"><i class="md md-settings"></i> Konfirmasi Tiket</button>
  102. </div>
  103. </div>
  104. </form>
  105. </div>
  106. </div>
  107. </div>
  108.  
  109. </div>
  110. <!-- end row -->
  111. </div>
  112. <!-- container -->
  113. </div>
  114. <!-- content -->
  115. <?php include('footer.php'); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement