Advertisement
Guest User

Untitled

a guest
Jun 8th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5.  
  6. <?php
  7. $servername = "localhost";
  8. $username = "root";
  9. $password = "";
  10. $dbname = "LoginDB";
  11. $fName = $_POST["fName"];
  12. $fPsw = $_POST["fPsw"];
  13. // Create connection
  14. $conn = new mysqli($servername, $username, $password, $dbname);
  15. // Check connection
  16. if ($conn->connect_error) {
  17. die("Connection failed: " . $conn->connect_error);
  18. }
  19.  
  20. $sql = "SELECT * FROM `data` WHERE Name =".$fName."LIMIT 1";
  21.  
  22. $result = $conn->query($sql);
  23. $row = $result->fetch_assoc();
  24.  
  25. if ($result->num_rows > 0 && $row["Password"] == $fPsw) {
  26. echo "Hello ".$row["Role"]." ". $row["Name"];
  27. } else {
  28. echo "0 results";
  29. }
  30.  
  31. $conn->close();
  32. ?>
  33.  
  34. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement