I currently have a registration script on my website that requires the email to be from a specific domain.
So for this example, we will say that the user needs to signup using a @gmail.com email.
$gmail = 'gmail.com';
$emailCheck = strpos($_POST['email'],$gmail);
I then check to make sure the users form submitted email contains gmail.com before proceeding.
if($emailCheck === false) {
$err[]='Only @gmail.com email addresses are currently accepted.';
}
I only then proceed to continue with the registeration using a check to see if any $err[] have occured.
if(!count($err)) {
// INSERT IN DB, ETC. //
}
The issue I'm having is that if a user fills out [email protected] the script provides and error. If the user provides [email protected] it works as it should. But if the user just inputs the first part of the email leaving out @gmail.com it also works, running the SQL query and inputing the values into the DB.
Any help would be greatly appreciated!
if
body, because $err will be set. Are you sure this is the code that's being executed? – CodeCaster