Guest User

Untitled

a guest
Dec 13th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <?php
  2. $con = mysql_connect("localhost","root","");
  3. if (!$con)
  4. {
  5. die('Could not connect: ' . mysql_error());
  6. }
  7.  
  8. if(empty($_POST['username'])){
  9. echo "Empty username!";
  10. }
  11.  
  12. if(empty($_POST['password'])){
  13. echo "Empty password";
  14. }
  15.  
  16.  
  17.  
  18.  
  19. mysql_select_db("users", $con);
  20.  
  21. mysql_query("INSERT INTO users (username, password )
  22. VALUES ('$username', '$password')");
  23.  
  24. echo "Registration Succesful";
  25.  
  26. mysql_close($con);
  27. ?>
  28.  
  29.  
  30.  
  31. <!DOCTYPE html>
  32. <html>
  33. <body>
  34.  
  35. <form action="">
  36. Username: <input type="text" name="username"><br>
  37. Password: <input type="password" name="password"></form>
  38.  
  39.  
  40.  
  41. </body>
  42. </html>
Add Comment
Please, Sign In to add comment