Reply to Filtering to prevent mail injection

Your name:

Reply:


Posted by Tobierre on 10/25/05 02:27

Hi All,

I want to filter user input from a form to guard against mail injection.
I'm a complete novice when it comes to regular expressions! But I've
managed to pull together the below code together from reading around various
sites etc.

$filter[] = preg_match("/\\\N/ i", $string);
$filter[] = preg_match("/\\\R/ i", $string);
$filter[] = preg_match("/bcc:/ i", $string);
$filter[] = preg_match("/to:/ i", $string);
$filter[] = preg_match("/content-type/ i", $string);

if(array_sum($filter) > 0)
{
//redirect user and do not send mail
}
else
{
//send mail and display thank you
}

What I wanted to know, is this the most efficient way of doing this with
Regular Expressions? or does anyone know of any native PHP functions that
can do the same quicker?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация