in reply to Re^2: Removing malicious HTML entities (now with more questions!)
in thread Removing malicious HTML entities (now with more questions!)

You should always plan to use it with CGI scripts

The trick to untaint data, as far as I am aware, is to ensure your data is correct . i.e. do data validation. Usually this means using (tight) regexps to ensure the user input doesn't go outside expected bounds.

From what I have read, if you are entering anything into a db then you might want to SQL-escape it too so that people can't hijack your database and delete everything.

HTML::Entites will help display stuff that might otherwise break your web page - what's left that can beak your db?

  • Comment on Re^3: Removing malicious HTML entities (now with more questions!)

Replies are listed 'Best First'.
Re^4: Removing malicious HTML entities (now with more questions!)
by Lawliet (Curate) on Aug 18, 2008 at 02:28 UTC
    "If you are entering anything into a db then you might want to SQL-escape it too so that people can't hijack your database"

    By using placeholders, right?

    I'm so adjective, I verb nouns!

    chomp; # nom nom nom

Re^4: Removing malicious HTML entities (now with more questions!)
by techcode (Hermit) on Aug 19, 2008 at 21:53 UTC

      I would always use placeholders simply for the speed increase they offer, but does the use of them imply the placeholder content is, for want of a better phrase, SQL-escaped for the actual DB in use?

      My scan of the documentation didn't find that information for placeholders but seemed to imply that $db->quote() might. I would like to know for sure if placeholders also perform this function.

        Yes it does wrap '' around them. Which can lead to problems when you say want to call a function such as NOW() - because then you don't want it quoted.

        Have you tried freelancing? Check out Scriptlance - I work there. For more info about Scriptlance and freelancing in general check out my home node.