You are here: Re: preg_match to detect \r\n - doesn't work « PHP Programming Language « IT news, forums, messages
Re: preg_match to detect \r\n - doesn't work

Posted by Curtis on 01/13/07 13:38

Chuck Anderson wrote:
<snip>
> I post the form to send_the_email_contact.php where I have the following
> test:
>
> if(preg_match('`[\r\n]`',$_POST['subject']))
> {
> exit ('injection attempt ');
>
> }
<snip>

You don't necessarily have to stop processing when validating mail
headers. You can easily strip out any CRLFs

<?php
$safeHeader = str_replace(array("\r","\n"), '', $_POST['subject']);
// strips out \r and \n, leaving the rest intact
?>

Curtis

 

Navigation:

[Reply to this 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

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