ASPNL logo (1 kb)

Hosted by Nedcomp (18 kb)


ASPNL Forums Home   Search   FAQ   Login   Register   Member List  
Code bibliotheek  > ASP  > Functies Controleren Input/output  
 
Display using:  
Previous Thread :: Next Thread 
 Author Thread: Functies Controleren Input/output
Zarray is not online. Last active: 9/22/2007 12:04:26 PM 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 -->
JP is not online. Last active: 7/26/2010 11:02:08 AM JP
www.jphellemons.nl
Top 25 Poster
Joined: 08 Jul 2004
Total Posts: 539
 
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
Previous Thread :: Next Thread 
Page 1 of 1
 
ASPNL Forums  > Code bibliotheek  > ASP  > Functies Controleren Input/output