Advertisement
Guest User

Untitled

a guest
Jan 13th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1.  
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <meta name="description" content="">
  8. <meta name="author" content="">
  9. <link rel="icon" href="../../favicon.ico">
  10.  
  11. <title>SQL Injection</title>
  12.  
  13. <!-- Bootstrap core CSS -->
  14. <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  15.  
  16. <!-- Custom styles for this template -->
  17. <link href="signin.css" rel="stylesheet">
  18. </head>
  19.  
  20. <body>
  21.  
  22. <div class="container">
  23.  
  24. <form class="form-signin" method="POST">
  25.  
  26. <?php
  27. if(isset($_POST['username']))
  28. {
  29. $username = $_POST['username'];
  30. $password = $_POST['password'];
  31. $con = mysqli_connect('localhost','root','password','sample');
  32. $result = mysqli_query($con, "SELECT * FROM `users` WHERE username='$username' AND password='$password'");
  33. if(mysqli_num_rows($result) == 0)
  34. echo 'Invalid username or password';
  35. else
  36. echo '<h2>Logged in</h2><p>A Secret for you....</p>';
  37. }
  38. else
  39. {
  40. ?>
  41. <h2 class="form-signin-heading">Please sign in</h2>
  42. <label for="inputEmail" class="sr-only">Username</label>
  43. <input type="text" name="username" id="inputEmail" class="form-control" placeholder="Username" required autofocus>
  44. <label for="inputPassword" class="sr-only">Password</label>
  45. <input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required>
  46. <button class="btn btn-lg btn-primary btn-block" name="submit" type="submit">Sign in</button>
  47.  
  48. <?php
  49. }
  50. ?>
  51. </form>
  52.  
  53. </div> <!-- /container -->
  54. </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement