0
I have a little problem when making a login system which user should be able to authenticate by your email or Cpf.
I am making the comparison with the value of the login field received, if it is number I do research with Cpf and if it is not I do with email. See below:
if (is_numeric($_POST['email_cpf'])) {
//pesquisa com cpf
}else{
//pesquisa com e-mail
}
This works, the problem is that when the user puts in the login field Cpf in the format with separators 000.000.000-00, this is given as a string and therefore does searches with the email.
I made a function to remove the tabs, but this is bad because if the email for example has dashes or dots, they will also be removed
How do I fix it?
You can define a regular expression that checks if the value matches a CPF.
– Woss