Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <?php
  9. if (!empty($_POST)) {
  10.  
  11. $servername = "localhost";
  12. $username1 = "dxa6145";
  13. $password1 = "hawaiisomeone";
  14. $dbname = "dxa6145";
  15.  
  16. $username = $_POST['username'];
  17. $password = $_POST['password'];
  18.  
  19. echo $username;
  20. echo $password;
  21. echo "000";
  22. $conn = new mysqli($servername, $username1, $password1, $dbname);
  23.  
  24. if ($conn->connect_error) {
  25. die("Connection failed: " . $conn->connect_error);
  26. }
  27.  
  28. echo $username;
  29. echo $password;
  30. echo "111";
  31.  
  32. if ($_SERVER["REQUEST_METHOD"] == "POST") {
  33. if (isset($_POST['username']) && isset($_POST['password'])) {
  34.  
  35. $sql = "SELECT username FROM users WHERE username=" . $username . " AND password=MD5(" . $password . ")";
  36. echo "232";
  37. $result = $conn->query($sql);
  38. echo "222";
  39. if ($result->num_rows > 0) {
  40. echo "333";
  41. while ($row = $result->fetch_assoc()) {
  42. echo "Welcome " . $row["username"];
  43. }
  44. } else {
  45. echo "0 results";
  46. }
  47. }
  48. }
  49. }
  50. ?>
  51. <form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" name="form" novalidate>
  52. <fieldset>
  53. <legend>Login</legend>
  54. <br>Username: <input type="text" name="username">
  55. <br>Password: <input type="password" name="password">
  56. <input type="submit" value="Submit">
  57. </fieldset>
  58. </form>
  59. </body>
  60. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement