Re: Preventing SQL Injection/ Cross Site Scripting

From: Date: Sat, 21 Apr 2007 21:22:54 +0000
Subject: Re: Preventing SQL Injection/ Cross Site Scripting
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-253447@lists.php.net to get a copy of this message
Dotan Cohen wrote: > One note, I remove semicolons from the user input to thrart SQL > injection as they can be used to terminate an SQL query and are > very uncommon in regular speech. However, htmlspecialchars() > and htmlentities add semicolons when converting. Is this > dangerous, ie, can this be exploited? If you ever use htmlentities() to escape data for SQL or mysql_real_escape_string() to escape data for HTML, then yes, it is dangerous. Escaping functions are context-dependent. Hope that helps. Chris -- Chris Shiflett http://shiflett.org/

« previous php.general (#253447) next »