Re: [PHP] Preventing XSS Attacks

[email protected] (tedd)
Newsgroups php.general
Message-ID <p06240801c656b302c731@[192.168.1.102]>
At 7:08 PM +0100 6/10/09, Ashley Sheridan wrote:
>
>So something like this would be acceptable?:
>
>$searchTerms = (isset($_REQUEST['q']))?$_REQUEST['q']:'';
>$searchTerms = htmlentities($searchTerms);
>$dbSearchTerms = mysql_real_escape_string($searchTerms);
>
>Giving me two variables, one for display output to user, the other for
>use in the database?
>
>Thanks
>Ash

Ash:

I wouldn't use $_REQUEST.  If you know the request method then use it.

There can be problems using $_REQUEST.

Cheers,

tedd

-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.