Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function userSignup($username, $email, $password) {
- require ("include/db_connect.php");
- $username = trim($_POST['username']);
- $password = ($_POST['password']);
- $salt = uniqid($username);
- $algo = "6";
- $rounds = "5000";
- $crypt_salt = "$" . $algo . "$rounds=" . $rounds . "$" . $salt;
- $hashed_pass = crypt($password, $crypt_salt);
- /*** prepare the SQL statement ***/
- $stmt = $dbh->prepare("INSERT INTO Accounts (username, email, hashed_pw) VALUES (?, ?, ?)");
- /*** bind the paramaters ***/
- $stmt->bindParam(1, $username, PDO::PARAM_STR);
- $stmt->bindParam(2, $email, PDO::PARAM_STR);
- $stmt->bindParam(3, $hashed_pass, PDO::PARAM_STR);
- /*** execute the prepared statement ***/
- $stmt->execute();
- /*** close the database connection ***/
- $dbh = null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement