Advertisement
Guest User

regga ny

a guest
Jan 20th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2. require"connect_db.php";
  3. $DB_con = connect_db();
  4. session_start();
  5.  
  6.  
  7. if (isset($_POST['submit'])) {
  8.     $username = $_POST['username'];
  9.     $password = $_POST['passwordone'];
  10.     $password2 = $_POST['passwordtwo'];
  11.     $email = $_POST['email'];
  12.  
  13.  
  14.     if ($_POST['passwordone'] == $_POST['passwordtwo']) {
  15.  
  16.         $passhashed = password_hash($password, PASSWORD_DEFAULT);
  17.         $stmt = $DB_con->prepare("INSERT INTO tbl_users(username, password, email) VALUES ( :user, :pass, :email)");
  18.         $stmt->bindParam(":user", $username);
  19.         $stmt->bindParam(":pass", $passhashed);
  20.         $stmt->bindParam(":email", $email);
  21.         $stmt->execute();
  22.         header("location: main_login.php");
  23.  
  24.  
  25.     } else {
  26.         echo "<div class=\"wrongpw\">The passwords did not match. Please try again.</div>";
  27.  
  28.     }
  29.  
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement