sanitize - Php safe output -


When user input output I use this function:

  function BBQ ($ Text) {$ Text = htmlspecialchars ($ text); $ Text = nl2br ($ text); $ Hitta = array ("'\ [b] (. *?) \ [/ B]' is', '' [[]] (. *?) \ [/ I] ''); $ Byt = array ("& lt; b & gt; \\ 1 & lt; / b & gt;", "& lt; i & gt; \\ 1 & lt; / i & gt;"); $ Text = preg_replace ($ hitta, $ byt, $ text); Return $ text; }  

Is it safe enough? I put all in db with mysql_real_escape_string and output it with htmlspecialchars . I am a very suspicious person: P

thanks

Already very good Explanation on this topic is, of course, you definitely need to work on your in-and-output, it is actually safe!


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -