Hi all, I've got a paid-for web site hosted on geocities, and I guess I must be blind or something today, because the email address validation aspect of my script was working fine yesterday, but today its not working at all. Even if I put "wtf" in the email field, it gets passed through. Here's my code:
<label>E-mail Address</label>
<input tabindex="54" name="Email" type="text" maxlength="50" size="17" id="Email" /> <span style="color:red">*</span>
And PHP snippets:
if(($check_email_address == "yes") && (!empty($email))) {
if(!check_email($email)) {
include_dodosmail_header($dodosmail_header_file);
echo "<fieldset><legend>Error</legend><p class=\"DodosMailError\"><br />Error - the email address ".dodosmail_error_handle($email)." is not valid!\n";
echo "<br /><br /><a href=\"javascript:history.back(1)\">Go Back</a>\n";
echo "</p></fieldset>\n";
include_dodosmail_footer($dodosmail_footer_file);
exit;
}
}
/* ----------------------------------------------------------------------------------------- */
function check_email($email) {
if( (preg_match('/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/', $email)) ||
(preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/',$email)) ) {
return true;
}
return false;
}