Advertisement
Guest User

Kontoru-sama Desu!

a guest
Apr 6th, 2019
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.48 KB | None | 0 0
  1. <?php
  2. include 'koneksi.php';
  3. if (isset($_POST['btnReset']))
  4. {
  5.     $username = $_POST['username'];
  6.     $cek = mysqli_query($koneksi,"select tiket from penumpang where username= '$username'");
  7.     if(mysqli_num_rows($cek) == 1 )
  8.     {
  9.         $password = $_POST['password'];
  10.         $repassword = $_POST['repassword'];
  11.         if($password != $repassword)
  12.         {
  13.             ?>
  14.                 <script>
  15.                     alert("inputan password tidak sama");
  16.                     window.location.href = 'lupa.php';
  17.                 </script>
  18.             <?php
  19.         } else {
  20.             $password = md5($password);
  21.             $sql = mysqli_query($koneksi,"UPDATE penumpang SET password = '$password' WHERE username = '$username'");
  22.             if($sql)
  23.             {
  24.                 ?>
  25.                     <script>
  26.                         alert("Password telah di Perbarui");
  27.                         window.location.href = 'login.php';
  28.                     </script>
  29.                 <?php
  30.             } else {
  31.                 ?>
  32.                     <script>
  33.                         alert("Password gagal di Perbarui");
  34.                         window.location.href = 'lupa.php';
  35.                     </script>
  36.                 <?php
  37.             }
  38.         }
  39.     } else {
  40.         ?>
  41.             <script>
  42.                 alert("Pastikan username yang anda masukan Benar");
  43.                 window.location.href = 'lupa.php';
  44.             </script>
  45.         <?php
  46.     }
  47. }
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement