Tayfun | | Tarih: 10.12.2006, 01:22 Mesaj konusu: Küfür Koruması ve Spam Koruyucu(ASP) | |
| küfür koruması
<%
function filtrele(strgelen)
arryasak = array("aptal", "salak", "manyak", "beyinsiz", "gerizekalı")
for each kelime ın arryasak
strgelen = replace(strgelen, lcase(kelime), "[yasak kelime]")
next
filtrele = strgelen
end function
%>
spam koruması
<%
'***********************************************************
'copyright 2003 ferruh mavituna
'http://ferruh.mavituna.com
'encode email addresses to make it harder for spammers to harvest them.
'ınspired from http://www.zapyon.de/spam-me-not/
'***********************************************************
'this program is free software; you can redistribute it and/or modify
'it under the terms of the gnu general public license as published by
'the free software foundation; either version 2 of the license, or
'(at your option) any later version.
'
'this program is distributed in the hope that it will be useful,
'but wıthout any warranty; without even the implied warranty of
'merchantabılıty or fıtness for a partıcular purpose. see the
'gnu general public license for more details.
'
'you should have received a copy of the gnu general public license
'along with this program; if not, write to the free software
'foundation, ınc., 59 temple place, suite 330, boston, ma 02111-1307 usa
'***********************************************************
'details : http://www.gnu.org/licenses/gpl.txt
'***********************************************************
'***********************************************************
'// usage
'***********************************************************
'// [1] add fm_str2arr, fm_decode, fm_obfuscate function into your page or include.
'// [2] print fm_obfuscate
'// arguments
'// @email : string
'// @method : number (default=3)
'// 1 : decimal
'// 2 : hexadecimal
'// 3 : random
'// @optional text : e-mail text
'// sample (see more in demonstrations -at the end of the code-)
'// response.write fm_obfuscate("email@address.com",2,"drop me a mail")
'***********************************************************
'******************************************************************
'// convert a string to array by ferruh mavituna
'******************************************************************
function fm_str2arr(byval str, byref arr)
dim i, strlen
strlen = len(str)-1
redim arr(strlen)
for i = 0 to strlen
arr(i)=left(str,1)
ıf len(str)>0 then str=right(str,len(str)-1)
next
end function
'******************************************************************
'// decode characters by ferruh mavituna
'******************************************************************
function fm_decode(byval char, byval method)
'// randomize
'***********************************
ıf method=3 then
randomize timer
method = cınt(rnd*1)+1
end ıf
'// select method
'***********************************
select case method
case 1 '// decimal notation
'***********************************
fm_decode = asc(char)
case 2 '// hexadecimal notation
'***********************************
fm_decode = "x" & hex(asc(char))
end select
end function
function fm_obfuscate(byval email,byval method, byval opttext)
dim tmpstr, mailarr(), i, finalstr, mailtoarr(), tmpmailtostr
'// fix method
ıf not isnumeric(method) then method = 3
ıf method>3 then method = 3
'// encode "mailto:"
fm_str2arr "mailto:",mailtoarr
for i = 0 to ubound(mailtoarr)
tmpmailtostr = tmpmailtostr & "&#" & fm_decode(mailtoarr(i),method) & ";"
next
'// convert string to array
'***********************************
fm_str2arr email,mailarr
'// generate text
'***********************************
for i = 0 to ubound(mailarr)
finalstr = finalstr & "&#" & fm_decode(mailarr(i),method) & ";"
next
'// fix optiontext
'***********************************
ıf opttext="" then
opttext = finalstr
end ıf
finalstr = tmpmailtostr & finalstr
'// return
'***********************************
fm_obfuscate = "<a href=""" & finalstr & """>" & opttext & "</a><br />"
end function
'***********************************
'***********************************
'// demonstrations
'***********************************
'***********************************
response.write "by <a href=""http://ferruh.mavituna.com"">ferruh mavituna</a> | <a href=""http://ferruh.mavituna.com/opensource/obfuscate/obfuscate.txt"">download source code</a><p>"
'// decimal
'***********************************
response.write "<h1>decimal</h1>"
response.write fm_obfuscate("whoooo@yupyupgup.com",1,"")
'// decimal with text
'***********************************
response.write "<h1>decimal with text</h1>"
response.write fm_obfuscate("whoooo@yupyupgup.com",1,"drop me a mail")
'// hexadecimal
'***********************************
response.write "<h1>hexadecimal</h1>"
response.write fm_obfuscate("whoooo@yupyupgup.com",2,"")
'// hexadecimal with text
'***********************************
response.write "<h1>hexadecimal with text</h1>"
response.write fm_obfuscate("whoooo@yupyupgup.com",2,"drop me a mail")
'// random
'***********************************
response.write "<h1>random</h1>"
response.write fm_obfuscate("whoooo@yupyupgup.com",3,"")
'// random with text
'***********************************
response.write "<h1>random with text</h1>"
response.write fm_obfuscate("whoooo@yupyupgup.com",5,"drop me a mail")
'// see real results
'***********************************
'response.write server.htmlencode(fm_obfuscate("whoooo@yupyupgup.com",1,""))
'response.write server.htmlencode(fm_obfuscate("whoooo@yupyupgup.com",1,"drop me a mail"))
'response.write server.htmlencode(fm_obfuscate("whoooo@yupyupgup.com",2,""))
'response.write server.htmlencode(fm_obfuscate("whoooo@yupyupgup.com",2,"drop me a mail"))
'response.write server.htmlencode(fm_obfuscate("whoooo@yupyupgup.com",3,""))
'response.write server.htmlencode(fm_obfuscate("whoooo@yupyupgup.com",3,"drop me a mail"))
%>
|
|