473,395 Members | 1,763 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

0x800A0414, but aspfaq 2115 does not seem to apply

Hi
I run a small business on my own, everything from deliveries to coding
the webshop. This limits the time I can spend on coding, so I hope I'm
not asking to stupid questions.
At present I'm (re)writing "data sanitation" to stop dangerous user
input (from the order form, other input has already been taken care of)
I want some caracters to be removed or changed, like ' which could be
found in some names (Mac'Donald)
So I've started out like this:
--------
dim i,koll,test
For i = 1 to Request.Form.Count
replace(Request.Form(i), "'", "")
if len(Request.Form(i)) > 45 and Request.Form(i) <>
Request.Form("message") or len(Request.Form("message")) > 245 then
session("var") = "order.asp"'to know where in terrlog.asp
Server.Execute("terrlog.asp") 'logs the incident
response.redirect ("terror.htm")'custom error message
end if
Koll = Request.Form(i)&koll'concatenate to later check for unwanted
caracters and if found show terror.htm like above
next
--------
I've tested to use Request.Form.item(i) and in case Request.Form cannot
be changed to put it in a variable
test = Request.Form.item(i)
I've also tested to replace with an x not just with nothing
-------
Invariably this gives the 0x800A0414 error
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
at the replace. Without the replace it works fine.
I don't really see that asfaq 2115 applies here but I've tested to use
Call replace(Request.Form(i), "'", "")
No error - but also no action, the ' is not replaced.
If I get this working a few more caracters and/or words are to be
changed
Any help appreciated.
Mats
PS I posted this before but something went wrong so it did not appear.
In case this appears as a second posting I apologize


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
5 2346
Replace is a function that returns a result - you need to store it
somewhere:

strMyVariable = Replace(Request.Form(i), "'", "")

Cheers
Ken

"Mats" <ma**@nospamdatabyggarna.se> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
: Hi
: I run a small business on my own, everything from deliveries to coding
: the webshop. This limits the time I can spend on coding, so I hope I'm
: not asking to stupid questions.
: At present I'm (re)writing "data sanitation" to stop dangerous user
: input (from the order form, other input has already been taken care of)
: I want some caracters to be removed or changed, like ' which could be
: found in some names (Mac'Donald)
: So I've started out like this:
: --------
: dim i,koll,test
: For i = 1 to Request.Form.Count
: replace(Request.Form(i), "'", "")
: if len(Request.Form(i)) > 45 and Request.Form(i) <>
: Request.Form("message") or len(Request.Form("message")) > 245 then
: session("var") = "order.asp"'to know where in terrlog.asp
: Server.Execute("terrlog.asp") 'logs the incident
: response.redirect ("terror.htm")'custom error message
: end if
: Koll = Request.Form(i)&koll'concatenate to later check for unwanted
: caracters and if found show terror.htm like above
: next
: --------
: I've tested to use Request.Form.item(i) and in case Request.Form cannot
: be changed to put it in a variable
: test = Request.Form.item(i)
: I've also tested to replace with an x not just with nothing
: -------
: Invariably this gives the 0x800A0414 error
: Microsoft VBScript compilation (0x800A0414)
: Cannot use parentheses when calling a Sub
: at the replace. Without the replace it works fine.
: I don't really see that asfaq 2115 applies here but I've tested to use
: Call replace(Request.Form(i), "'", "")
: No error - but also no action, the ' is not replaced.
: If I get this working a few more caracters and/or words are to be
: changed
: Any help appreciated.
: Mats
: PS I posted this before but something went wrong so it did not appear.
: In case this appears as a second posting I apologize
Jul 19 '05 #2
Instead of repeatedly calling the Request.Form object, store those variables
temporarily.
Your replace error has already been explained by Ken, but I'd suggest
cleaning up your loop a little.

Dim formItem
Dim message
Dim koll
Dim test
Dim tmpValue

for each formItem in Request.Form
tmpValue=Request(formItem)
tmpValue=Replace(tmpValue,"'","") 'Removes apostrophes. Although I'm
sure People whose names have an apostrophe won't appreciate it.
if (len(tmpValue)>45) AND (formItem <> "message") then
'Do the error logging stuff
end if
next

"Mats" <ma**@nospamdatabyggarna.se> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi
I run a small business on my own, everything from deliveries to coding
the webshop. This limits the time I can spend on coding, so I hope I'm
not asking to stupid questions.
At present I'm (re)writing "data sanitation" to stop dangerous user
input (from the order form, other input has already been taken care of)
I want some caracters to be removed or changed, like ' which could be
found in some names (Mac'Donald)
So I've started out like this:
--------
dim i,koll,test
For i = 1 to Request.Form.Count
replace(Request.Form(i), "'", "")
if len(Request.Form(i)) > 45 and Request.Form(i) <>
Request.Form("message") or len(Request.Form("message")) > 245 then
session("var") = "order.asp"'to know where in terrlog.asp
Server.Execute("terrlog.asp") 'logs the incident
response.redirect ("terror.htm")'custom error message
end if
Koll = Request.Form(i)&koll'concatenate to later check for unwanted
caracters and if found show terror.htm like above
next
--------
I've tested to use Request.Form.item(i) and in case Request.Form cannot
be changed to put it in a variable
test = Request.Form.item(i)
I've also tested to replace with an x not just with nothing
-------
Invariably this gives the 0x800A0414 error
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
at the replace. Without the replace it works fine.
I don't really see that asfaq 2115 applies here but I've tested to use
Call replace(Request.Form(i), "'", "")
No error - but also no action, the ' is not replaced.
If I get this working a few more caracters and/or words are to be
changed
Any help appreciated.
Mats
PS I posted this before but something went wrong so it did not appear.
In case this appears as a second posting I apologize


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #3

Hi
Thanks for your patience, of cource the value returned by replace has to
be stored somewhere. Pity that my son only knows C and not vbscript....
This is a form for name and adress and the like and the intention is to
purge input of apostophes and some words like insert or drop and some
html-formatting to avoid SQL-insert and other unpleasant input.
I've searched but not found out if it is possible to change
request.form.item, but it seems not to be the case. If so I'd have to
build an array to save the purged values for further use down the line
or is there a simpler solution?
The alternative is just to redirect to the error file if unwanted input
exists, but then I'd have to "tolerate" apostrophes, and maybee more.
Mats
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #4
Mats wrote:
Hi
Thanks for your patience, of cource the value returned by replace has
to be stored somewhere. Pity that my son only knows C and not
vbscript.... This is a form for name and adress and the like and the
intention is to purge input of apostophes and some words like insert
or drop and some html-formatting to avoid SQL-insert and other
unpleasant input.
I've searched but not found out if it is possible to change
request.form.item, but it seems not to be the case. If so I'd have to
build an array to save the purged values for further use down the line
or is there a simpler solution?
The alternative is just to redirect to the error file if unwanted
input exists, but then I'd have to "tolerate" apostrophes, and maybee
more. Mats

Have you read the SQL Injection FAQ at www.sqlsecurity.com? You may be
overdoing your precautions. Really, all you need to do is replace the
apostrophes with two apostrophes and you've prevented injection. Better yet,
use parameterized queries or stored procedures instead of dynamic sql.

Bob Barrows
Jul 19 '05 #5
Hi
Bob Barrows wrote "Have you read the SQL Injection FAQ at
www.sqlsecurity.com? snip all you need to do is replace the
apostrophes with two apostrophes and you've prevented injection."
Jep but also
http://www.sitepoint.com/article/794/5

Mats

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Saqib Ali | last post by:
Please excuse me, this is a fairly involved question that will likely require you to save the file below to a file and open it in a browser. I use Mozilla 1.5, so the problem I describe below...
3
by: Blaise Garant | last post by:
Hi I've made a stylesheet to transform my data into XSL-FO. This stylesheet used to work with MSXSL 4.0 but I've got some issues in ..NET. First, I changed removed all the "node-set()" function...
2
by: jimbo_vr5 | last post by:
Hey I think i've figured out the idea behind apply-templates. But going through the tutorial on <http://www.w3schools.com/xsl/xsl_apply_templates.asp> theres simply just something that i dont...
3
by: almousawi | last post by:
I am working on a DB2 replication program that used to work. I ran the "warm" capture program to get a cold start and I am running the apply program, but, the apply does not replicate the data. I...
6
by: ken | last post by:
I posted this, but for some reason it didn't go through... I'm using access 2k, and need to date the last time my form has been edited. So I added a date field and in the after update property I...
3
by: Jeff Stewart | last post by:
I've been working with the JavaScript Shell in Firefox on a mad-scientist problem I've had in my head. Assume a function named 'object' that is designed to create an object based on a prototype...
1
by: napstar | last post by:
I have 2 combo boxes which can be used to set an employee's availability and Salary type on an employees form in access. I have sub which changes availability to “Full time”, if the salary type is...
2
by: ShaggyMoose | last post by:
I want to apply an array of arguments against the Date constructor to set a specific date/time. I can't seem to find the syntax to do this. Using eval to expand the array into seperate arguments...
18
by: OldBirdman | last post by:
I have a listbox named lbxSelect which has RowSource = strSQL set in VBA code. This displays correctly on my form (fAAA). Once displayed, I want to use it to select a record, and display the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.