Guest User

Untitled

a guest
Jun 20th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. // You have to make a form that submits to this. Also have a config.php with db info
  2. <?php
  3. include("config.php");
  4.  
  5. error_reporting(E_ALL);
  6. ini_set('display_errors', 1);
  7.  
  8. $uusername = $_POST["name"];
  9. $upassword = $_POST["password"];
  10. $fusername = preg_replace("/[^a-zA-Z]+/", "", $uusername);
  11.  
  12. $phash = password_hash($upassword, PASSWORD_DEFAULT);
  13.  
  14.  
  15.  
  16. if ($conn->connect_error) {
  17. die("rip u: " . $conn->connect_error);
  18. }
  19. if ($fusername == "") {
  20. die("dead");
  21. }
  22. $stmt = $conn->prepare("INSERT INTO users (username, password) VALUES (?, ?)");
  23. $stmt->bind_param("ss", $fusername, $phash);
  24. $stmt->execute();
  25. echo "Sucessfully Registered";
  26.  
  27. $stmt->close();
  28. $conn->close();
  29.  
  30.  
  31. ?>
Add Comment
Please, Sign In to add comment