Advertisement
Guest User

Untitled

a guest
Apr 12th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4. include 'connect.php';
  5.  
  6. $hash = crypt('password');
  7. $passErr = $nameErr = "";
  8. $pass = $name = "";
  9.  
  10. if ($_SERVER["REQUEST_METHOD"] == "POST")
  11. {
  12. if (empty($_POST["username"]))
  13. {
  14. $nameErr = "Username is required";
  15. }
  16.  
  17. if (empty($_POST["password"]))
  18. {
  19. $passErr = "Password is required";
  20. }
  21.  
  22. if (empty($passErr) && empty($nameErr) && isset($_POST['username']))
  23. {
  24. $username = mysqli_real_escape_string($con, $_POST['username']);
  25. $password = mysqli_real_escape_string($con, $_POST['password']);
  26. $sql = "SELECT * FROM users WHERE username='$username' and password='$password' and activation='approved'";
  27. $result = mysqli_query($con, $sql);
  28. $count = mysqli_num_rows($result);
  29.  
  30. if (password_verify($_POST['password'], $hash))
  31. {
  32. header('Location:test.php');
  33. }
  34. else
  35. {
  36. echo "Incorrect Username/Password";
  37. }
  38. }
  39. }
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement