PDA

View Full Version : [SOLVED] preg_match to block email address(es)


zc1
10-05-2007, 04:01 PM
Hi,

I have found the below code I change it to *.EXT instead of the ending of the email address for example *.com

Now if someone had abc.EXT@my-domain.co.uk would the below code echo the message or would it let it pass and only block abc@my-domain.ext ?

Also does anyone know if it is case sensitive ?

Finally how would I have to to check for .EXT and .EXT1 etc..., would I need to repeat the code or can I have it all within the same code, if so how ?

// test block of *.EXT emails
if ( preg_match( "#\.EXT$#", $email ) ) {
echo 'The email address you entered is not allowed.';
exit;
}

angst
10-05-2007, 04:10 PM
I would say it should echo on either, but can't you just test it with some demo strings?

Hi,


Now if someone had abc.EXT@my-domain.co.uk would the below code echo the message or would it let it pass and only block abc@my-domain.ext ?

}

CFMaBiSmAd
10-05-2007, 04:20 PM
Actually, all the answers to your questions about how it does work can be found by testing it yourself.

The only email address of the ones you proposed that it catches is - abc@my-domain.EXT - which I found by actual testing.

zc1
10-05-2007, 04:33 PM
Hi,

Thank you both :D I will test it out, I have also been given some other code to test