Advertisement
Guest User

index php

a guest
Nov 12th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <?php
  2. include("config.php");
  3.  
  4. if($_SERVER["REQUEST_METHOD"] == "POST") {
  5. // username and password sent from form
  6.  
  7. //$myusername = mysqli_real_escape_string($db, $_POST['username']);
  8. //$mypassword = mysqli_real_escape_string($db, $_POST['password']);
  9.  
  10.  
  11. $myusername = $_POST['username'];
  12. $mypassword = $_POST['password'];
  13.  
  14.  
  15. $sql = "SELECT * FROM LoginInfo WHERE 'Username' = $myusername AND 'Password' = $mypassword";
  16. //$sql = "SELECT * FROM 'LoginInfo' WHERE 'Username' = '$myusername' AND 'Password' = '$mypassword'";
  17.  
  18. $result = mysqli_query($db, $sql);
  19. $count = mysqli_num_rows($result);
  20.  
  21.  
  22. // If result matched $myusername and $mypassword, $result evaluates to true
  23.  
  24. if ($count == 1) {
  25. echo "user found and password matched!";
  26. }
  27.  
  28. else {
  29. echo "Your Login Name or Password is invalid. Try again. ";
  30.  
  31. }
  32. }
  33. ?>
  34.  
  35. <html lang="eng">
  36.  
  37. <head>
  38. <title>Login Page</title>
  39.  
  40.  
  41. </head>
  42.  
  43. <body bgcolor = "#FFFFFF">
  44.  
  45. <form action = "" method = "post">
  46. <input type="username" class="text" name="username" placeholder="Enter username" required="required">
  47. <input type="password" class="text" name="password" placeholder="Password" required="required">
  48. <input class="btn" type="submit" value="Submit">
  49. </form>
  50.  
  51.  
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement