Posted By

nicolaspar on 07/12/06


Tagged


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

luman
meth
neverwolf
axthos
juanfalibene


Php limpiar string para ser usado en sql


 / Published in: PHP
 

  1. function limpiar( $str ){
  2. $str= str_replace("'", "'", $str);
  3. $str= str_replace('"', """, $str);
  4. $str= str_replace(";", "&#59;", $str);
  5. $str= str_replace("<", "&#60;", $str);
  6. $str= str_replace(">", "&#62;", $str);
  7. $str= str_replace("drop", "&#100;&#114;&#111;&#112;", $str);
  8. $str= str_replace("javascript", "&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;", $str);
  9. $str= str_replace("script", "&#118;&#98;&#115;&#99;&#114;&#105;&#112;&#116;", $str);
  10. $str= str_replace("vbscript", "&#115;&#99;&#114;&#105;&#112;&#116;", $str);
  11. return $str;
  12. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: axthos on August 19, 2008

Excelente codigo, de hecho le faltaria una que otra palabrita extra, INSERT, UPDATE. >_>

bueno, me ahorraste la función, te mereces una coca light.

You need to login to post a comment.