ClassicASP html 코드(tag) 치환
페이지 정보
본문
	tag 못쓰게 하는 법
	
	[ 방법.1 ]
	
	<%
	function ReplaceTag2Text(str)
	   Dim text
	      text = replace(str, "&", "&")
	      text = replace(text, "<", "<")
	      text = replace(text, ">", ">")
	      text = replace(text, "'", """)
	      text = replace(text, """", """)
	      ReplaceTag2Text = text
	End Function
	p_idx    = Request.QueryString("p_idx")
	name    = upload.item("name")
	titles     = upload.item("titles")
	content = replace(upload.item("MinBoardContents"),"'","''")
	ip         = request.servervariables("remote_host")
	
	' 테그방지를 위한 변수교환
	p_idx    = replaceTag2text(p_idx)
	name    = replaceTag2text(name)
	titles     = replaceTag2text(titles)
	
	%>
	
	
	
	[ 방법.2 ]
	<%
	' =========================================================
	' html 코드 치환
	' =========================================================
	Function NullFillWith(src , data )
	  if isNULL(src) or src = "" then
	    if Not isNull(data) or data = "" then
	      NullFillWith = data
	    else
	      NullFillWith = 0
	    end if
	  else
	    If Not IsNumeric(src) then
	      NullFillWith = Replace(src, "'", "''")
	      NullFillWith = Replace(src, chr(34), """)
	      NullFillWith = Replace(src, chr(38), "&")
	      NullFillWith = Replace(src, ";" , ";")
	      NullFillWith = Replace(src, "<" , "<")
	      NullFillWith = Replace(src, "--" , "--")
	      NullFillWith = trim(Replace(src, "..\" , "..\"))
	    else
	      NullFillWith = src
	    End if  
	  end if
	End Function
	Function vReplace_IN(data)
	  If Not IsNull(data) Then
	    data  = Replace(data, "'" , "''")
	    data  = Replace(data, chr(38), "&")
	    data  = Replace(data, chr(34), """)
	    data  = Replace(data, ";" , ";")
	    data  = Replace(data, "<" , "<")
	    data  = Replace(data, "--" , "--")
	    data  = Replace(data , chr(13), "<br />" )
	    data  = Trim(Replace(data, "..\" , "..\"))
	  End If
	  vReplace_IN = data
	End Function
	Function vReplace_OUT(data)
	  If Not IsNull(data) Then
	    data  = Replace(data, "''", "'")
	    data  = Replace(data, "&", chr(38))
	    data  = Replace(data, """, chr(34))
	    data  = Replace(data, ";", ";")
	    data  = Replace(data, "<", "<")
	    data  = Replace(data, "--", "--")
	    data  = Replace(data , "<br>", chr(13))
	    data  = Replace(data , "<br />", chr(13))
	    data  = Trim(Replace(data, "..\", "..\"))
	  End If
	  vReplace_OUT = data
	End Function
	%>
댓글목록
등록된 댓글이 없습니다.






