Guest User

Untitled

a guest
Jun 28th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title></title>
  4. </head>
  5.  
  6. <body>
  7. <form method="POST">
  8.  
  9. Username: <input type="text" name="username"></br>
  10. Password: <input type="password" name="password"></br>
  11. <input type="submit" value="Log in" name='log'></br>
  12. </form>
  13.  
  14. </body>
  15. </html>
  16.  
  17. <?php
  18. if(isset($_POST['log']))
  19. {
  20. $username = $_POST['username'];
  21. $password = $_POST['password'];
  22.  
  23.  
  24. if (isset($username) && isset($password))
  25. {
  26.  
  27. $connection = mysql_connect("localhost", "stu12985_db1", "3ooM6eBC");
  28. $database = "stu12985_db1";
  29. mysql_select_db($database,$connection);
  30.  
  31. $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  32. $numrow = mysql_num_rows($query);
  33. echo "Num: ".$numrow;
  34.  
  35. if ($numrow > 0)
  36. {
  37. while ($row = mysql_fetch_assoc($query))
  38. {
  39.  
  40. $dbusername = $row['username'];
  41. $dbpassword = $row['password'];
  42.  
  43. if ($username==$dbusername&&$password==$dbpassword)
  44. {
  45. echo "You have logged in succesfully!";
  46.  
  47. }
  48.  
  49. else
  50. {
  51. echo "Incorrect Pass.!";
  52. }
  53. }
  54. }
  55. else
  56. {
  57. echo "oebele";
  58.  
  59. }
  60. }
  61. else
  62. {
  63. echo "Enter an username and a password";
  64. }
  65. }
  66. ?>
Add Comment
Please, Sign In to add comment