Guest User

Untitled

a guest
Apr 30th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Register</title>
  5. </head>
  6. <body>
  7. <form action="#" method="POST">
  8. <h3>Register</h3>
  9. Username: <input type="text" name="uname"><br>
  10. Password: <input type="password" name="pass"><br>
  11. <input type="submit" name="btn">
  12. </form>
  13. </body>
  14. </html>
  15. <?php
  16. if (isset($_POST['btn'])) {
  17. $username = $_POST['uname'];
  18. $password = $_POST['pass'];
  19.  
  20. mysql_connect("localhost","root","");
  21. mysql_select_db("login2");
  22.  
  23. $query = "INSERT INTO users VALUES ('','$username','$password')";
  24.  
  25. mysql_query($query);
  26. echo "Registered Successfully";
  27. }
  28. else {
  29. echo "Failed To Register, Try Again";
  30. }
  31. ?>
  32.  
  33. if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  34. // …
  35. }
Add Comment
Please, Sign In to add comment