Advertisement
Guest User

Untitled

a guest
Mar 28th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1. <?php
  2. if (isset($_POST['username']) && isset($_POST['password'])) {
  3.     $username       = $_POST['username'];
  4.     $password       = $_POST['password'];
  5.     $hashedPassword = password_hash($password, PASSWORD_DEFAULT);
  6.     //require"databaseConfig.php";
  7.     $sql            = "select * from userreg where UserName = '$username'";
  8.     require "databaseConfig.php";
  9.     $qryResult = mysqli_query($conn, $sql);
  10.     if (mysqli_num_rows($qryResult) > 0) {
  11.         while ($row = mysqli_fetch_assoc($qryResult)) {
  12.             print_r($row);
  13.             die;
  14.  
  15.             if (password_verify($password, $row['password'])) {
  16.                 echo "Hello there $username <br>";
  17.             } else {
  18.                 echo "Password is incorrect <br>";
  19.             }
  20.         }
  21.     } else {
  22.         echo "0 results";
  23.     }
  24. } else {
  25.     echo "Error, username or password missing!";
  26. }
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement