Guest User

Untitled

a guest
Mar 16th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. <?php session_start(); ?>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <link rel="stylesheet" type="text/css" href="navstyle.css">
  6. </head>
  7. <body>
  8. <div class="topnav">
  9. <a href="home.php">Home</a>
  10. <a class="active" href="a_login.php">News</a>
  11. <a href="a_contact.php">Contact</a>
  12. <a href="a_about.php">About</a>
  13. </div>
  14. <div class="maincontainer">
  15. <form action="" method="post">
  16. <label>email:</label> <input type="text" name="emailinput"><br>
  17. <label>password:</label> <input type="password" name="passwdinput"><br>
  18. <input type="submit" type="submit" name="submit" value="hi">
  19. </form>
  20.  
  21. <?php
  22. if(isset($_POST['submit'])) {
  23. $mysqli = new mysqli("localhost", "root", "", "dbUsers");
  24. if ($mysqli->connect_errno) {
  25. echo $mysqli->connect_errno;
  26. exit;
  27. }
  28. $emailsubmit =$_POST["emailinput"];
  29. $passwdsubmit = $_POST["passwdinput"];
  30. $hash = password_hash($passwdsubmit,PASSWORD_DEFAULT);
  31.  
  32. $authUser = $mysqli->query("SELECT * FROM tblUser WHERE email = '$emailsubmit'");
  33. if ($authUser->num_rows ==1){
  34. $userResults = $authUser->fetch_assoc();
  35. if (password_verify($passwdsubmit,$userResults['passwd'])) {
  36. echo "<p> working </p>";
  37. } else {
  38. echo "<p>not working</p>";
  39. }
  40. }
  41. }
  42. ?>
  43. </div>
  44. </body>
  45. </html>
Add Comment
Please, Sign In to add comment