note 23487 deleted from function.ereg-replace by kennyt

From: Date: Wed, 26 Jan 2005 03:55:27 +0000
Subject: note 23487 deleted from function.ereg-replace by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-83987@lists.php.net to get a copy of this message
Note Submitter: totge at freestart dot hu ---- If You work with HTML INPUT's users are able to write a " or ' into the string, and that can cause bugs. A possible solution is the following: $name = ereg_replace( "'", "", $name ); $name = ereg_replace( "\"", "", $name ); $name = ereg_replace( "[\]", "", $name ); The reason why the third line is recommended is that ereg_replace() will change every "" to one backslash. The problem is just with the double quote, single quote is repaired in the first line. Don't replace "[\]" with "\\" in the last line it also cause bugs! So with this 3-lines script You get a string without any quotes. Enigma

« previous php.notes (#83987) next »