Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/07/2005, 06:22
Avatar de El_Metallick
El_Metallick
 
Fecha de Ingreso: noviembre-2002
Ubicación: Santiago, Chile
Mensajes: 1.718
Antigüedad: 22 años, 7 meses
Puntos: 16
concuerdo con usted distinguido amigo marianano.... yo uso ese código en conjunto con esta función (para evitar SQLIJECTION)
Código:
<%
Dim str

function limpiar(strlimpiar,modolimpiar)

	'modolimpiar = 0 prepara strlimpiar para insert 
	'modolimpiar = 1 Prepara strlimpiar para insert evitando, ademas, la entrada de HTML
	'modolimpiar = 2 Prepara strlimpiar para un login y evita sql injection
	
	str = trim(strlimpiar)
	
	Select Case modolimpiar
    Case 0
		str = replace(str,"'","''")
		str = replace(str,"<","&lt;")
		str = replace(str,">","&gt;")
	Case 1
		str = replace(str,"'","''")
		str = replace(str,"<","&lt;")
		str = replace(str,">","&gt;")
		str = replace(str,chr(13),"<br>")
	Case 2
        str = lcase(str)
        str = replace(str,"=","")
        str = replace(str,"'","")
        str = replace(str,"""""","")
        str = replace(str," or ","")
        str = replace(str," and ","")
        str = replace(str,"(","")
        str = replace(str,")","")
        str = replace(str,"<","[")
        str = replace(str,">","]")
        str = replace(str,"having ","")
        str = replace(str,"group by","")
        str = replace(str,"union select sum","")
        str = replace(str,"union select min","")
        str = replace(str,"--","")
        str = replace(str,"select ","")
        str = replace(str,"insert ","")
        str = replace(str,"update ","")
        str = replace(str,"delete ","")
        str = replace(str,"drop ","")
        str = replace(str,"-shutdown","")
    Case Else 
        str = strlimpiar
	End Select

	limpiar = str

end function
%>
ahora con ASP no sabria como hacer para que se me ingrese un máximo de caracteres o solo numéricos... como puedo validar eso???? saludos
__________________
Haz la guerra en la cama y el amor donde se te de la gana...
El tiempo es el mejor maestro, lo único malo es que te mata...¡¡Aprovecha tu tiempo!!