Preventing XSS Attacks

From: Date: Wed, 10 Jun 2009 16:19:28 +0000
Subject: Preventing XSS Attacks
Groups: php.general 
Request: Send a blank email to php-general+get-293877@lists.php.net to get a copy of this message
Hi all, I'm looking at adding a new search feature to my site, and one of the elements of this is to echo back in the search results page, the original string the user searched for. Up until now, XSS hasn't (afaik) been an issue for my site, but I can see from a mile off this will be. What would you guys recommend to avoid this? I'd thought initially of using a mixture of html_special_chars() and a regex (as yet not sure what I'll be stripping out with this) to sanitise the output for display on the results page, but is this enough? Thanks Ash www.ashleysheridan.co.uk

« previous php.general (#293877) next »