473,395 Members | 1,441 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.

Problem with a record deletion

219 100+
Ok, I've looked at this for a while now and I'm just not seeing what the issue is. I have a page which is setup to delete records from a table. I'm getting a CF error when I submit.

CF Error:

Attribute validation error for tag cfoutput.
The value of the attribute query, which is currently "delSystem", is invalid.

The error occurred in C:\Inetpub\wwwroot\Security_Access\systemSubmit.cf m: line 25

23 :
24 : <cfif isDefined("URL.op") and URL.op IS "del">
25 : <cfoutput query="delSystem">
26 : Record #sysID# deleted!
27 : </cfoutput>

Here is the code snippet:

Expand|Select|Wrap|Line Numbers
  1. <cfif isDefined("URL.op") and URL.op IS "del">
  2.     <cfquery name="delSystem" datasource="Security_Access" dbtype="ODBC">
  3.         delete from tblSystem
  4.         where sysID=#URL.sysID#
  5.     </cfquery>
  6.     <cfoutput query="delSystem">
  7.         Record #sysID# deleted!
  8.     </cfoutput>
  9. </cfif>
  10.  
I don't see what the issue is because delSystem is named correctly, and the query does run because when I check the database table after, I see that the record gets deleted. This is the only query I'm having an issue with, and it's a delete query. Is there something special because I'm deleting?
Sep 28 '07 #1

✓ answered by dmorand

nevermind, I'm a moron...

I need to use #URL.sysID# not #sysID#

It's friday...no more coding for me

4 3343
dmorand
219 100+
nevermind, I'm a moron...

I need to use #URL.sysID# not #sysID#

It's friday...no more coding for me
Sep 28 '07 #2
This is off-topic but your example is a perfect demonstration on how to create a sql injection and a cross site scripting vulnerability.

To prevent sql injections you should always use the VAL of a numeric values and escape string values of all URL or FORM variables. If you are not familiar with sql injection, here is an example using your sample code:

templatename.cfm?op=del&sysID=0%20or%201%3D1

which will be processed in your query as:
Expand|Select|Wrap|Line Numbers
  1.     <cfquery name="delSystem" datasource="Security_Access" dbtype="ODBC">
  2.         delete from tblSystem
  3.         where sysID=0 or 1=1
  4.     </cfquery>
  5.  
which in turn will produce devistating result to you database. This is a simple example. If a hacker finds a sql injection door open, he or she can do much more damage than this. Correcting the problem is simple:

Expand|Select|Wrap|Line Numbers
  1.     <cfquery name="delSystem" datasource="Security_Access" dbtype="ODBC">
  2.         delete from tblSystem
  3.         where sysID=#Val(URL.sysID)
  4.     </cfquery>
  5.  
Cross site scripting or XSS is when a hacker can cause a client browser to display and execute unwanted and possibly dangerous scripting code. The part in your sample of concern is here:

templatename.cfm?op=del&sysID%3Cscript%20language% 3D%22JavaScript%22%20type%3D%22text%2Fjavascript%2 2%3Ealert%28%22You%27re%20screwed%21%22%29%3B%3C%2 Fscript%3E

which will process in your display block as:

Expand|Select|Wrap|Line Numbers
  1.           <cfoutput query="delSystem">
  2.               Record <script language="JavaScript" type="text/javascript">alert("You're screwed!");</script> deleted!
  3.           </cfoutput>
  4.  
XSS is harder to prevent than sql injection. The site www.owasp.org details both these vulnerabilities more and have links to even more info. I highly recommend that you research this further.
Oct 4 '07 #3
acoder
16,027 Expert Mod 8TB
Excellent info. Do you think you could write a quick article based on this?
Oct 4 '07 #4
dmorand
219 100+
Wow, that's very handy. I'm pretty safe because I'm behind a firewall. This is our company intranet site, but I will definitely make note of this and use this in my code from now on.
Oct 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chumley the Walrus | last post by:
IN my code behind .vb page for a delete records script (this also does a deletion confirmation with a javascript popup, this gets called on my front .aspx page with the datagrid), I'm not sure if...
5
by: Alex | last post by:
Hi, I have two tables , A and B where table B has a foreign key constraint to table A. I want to delete all records in table A that are older than a certain date that are not referenced by...
3
by: Steven Fox | last post by:
============================================================ About DB2 Administration Tools Environment ============================================================ DB2 administration tools level:...
3
by: gaffar | last post by:
Sir, I am developing an application in vb.net and the backend database is ms-access my problem is i want delete one record from master table, that deleted record automatically deleted from child...
7
by: brad.goldberg | last post by:
I have a field that auto increments a number for each record. 0001, 0002 and so on. I also have two buttons on the form. One button is used to "save" the record after all fields are entered. After...
2
by: Andy.I | last post by:
Hi I have a small aplication that stores data in a random access file. I'm able to modify records, and add new records. But how can I delete a certain record and remove it enirely from the file?...
4
by: Phil Stanton | last post by:
Sorry to repost, but am having another look at deleting a record. I have a form (Member) and have removed all the event procedures associated with the Form (OnCurrent, OnDelete, OnActivate etc)...
8
by: ashwini1680 | last post by:
I have a problem working with files in c++.This is my code for modifying a record in a file.When i execute it ,it doesn't check rec in file & comes out .What's wrong??? Many time working with...
0
by: thesti | last post by:
hello guru, actually this is a general Database question, i wonder how to implement record deletion in a table, if for example i delete a record in the 'Product' table, then when a user...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.