Guest User

Untitled

a guest
Apr 12th, 2016
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php
  2. require("sessionConfig.php");
  3. if($_SERVER["REQUEST_METHOD"] == "POST")
  4. {
  5. $username=mysqli_real_escape_string($dbconfig,$_POST['username']);
  6. $password=mysqli_real_escape_string($dbconfig,$_POST['password']);
  7.  
  8. $sql_query="SELECT * FROM users WHERE username='$username'";
  9. $result=mysqli_query($dbconfig,$sql_query);
  10. $row=mysqli_fetch_array($result,MYSQLI_ASSOC);
  11. $count=mysqli_num_rows($result);
  12.  
  13. if($count==1 && password_verify($password, $row['password']))
  14. {
  15. $_SESSION['login_user']=$username;
  16. header("location: home.php");
  17. }
  18. else
  19. {
  20. $response="Incorrect Username or Password!";
  21. }
  22. }
  23.  
  24. if(isset($_SESSION['login_user']))
  25. {
  26. header("Location: home.php");
  27. }
  28. ?>
Add Comment
Please, Sign In to add comment