note 64502 added to language.types.array
| From: | phoenixbytes at o2 dot co dot uk | Date: | Mon, 17 Apr 2006 00:10:01 +0000 |
| Subject: | note 64502 added to language.types.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-108297@lists.php.net to get a copy of this message | ||
i use the array() function for deciding upon an email address's validity, i have a 'wap
stalker' of my site that loves to exploit every hole i leave, so i used the following script to
avoid being email bombed with my own file sender script, the array() is used to filter out
undesirable email providers and, of course, any and all of my own addresses. before all that i used
a REGEX to make sure it's an actual email address before going any further.
$mailto = "mail.domain.org"; // the input to be tested
if (preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$/i", $mailto)) // see if
it's really an email address
{
$bad = array('mytrashmail.com', 'mymail.ro', 'acasa.ro',
'gala.net', 'phoenixbytes'); // pick out the victims
foreach($bad as $baddies); // make a collection
if (preg_match("/$baddies/i", $mailto)) // find a match
{
$addrmail = "false";
}
else
{
$addrmail = "true";
}
}
else
{
$addrmail = "false";
}
$addrmail can then be used in an argument.
$baddies can be used to give a list, if necessary.
i hope this helps someone.
----
Server IP: 85.116.0.130
Probable Submitter: 213.205.219.238
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.types.array.php
Edit -- http://master.php.net/note/edit/64502
Del: integrated -- http://master.php.net/note/delete/64502/integrated
Del: useless -- http://master.php.net/note/delete/64502/useless
Del: bad code -- http://master.php.net/note/delete/64502/bad+code
Del: spam -- http://master.php.net/note/delete/64502/spam
Del: non-english -- http://master.php.net/note/delete/64502/non-english
Del: in docs -- http://master.php.net/note/delete/64502/in+docs
Del: other reasons-- http://master.php.net/note/delete/64502
Reject -- http://master.php.net/note/reject/64502
Search -- http://master.php.net/manage/user-notes.php