I'm trying to set character limits for a register page and no matter what it says the username is too long can you guys tell me what's wrong? see the error for your self
if(mb_strlen($uname) >= 20){
if(mb_strlen($uname) <= 6){
if(mb_strlen($pass1) <= 8){
if(mb_strlen($pass1) >= 16){
if((mb_strlen($email)) > 5 && strstr(($email1), "@") && strstr(($email1),".")){
$pass = md5(md5("47Jdfio209".$pass1."4jfhioJasify3"));
$pass = hash('sha512',$pass);
$sql = $mysqli -> query("SELECT * FROM `archewor_users`.`users` WHERE `uname` = '$uname'");
if(mysqli_num_rows($sql) > 0){
echo"Sorry, that user already exists.";
exit();
}
$mysqli -> query("INSERT INTO `archewor_users`.`users` (`id`, `name`, `lname`, `uname`, `email`, `pass`) VALUES (NULL, '$name', '$lname', '$uname', '$email1', '$pass')") or die(mysqli_error());
}else{echo 'Your email must be valid.';}
}else{echo 'This password is too long';}
}else{echo 'This password is too short';}
}else{echo 'This username is too short';}
}else{echo 'This username is too long';}
}else{
echo "Sorry, your passwords do not match.<br />";
exit();
}
}else{
echo "Sorry, your emails do not match. <br /> <br />";
}
}else{
Logics written by you is incorrect. Check your if conditions for both username and passwords validation. Written code has very poor standard. Use conditional operators instead of nested if conditions.