Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.08 KB | None | 0 0
  1. <!--
  2. /*
  3. |-------------------------------------------------------------------------|
  4. | |
  5. |-------------------------------------------------------------------------|
  6. | Sweetpedia | Penyedia Layanan Sosial & PPOB |
  7. |-------------------------------------------------------------------------|
  8. | Release Date : 29 January 2019 |
  9. | Developer : Muhammad Frans Julianto |
  10. | UU Nomor 28 Tahun 2014 |
  11. | Menghapus Copyright tidak membuat anda semakin Hebat :) |
  12. |-------------------------------------------------------------------------|
  13. | Sweetpedia | Penyedia Layanan Sosial & PPOB |
  14. |-------------------------------------------------------------------------|
  15. | |
  16. |-------------------------------------------------------------------------|
  17. */
  18. -->
  19. if (isset($_POST['change_pswd'])) {
  20.  
  21. $post_username = $tur->real_escape_string(trim(stripslashes(strip_tags(htmlspecialchars($_POST['username'],ENT_QUOTES)))));
  22. $post_opassword = $tur->real_escape_string(trim(stripslashes(strip_tags(htmlspecialchars($_POST['opassword'],ENT_QUOTES)))));
  23. $post_npassword = $tur->real_escape_string(trim(stripslashes(strip_tags(htmlspecialchars($_POST['npassword'],ENT_QUOTES)))));
  24. $post_cnpassword = $tur->real_escape_string(trim(stripslashes(strip_tags(htmlspecialchars($_POST['cnpassword'],ENT_QUOTES)))));
  25. $new_password = password_hash($post_npassword, PASSWORD_DEFAULT);
  26.  
  27. if (empty($post_npassword) || empty($post_cnpassword) || empty($post_opassword)) {
  28. $msg_type = "error";
  29. $msg_content = "<b>Gagal</b><br>Mohon Mengisi Semua Input.";
  30. } else if ($sess_username == "demo") {
  31. $msg_type = "error";
  32. $msg_content = "<b>Gagal</b><br>Dilarang Mengubah apapun dalam akun demo.";
  33. } else if (strlen($post_npassword) < 5) {
  34. $msg_type = "error";
  35. $msg_content = "<b>Gagal</b><br>Password Terlalu Pendek, Minimal 5 Karakter.";
  36. } else if ($post_cnpassword <> $post_npassword) {
  37. $msg_type = "error";
  38. $msg_content = "<b>Gagal</b><br>Konfirmasi Password Baru Tidak Sesuai.";
  39. } else if ($post_cnpassword <> $post_npassword) {
  40. $msg_type = "error";
  41. $msg_content = "<b>Gagal</b><br>Konfirmasi Password Baru Tidak Sesuai.";
  42. } else {
  43. $check_user = $tur->query("SELECT * FROM users WHERE username = '$post_username'");
  44. if(password_verify($post_opassword, $data_user['password'])) {
  45. $update_user = $tur->query("INSERT INTO catatan (username, note, waktu) VALUES ('$sess_username', 'Kamu telah melakukan aktifitas Ubah Password', '$date $time')");
  46. $update_user = $tur->query("UPDATE users SET password = '$new_password' WHERE username = '$sess_username'");
  47. if ($update_user == TRUE) {
  48. $msg_type = "success";
  49. $msg_content = "<b>Berhasil</b><br>Password Telah Dirubah.";
  50. } else {
  51. $msg_type = "error";
  52. $msg_content = "<b>Gagal</b><br>Password lama salah.";
  53. }
  54.  
  55. }
  56. }
  57. } else if (isset($_POST['change_api'])) {
  58. $set_api1 = random(5);
  59. $set_api2 = random(5);
  60. $set_api3 = random(5);
  61. $set_api4 = random(5);
  62. $set_api5 = random(5);
  63. $set_api_key = $set_api1."-".$set_api2."-".$set_api3."-".$set_api4."-".$set_api5;
  64. $update_user = $tur->query("UPDATE users SET api_key = '$set_api_key' WHERE username = '$sess_username'");
  65. if ($update_user == TRUE) {
  66. $msg_type = "success";
  67. $msg_content = "<b>Berhasil:</b><br> API Key Telah Diubah.";
  68. } else {
  69. $msg_type = "error";
  70. $msg_content = "<b>Gagal</b><br>Error System
  71. .";
  72. }
  73. }
  74. $sess_username = $_SESSION['user']['username']; $check_user = $tur->query("SELECT * FROM users WHERE username = '$sess_username'");
  75. $data_user = mysqli_fetch_assoc($check_user);
  76. ?>
  77. <div class="row">
  78. <div class="col-lg-7">
  79. <div class="card-box">
  80. <h4 class="m-t-0 m-b-30 header-title"><i class="fa fa-key"></i> Ubah Password</h4>
  81. <?php
  82. if ($msg_type == "success") {
  83. ?>
  84. <div class="alert alert-success">
  85. <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
  86. <i class="fa fa-check-circle"></i>
  87. <?php echo $msg_content; ?>
  88. </div>
  89. <?php
  90. } else if ($msg_type == "error") {
  91. ?>
  92. <div class="alert alert-danger">
  93. <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
  94. <i class="fa fa-times-circle"></i>
  95. <?php echo $msg_content; ?>
  96. </div>
  97. <?php
  98. }
  99. ?>
  100. <form class="form-horizontal" role="form" method="POST">
  101. <div class="form-group">
  102. <label class="col-md-5 control-label">Password Baru</label>
  103. <div class="col-md-10">
  104. <input type="password" name="npassword" class="form-control" placeholder="Password Baru">
  105. </div>
  106. </div>
  107. <div class="form-group">
  108. <label class="col-md-5 control-label">Konfirmasi Password Baru</label>
  109. <div class="col-md-10">
  110. <input type="password" name="cnpassword" class="form-control" placeholder="Konfirmasi Password Baru">
  111. </div>
  112. </div>
  113. <div class="form-group">
  114. <label class="col-md-5 control-label">Password Lama</label>
  115. <div class="col-md-10">
  116. <input type="password" name="opassword" class="form-control" placeholder="Password Lama">
  117. </div>
  118. </div>
  119. <div class="form-group row justify-content-end">
  120. <div class="pull-right">
  121. <button type="reset" class="btn btn-danger"><i class="fa fa-refresh"></i> Ulangi </button>
  122. <button type="submit" name="change_pswd" class="btn btn-success"><i class="fa fa-send"></i> Kirim </button>
  123. </div>
  124. </div>
  125. </form>
  126. </div>
  127. </div> <!-- end col -->
  128.  
  129. <div class="col-lg-5">
  130. <div class="card-box">
  131. <h4 class="m-t-0 m-b-30 header-title"><i class="fa fa-user"></i> Profil</h4>
  132. <form class="form-horizontal" role="form" method="POST">
  133. <div class="form-group">
  134. <label>Username</label>
  135.  
  136. <input type="text" name="username" class="form-control" value="<?php echo $data_user['username']; ?>" readonly>
  137.  
  138. </div>
  139. <div class="form-group">
  140. <label>API Key</label>
  141. <div class="input-group">
  142. <input type="text" class="form-control" value="<?php echo $data_user['api_key']; ?>" readonly>
  143. <span class="input-group-btn">
  144. <button class="btn btn-success" name="change_api">Ubah</button>
  145. </span>
  146. </div>
  147. </div>
  148. <div class="form-group">
  149. <label>Email</label>
  150. <div class="input-group">
  151. <input type="text" class="form-control" value="<?php echo $data_user['email']; ?>" readonly>
  152. </div>
  153. </div>
  154. <br />
  155. <br />
  156. </form>
  157.  
  158. </div>
  159. </div>
  160. </div> <!-- end row -->
  161.  
  162. </div> <!-- end container -->
  163. </div> <!-- end wrapper -->
  164.  
  165. <!-- Footer -->
  166. <footer class="footer">
  167. <div class="container">
  168. <div class="col-12 text-center">
  169. 2019 © Sweetpedia - SMM Panel Indonesia
  170. </div>
  171. </div>
  172. </footer>
  173. <!-- End Footer -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement