Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if ( !isset($_SESSION['username']) ) {
  4. header('location:welcome.php');
  5. }
  6. else {
  7. $usr = $_SESSION['username'];
  8. }
  9. require_once('koneksi.php');
  10. $query = mysql_query("SELECT * FROM user WHERE username = '$usr'");
  11. $hasil = mysql_fetch_array($query);
  12. ?>
  13. <?php
  14. $namareseller = $_POST['nama'];
  15. $fbid = $_POST['fbid'];
  16. $userreseller = $_POST['username'];
  17. $password = $_POST['password'];
  18. $datehistory = date('d - m - Y');
  19. $jumlah = $_POST['jumlah'];
  20. if ($jumlah == '100000') {
  21. $price = 50000;
  22. $bonus = 100000;
  23. } else if ($jumlah == '250000') {
  24. $price = 50000;
  25. $bonus = 250000;
  26. }
  27. if ($hasil['saldo'] < $price) { ?>
  28. ERROR : Saldo tidak mencukupi
  29. <?php
  30. } else {
  31. $cekuser = mysql_query("SELECT * FROM user WHERE username = '$userreseller'");
  32. if(mysql_num_rows($cekuser) <> 0) {
  33. echo "ERROR : Username sudah terdaftar..";
  34. } else if(!$user || !$password) {
  35. echo "ERROR : Masih ada data yang kosong";
  36. } else {
  37. $simpan = mysql_query("INSERT INTO user VALUES('$namareseller','$userreseller','$password','Agen','$bonus','Nur Rifqi Alhusaini','$fbid')");
  38. $simpan = mysql_query("UPDATE user SET saldo=saldo-$price WHERE username = '$usr'");
  39. if($simpan) { ?>
  40. Penambahan reseller telah berhasil, berikut data : <br>
  41. <table class="table table-bordered">
  42. <thead>
  43. <tr>
  44. <th>Nama</th>
  45. <th>Username</th>
  46. <th>Password</th>
  47. <th>Saldo</th>
  48. <th>Tanggal Daftar</th>
  49. <th>Status</th>
  50. <th>Didaftarkan Oleh</th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. <tr>
  55. <td><?php echo $namareseller; ?></td>
  56. <td><?php echo $userreseller; ?></td>
  57. <td><?php echo $password; ?></td>
  58. <td>Rp <?php echo $jumlah; ?></td>
  59. <td><?php echo $datehistory; ?></td>
  60. <td><div class="alert-success"><i class="fa fa-check"></i> Verifered Account</div></td>
  61. <td>Nur Rifqi Alhusaini</td>
  62. </tr>
  63. </tbody>
  64. </table>
  65. *Simpan bukti ini, jika error saat login silahkan hubungi admin.
  66. <?php }
  67. }
  68. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement