note 95287 added to function.mail
| From: | dsbeam at gmail dot com | Date: | Wed, 23 Dec 2009 23:57:43 +0000 |
| Subject: | note 95287 added to function.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164295@lists.php.net to get a copy of this message | ||
To improve Alex M.'s example:
<?php
foreach($_REQUEST as $fields => $value)
{
if(preg_match("/((TO|CC|CCO)\:)|Content\-Type/i", $value))
{
exit("ERROR: Code injection attempt denied! Please don't use the following
sequences in your message: 'TO:', 'CC:', 'CCO:' or
'Content-Type'.");
}
}
?>
This is not deprecated in PHP 5.3 (all ereg functions are as of this release) and does the whole
regular expression in one line (one of the coolest parts of using them!).
----
Server IP: 69.147.83.197
Probable Submitter: 71.136.198.195
----
Manual Page -- http://www.php.net/manual/en/function.mail.php
Edit -- https://master.php.net/note/edit/95287
Del: integrated -- https://master.php.net/note/delete/95287/integrated
Del: useless -- https://master.php.net/note/delete/95287/useless
Del: bad code -- https://master.php.net/note/delete/95287/bad+code
Del: spam -- https://master.php.net/note/delete/95287/spam
Del: non-english -- https://master.php.net/note/delete/95287/non-english
Del: in docs -- https://master.php.net/note/delete/95287/in+docs
Del: other reasons-- https://master.php.net/note/delete/95287
Reject -- https://master.php.net/note/reject/95287
Search -- https://master.php.net/manage/user-notes.php