Zarray
|
| Joined: 13 Aug 2006 |
| Total Posts: 4 |
| |
|
Functies Controleren Input/output Posted: 22 Sep 2007 11:49 AM |
De volgende functies kan je gebruiken om text om te zetten naar htmlentiteiten. Dit is tegen het cross site scripten. Ook is er tegen sql injection een functie om te controleren of het toevallig slechte input is.
<%
'================================================
' AUTHOR: FRISO
' AUTHORS HOMEPAGE:
'/ HTTP://www.allfreeware.freeweb7.com
'================================================
function EncSpecChar(ltext) '__________OUTPUT FILTER
dim I
dim lNewText
for I=1 to len(ltext)
if instr("<>",mid(ltext,I,1)) then
lNewText=lNewText & "&#" & chr(mid(ltext,I,1)) & ";"
else
lNewText=lNewText & mid(ltext,I,1)
end if
next
EncSpecChar=lNewText
end function
%>
<%
Function SqlInjCheck(lallowed,ltext,extrachars)
dim alchars
dim I
'lallowed: 0=AlphaNumeric 1=Alpha 2=Numeric
'
alchars=extrachars '//Also allowed
select case lallowed
case 0
alchars=alchars & "abcdefghijklmnopqrstuvwxyz0123456789"
case 1
alchars=alchars & "abcdefghijklmnopqrstuvwxyz"
case 2
alchars=alchars & "0123456789"
end select
for I = 1 to len(ltext)
if instr(alchars,lcase(mid(ltext,I,1)))=0 then
SqjInjCheck=0
exit function
end if
next
SqlInjCheck=1
end function
%>
<%
function rnumber(nlower,nupper)
randomize
rnumber=int(rnd*nupper)+nlower
end function
%>
<%
function genhsess
dim I
dim stemp
for I = 0 to rnumber(10,16)
stemp=stemp & rnumber(0,9)
next
genhsess=stemp
end function
%>
<!-- provided by http://allfreeware.freeweb7.com --> |
|
|
 |
|
|
Re: Functies Controleren Input/output Posted: 2 Apr 2010 01:52 PM |
Hoi Zarray,
ter aanvulling een misschien handige link: http://msdn.microsoft.com/en-us/library/aa973813.aspx
|
Mijn Blog |
|
 |
|