Php Folks,
Note the trim.
Which example should I use out of the three ? Which one invalid and why invalid ?
1.
““
$domain_email = $_POST[‘domain_email’];
$password = $_POST[‘password’];
if(!filter_var(trim($domain_email,FILTER_SANITIZE_EMAIL)))
{
die(“Error 1a: Input the VALID Email Address belonging to your account!”);
}
if(!filter_var(trim($domain_email,FILTER_VALIDATE_EMAIL)))
{
die(“Error 1b: Input the VALID Email Address belonging to your account!”);
}
if(!filter_var(trim($password,FILTER_SANITIZE_STRING)))
{
die(“Error 1c: Input the correct Password belonging to your account!”);
}
2.
““
$domain_email = trim($_POST[‘domain_email’]);
$password = trim($_POST[‘password’]);
if(!filter_var($domain_email,FILTER_SANITIZE_EMAIL)))
{
die(“Error 1a: Input the VALID Email Address belonging to your account!”);
}
if(!filter_var($domain_email,FILTER_VALIDATE_EMAIL)))
{
die(“Error 1b: Input the VALID Email Address belonging to your account!”);
}
if(!filter_var$password,FILTER_SANITIZE_STRING)))
{
die(“Error 1c: Input the correct Password belonging to your account!”);
}
3.
““
$domain_email = trim($domain_email = $_POST[‘domain_email’]);
$password = trim($password = $_POST[‘password’]);
if(!filter_var($domain_email,FILTER_SANITIZE_EMAIL)))
{
die(“Error 1a: Input the VALID Email Address belonging to your account!”);
}
if(!filter_var($domain_email,FILTER_VALIDATE_EMAIL)))
{
die(“Error 1b: Input the VALID Email Address belonging to your account!”);
}
if(!filter_var$password,FILTER_SANITIZE_STRING)))
{
die(“Error 1c: Input the correct Password belonging to your account!”);
}