Hi Chris,
This is what I use for email inputs.
if ($type == 'email') {
$raw = trim($raw);
$raw = substr($raw, 0, 200);
$raw = strtolower($raw);
$raw = preg_replace('/[EMAIL PROTECTED]/', '*', $raw);
return;
}
It's part of a larger routine I use for different form inputs.
All inputs stripped of tags regardless and checked from POST beforehand.
Any invalid characters get a *
Then checked for see if it's validly formed.
function validate_email($email) {
if (strlen($email) <10) {return false;}
$format = "/^[-_a-z0-9]+(\.[-_a-z0-9]+)[EMAIL
PROTECTED](\.[-a-z0-9]+)*\.[a-z]{2,6}$/i";
return (preg_match($format, $email));
}
I hope this will stop multiple emails sent.
I record all mail sent anyway, so I know how much it's being used (or abused).
Someone let me know, if this can be misused or improved.
Bob.
----- Original Message -----
From: "Chris" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, January 29, 2006 9:07 AM
Subject: RE: [php-list] Need help on a php form
> Thank you for that, here goes. I'm trying to
> ensure that
> the form is not abused by spammers, but not quite
> sure
> how to do it.
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/