RSS구독하기:SUBSCRIBE TO RSS FEED
즐겨찾기추가:ADD FAVORITE
글쓰기:POST
관리자:ADMINISTRATOR

<%

'//패턴으로 치환할수 있는 eregi_replace()함수를 구현

'//PHP에는 있으나 ASP에는 없기 때문

Function eregi_replace(pattern, replace, text)

Dim eregObj:


Set eregObj = New RegExp:


eregObj.Pattern = pattern: '//패턴 설정

eregObj.IgnoreCase = True: '//대소문자 구분 여부

eregObj.Global = True: '//전체 문서에서 검색


eregi_replace = eregObj.Replace(text, replace): '//Replace String

End Function


'//허용태그 외의 모든 태그제거 함수

Function strip_tags(str,allowtags)

Dim content:

Dim tags:


content = str:

tags = replace(allowtags,",","|"):


content = eregi_replace("<(\/?)(?!\/|" & tags & ")([^<>]*)?>", "&lt;$1$2&gt;", content):

contents = eregi_replace("(javascript\:|vbscript\:)+","$1//",contents):

contents = eregi_replace

("(\.Location|Location\.|=|\.COOKIE|alert\(|window\.open\(|onmouse|onkey||view\-

source\:)+","//",contents): '//자바스크립트 실행방지


strip_tags = content:

End Function



'//사용예

Dim permitTags, comment:


permitTags = "br,a,img,table,b,font,div,center,embed":

comment = "<font color=red>허용하지 않은 태그</font>가<br>잘 <b>보이나요?</b><br><script></script>":

comment = comment & "<div align=center>아주 유용할꺼에요~</div><body><html><xmp><pre>":


response.write strip_tags(comment,permitTags):


%>

이올린에 북마크하기
2007/04/25 00:34 2007/04/25 00:34
http://jiny.kr/trackback/96
전체 (406)
지니소식 (4)
자료실 (4)
정보|뉴스 (5)
SmartPhone (1)
Languages (206)
Server (153)
Database (27)
Design (4)
Gallery (0)
분류하기귀찬.. (2)
«   2012/02   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29      
  1. 창의력과 상상력을 넘어서  2009
    Tomcat 6.0 기본 환경 설정
  2. 닥공  2009
    서블릿 tomcat 6.0 실행시 에러
  1. 2010/07 (1)
  2. 2010/05 (1)
  3. 2010/02 (3)
  4. 2010/01 (3)
  5. 2009/05 (2)
Statistics Graph