Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2.  
  3. include_once("includes/mysql.php");
  4.  
  5. if(isset($_POST['submit'])) {
  6.  
  7. $username = $_POST['username'];
  8. $password = $_POST['password'];
  9.  
  10. // Assuming your hashing your passwords with MD5
  11. $password = md5($password);
  12.  
  13. $query = "SELECT * FROM members WHERE username = '$username' AND password = 'password'";
  14. $action = mysql_query($query);
  15. $checkup = mysql_num_rows($action);
  16.  
  17. if($checkup == 0) {
  18.     // Login failed. Actions here.
  19. } else {
  20.     // Login passed. Actions here.
  21. }
  22.  
  23. }
  24.  
  25. die();
  26.  
  27. ?>
  28.  
  29. <html>
  30. <head>
  31.     <title>Login Form</title>
  32. </head>
  33. <body>
  34.     <h1>Login!</h1>
  35.     <form id="login" method="post" action="">
  36.         Username: <input name="username" type="text" /> <br />
  37.         Password: <input name="password" type="password"/> <br />
  38.             <button type="submit" name="submit">Login!</button>
  39.     </form>
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement