Advertisement
Guest User

Untitled

a guest
Mar 28th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 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.             if (password_verify($password, $row['password'])) {
  13.                 echo "Hello there $username <br>";
  14.             } else {
  15.                 echo "Password is incorrect <br>";
  16.             }
  17.         }
  18.     } else {
  19.         echo "0 results";
  20.     }
  21. } else {
  22.     echo "Error, username or password missing!";
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement