1
I have a problem when I use MD5 in my passwords, I have verification:
if(empty($regPassword)){
exit('<div class="alert alert-danger margin-top15">» A <b>senha</b> é necessária e não pode ser vazia.</div>');
}
if(empty($regConfirmpass)){
exit('<div class="alert alert-danger margin-top15">» <b>Confirmar a senha</b> é necessário e não pode ser vazio.</div>');
}
When I use this in my variable:
$regPassword = trim(strip_tags(md5($_POST['regPassword'])));
$regConfirmpass = trim(strip_tags(md5($_POST['regConfirmpass'])));
The check doesn’t work someone knows why?
Complete code in: Here
Doesn’t work like? Here it worked by putting the same password.
– Rafael Almeida
It does not work to check if the user leaves the registration empty password field anyway.
– Gabriel
It turns out that the function
md5
will generate a hash in the same way, however it is a hash of an empty string.– Paulo Rodrigues
trim
andstrip_tags
are unnecessary in your code because themd5
will not return white spaces or tags– Lucas
I withdrew and even so continues registering even leaving the input empty password, removed the md5 and the check worked, This weird I want it to work with MD5
– Gabriel
You are checking before or after applying md5?
– Oeslei
After applying md5 in the method $_POST
– Gabriel