Advertisement
Guest User

Untitled

a guest
Dec 11th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. </head>
  5. <body>
  6. <form method="POST" enctype="multipart/form-data" action="<?PHP echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" accept-charset="UTF-8">
  7. <h4><label>Sign up</label></h4>
  8. <p><label>Username<strong>*</strong><br>
  9. <input type="text" size="48" name="username"></label></p>
  10. <p><label>Password<strong>*</strong><br>
  11. <input type="password" size="48" name="password" ></label></p>
  12. <p><label>Email<br>
  13. <input type="email" size="48" name="email"></label></p>
  14. <p><input type="submit" name="sendfeedback" value="Sign up"></p>
  15. </form>
  16. <?php
  17. $servername = "localhost";
  18. $username = "safsom2";
  19. $password = "somil888";
  20. $dbname = "appDB";
  21.  
  22. // Create connection
  23. $conn = new mysqli($servername, $username, $password);
  24.  
  25. // Check connection
  26. if ($conn->connect_error) {
  27. die("Failed connecting to user database : " . $conn->connect_error);
  28. }
  29.  
  30. echo 'Success connecting to user database.';
  31.  
  32. if (isset($_POST['sendfeedback'])) {
  33.  
  34. $uname = $_POST['username'];
  35. $passwd = $_POST['password'];
  36. $email = $_POST['email'];
  37.  
  38. if (!$conn->query("INSERT INTO users (username, password, email)
  39. VALUES ('$uname', '$passwd', '$email', '".$_SERVER['REMOTE_ADDR']."')") ) {
  40. echo '<br>Failed account creation';
  41. }
  42.  
  43. else {
  44. echo '<br>Created account';
  45. }
  46. }
  47.  
  48. ?>
  49. </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement