Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // You have to make a form that submits to this. Also have a config.php with db info
- <?php
- include("config.php");
- error_reporting(E_ALL);
- ini_set('display_errors', 1);
- $uusername = $_POST["name"];
- $upassword = $_POST["password"];
- $fusername = preg_replace("/[^a-zA-Z]+/", "", $uusername);
- $phash = password_hash($upassword, PASSWORD_DEFAULT);
- if ($conn->connect_error) {
- die("rip u: " . $conn->connect_error);
- }
- if ($fusername == "") {
- die("dead");
- }
- $stmt = $conn->prepare("INSERT INTO users (username, password) VALUES (?, ?)");
- $stmt->bind_param("ss", $fusername, $phash);
- $stmt->execute();
- echo "Sucessfully Registered";
- $stmt->close();
- $conn->close();
- ?>
Add Comment
Please, Sign In to add comment