I'm having a problem when making a login system that the user must be able to authenticate through their e-mail or cpf.
I am doing the comparison with the value of the login field received, if it is number I do search with cpf and if 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 enters the cpf login field in the format with 000.000.000-00 separators, this is given as a string and therefore searches the email.
I made a function to remove the tabs, but this is bad because if the email for example has traces or dots, they will also be removed
How do I resolve this?