Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. if(isset($_POST["btnsignup"]))
  2. {
  3. //Username Validation
  4. $cust_username = $_POST["txtcust_username"];
  5. // check if name only contains letters and whitespace
  6. if (!preg_match("/^[a-zA-Z ]*$/",$cust_username)) {
  7. $nameErr = "Only letters and white space allowed";
  8. }
  9.  
  10. //Email Validation
  11. $cust_email = $_POST["txtcust_email"];
  12. // check if e-mail address is well-formed
  13. if (!filter_var($cust_email, FILTER_VALIDATE_EMAIL)) {
  14. $emailErr = "Invalid email format";
  15. }
  16.  
  17. //Password Validation
  18. if(!empty($_POST["txtcust_password"]) && ($_POST["txtcust_password"] == $_POST["txtcust_cpassword"])) {
  19. $cust_password = $_POST["txtcust_password"];
  20. $cpassword = $_POST["txtcust_cpassword"];
  21. if (strlen($_POST["txtcust_password"]) <= '6') {
  22. $passwordErr = "Your Password Must Contain At Least 6 Characters!";
  23. }
  24. elseif(!preg_match("#[0-9]+#",$cust_password)) {
  25. $passwordErr = "Your Password Must Contain At Least 1 Number!";
  26. }
  27. elseif(!preg_match("#[A-Z]+#",$cust_password)) {
  28. $passwordErr = "Your Password Must Contain At Least 1 Capital Letter!";
  29. }
  30. elseif(!preg_match("#[a-z]+#",$cust_password)) {
  31. $passwordErr = "Your Password Must Contain At Least 1 Lowercase Letter!";
  32. }
  33.  
  34. }
  35. elseif(!empty($_POST["txtcust_password"])) {
  36. $cpasswordErr = "Please Check You've Entered Or Confirmed Your Password!";
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement