Advertisement
Guest User

Untitled

a guest
Jun 8th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. <html>
  2. <body>
  3.  
  4. <?php
  5. mysql_connect('localhost', 'root', '');
  6. mysql_select_db('membership');
  7.  
  8.  
  9. if (isset($_POST['submit']))
  10. {
  11. $username = $_POST['user'];
  12. $password = md5($_POST['pass']);
  13.  
  14. $query = mysql_query("SELECT * FROM users WHERE username = '" . $username . "' AND password = '" . $password . "'");
  15. if (mysql_num_rows($query) > 0)
  16. {
  17. echo 'Success';
  18.  
  19.  
  20.  
  21.  
  22. }
  23. else
  24. {
  25. echo 'Fail';
  26. echo '<br><a href="index.php">Go Back</a>';
  27. }
  28. }
  29. else
  30. {
  31.  
  32. ?>
  33.  
  34.  
  35. <form method="POST">
  36. <label for="user">Username:</label>
  37. <input type="text" name="user" /><br />
  38. <label for="pass">Password:</label>
  39. <input type="text" name="pass" size="5" /><br />
  40. <input type="submit" name="submit" value="Submit" />
  41. </form>
  42.  
  43. <a href="register.php">Register</a>
  44.  
  45. <?php
  46. }
  47. ?>
  48.  
  49. </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement