Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4. <title>DaBrix Design Idea 2</title>
  5. <link rel="stylesheet" type="text/css" href="index.css" />
  6. </head>
  7. <body>
  8.  
  9. <?php
  10.  
  11. $form = "<div class='login'>
  12. <form method='post' action='index.php'>
  13. Username: <input type='text' name='username' /><br />
  14. Password: <input type='password' name='password' /><br />
  15. <input type='submit' value='Login' /> |
  16. </form>";
  17.  
  18. mysql_connect('localhost', 'dasher93_dash', 'xd10ah');
  19. mysql_select_db("dasher93_dabrix");
  20.  
  21. if (isset($_POST['username']) && isset($_POST['password']) )
  22. {
  23.  
  24. // This is still unsecure:
  25. $username = $_POST['username'];
  26. $password = $_POST['password'];
  27. $email = $_POST['email'];
  28.  
  29. $user = mysql_query("SELECT * FROM users WHERE username = '$username' AND password = '$password'");
  30.  
  31. if (mysql_num_rows($user) == 1)
  32. {
  33. echo "You are logged in";
  34. }
  35. else
  36. {
  37. echo $form;
  38. echo "Wrong password</div>";
  39. }
  40. }
  41.  
  42.  
  43. else
  44. {
  45. echo $form;
  46. echo "<font size='1'><a href='createaccount.php'>Create an account</a></font></div>";
  47. }
  48.  
  49. // Need to do the DB stuff: SELECT * FROM users WHERE username = $username && password = $password
  50. // Need to contact Ace_Jon
  51.  
  52. ?>
  53.  
  54. </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement