Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(isset($_POST["btnsignup"]))
- {
- //Username Validation
- $cust_username = $_POST["txtcust_username"];
- // check if name only contains letters and whitespace
- if (!preg_match("/^[a-zA-Z ]*$/",$cust_username)) {
- $nameErr = "Only letters and white space allowed";
- }
- //Email Validation
- $cust_email = $_POST["txtcust_email"];
- // check if e-mail address is well-formed
- if (!filter_var($cust_email, FILTER_VALIDATE_EMAIL)) {
- $emailErr = "Invalid email format";
- }
- //Password Validation
- if(!empty($_POST["txtcust_password"]) && ($_POST["txtcust_password"] == $_POST["txtcust_cpassword"])) {
- $cust_password = $_POST["txtcust_password"];
- $cpassword = $_POST["txtcust_cpassword"];
- if (strlen($_POST["txtcust_password"]) <= '6') {
- $passwordErr = "Your Password Must Contain At Least 6 Characters!";
- }
- elseif(!preg_match("#[0-9]+#",$cust_password)) {
- $passwordErr = "Your Password Must Contain At Least 1 Number!";
- }
- elseif(!preg_match("#[A-Z]+#",$cust_password)) {
- $passwordErr = "Your Password Must Contain At Least 1 Capital Letter!";
- }
- elseif(!preg_match("#[a-z]+#",$cust_password)) {
- $passwordErr = "Your Password Must Contain At Least 1 Lowercase Letter!";
- }
- }
- elseif(!empty($_POST["txtcust_password"])) {
- $cpasswordErr = "Please Check You've Entered Or Confirmed Your Password!";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement