Re: Preventing Cross Site Scripting Vulnerbilities
| From: | Jason Gerfen | Date: | Wed, 07 Dec 2005 19:34:23 +0000 |
| Subject: | Re: Preventing Cross Site Scripting Vulnerbilities | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-227085@lists.php.net to get a copy of this message | ||
comex wrote:
function chk_input( $string ) { if( eregi( "^[0-9a-z_ -]$", $string ) ) { return 0; } else { return 1; } } if( chk_input( $string ) == 0 ) { echo "valid"; } else { echo "invalid"; } -- Jason Gerfen "Oh I have seen alot of what the world can do, and its breaking my heart in two..." ~ Wild World, Cat StevensSimilarly is there a library function for escaping database content for inclusion in HTML pages?http://php.net/htmlspecialchars http://php.net/htmlentities Or roll your own and replace the eregi regex with data that is valid to your application: