not-public

asp notes

<% Option Explicit %>

Test of Input
<%
Function CleanSQL(badStr) 'Clean up string by stripping out all but alphanumerics
Dim goodStr
Dim i
Dim ch
Dim goodChars

goodChars = "-_. @"
for i = 1 to Len(badStr)
ch = Mid(badStr, i, 1)
if ( (ch>="A") and (ch<="Z") ) or ((ch>="a") and (ch<="z") ) or ((ch>="0") and (ch<="9")) or (InStr(goodChars,ch)>0) then
goodStr = goodStr & ch
end if
next
CleanSQL = goodStr
End Function

Dim Input
Dim Message

Input = Request.Form("Command")
Message = CleanSQL(Input)

%>

Syndicate content