Return to Snippet

Revision: 403
at July 12, 2006 12:42 by nicolaspar


Updated Code
function limpiar( $str ){
    $str= str_replace("'", "'", $str);
    $str= str_replace('"', """, $str);
    $str= str_replace(";", "&#59;", $str);
    $str= str_replace("<", "&#60;", $str);
    $str= str_replace(">", "&#62;", $str);
    $str= str_replace("drop", "&#100;&#114;&#111;&#112;", $str);
    $str= str_replace("javascript", "&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;", $str);
    $str= str_replace("script", "&#118;&#98;&#115;&#99;&#114;&#105;&#112;&#116;", $str);
    $str= str_replace("vbscript", "&#115;&#99;&#114;&#105;&#112;&#116;", $str);
    return $str;
}

Revision: 402
at July 12, 2006 12:39 by nicolaspar


Updated Code
function addslashes(str)
	dim strOut
	strOut = replace(str,"'","&#39;")
	strOut = replace(strOut,"""","&#34;")
	strOut = replace(strOut,";","&#59;")
	strOut = replace(strOut,"<","&#60;")
	strOut = replace(strOut,">","&#62;")
	strOut = eregi(strOut,"drop","&#100;&#114;&#111;&#112;")
	strOut = eregi(strOut,"javascript ","&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;")
	strOut = eregi(strOut,"script ","&#118;&#98;&#115;&#99;&#114;&#105;&#112;&#116;")
	strOut = eregi(strOut,"vbscript ","&#115;&#99;&#114;&#105;&#112;&#116;")
	addslashes = trim(strOut)
end function

Revision: 401
at July 12, 2006 12:37 by nicolaspar


Initial Code
function limpiar( str )
	dim strOut
	strOut = replace(str,"'","'")
	strOut = replace(strOut,"""",""")
	strOut = replace(strOut,";",";")
	strOut = replace(strOut,"<","<")
	strOut = replace(strOut,">",">")
	strOut = eregi(strOut,"drop","drop")
	strOut = eregi(strOut,"javascript ","javascript")
	strOut = eregi(strOut,"script ","vbscript")
	strOut = eregi(strOut,"vbscript ","script")
	limpiar = trim(strOut)
end function

Initial URL


Initial Description


Initial Title
Php limpiar string para ser usado en sql

Initial Tags


Initial Language
PHP