Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require"connect_db.php";
- $DB_con = connect_db();
- session_start();
- if (isset($_POST['submit'])) {
- $username = $_POST['username'];
- $password = $_POST['passwordone'];
- $password2 = $_POST['passwordtwo'];
- $email = $_POST['email'];
- if ($_POST['passwordone'] == $_POST['passwordtwo']) {
- $passhashed = password_hash($password, PASSWORD_DEFAULT);
- $stmt = $DB_con->prepare("INSERT INTO tbl_users(username, password, email) VALUES ( :user, :pass, :email)");
- $stmt->bindParam(":user", $username);
- $stmt->bindParam(":pass", $passhashed);
- $stmt->bindParam(":email", $email);
- $stmt->execute();
- header("location: main_login.php");
- } else {
- echo "<div class=\"wrongpw\">The passwords did not match. Please try again.</div>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement