NYCPHP Meetup

NYPHP.org

[nycphp-talk] worm/virus's hammering feedback scripts? POLISHED VERSION

Michael Southwell michael.southwell at nyphp.org
Tue Sep 13 10:31:03 EDT 2005


At 11:20 PM 9/12/2005, you wrote:
>I'm curious as to why you think that the \ in \r and \n need to be
>escaped? I am really searching for and removing "\n" and "\r"
>characters in the string. In my tests this has worked and prevented
>the spam tests from getting out.

It didn't work for me (on Windows):

<?php
$test = 'hello\rworld';
$unescaped = str_replace( "\r", " ", $test );
$escaped = str_replace( "\\r", " ", $test );
echo "unescaped is $unescaped, and escaped is $escaped";

returned

unescaped is hello\rworld, and escaped is hello world

The PHP Manual at http://php.net/types.string suggests that \r should 
work; all I can say is that it didn't for me.


Michael Southwell, Vice President for Education
New York PHP
http://www.nyphp.com/training - In-depth PHP Training Courses 




More information about the talk mailing list