Guest User

Untitled

a guest
Nov 25th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. $username = htmlentities(trim($_POST['txt_username']));
  2. $unpass = htmlentities(trim($_POST['txt_password']));
  3. $password = password_hash($unpass, PASSWORD_BCRYPT, ['cost' => 12] );
  4. $unemail = $_POST['txt_email'];
  5. $email = filter_var($unemail, FILTER_VALIDATE_EMAIL);
  6.  
  7.  
  8. if (isset($_POST['btn_signup']) ){
  9.  
  10. if($guest->check_user_exists($username)){
  11. $errors[]= "Username Already Taken";
  12. }
  13. elseif(strlen($username) < 6){
  14. $errors[] = "Username must be at least 6 characters";
  15. }
  16. elseif(strlen($unpass) < 6){
  17. $errors[] = "Password must be at least 6 characters";
  18. }
  19.  
  20. elseif($guest->check_email_exists($email)){
  21. $errors[]= "Email Already Taken";
  22. }
  23.  
  24. elseif($guest->signup($email,$password,$username)){
  25. header("Location:index.php?registered");
  26. die('didnt redirect');
  27. }
  28. else{
  29. $errors[]= "Invalid Entry";
  30. }
  31.  
  32.  
  33. }
Add Comment
Please, Sign In to add comment