close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Using SQL Injection Prevention to Remove Commas

Thread began 1/10/2012 8:31 am by Armen | Last modified 1/10/2012 12:23 pm by Armen | 2466 views | 2 replies |

Armen

Using SQL Injection Prevention to Remove Commas

I need to ensure the user does not insert any commas into the Order and OrderDetails tables in the MySQL database. I was thinking the easiest option might be to add some code to the code that eCart uses to prevent SQL Injections. I am using DW CS5.5, eCart 5.0.3 on OSX Lion 10.7.2

I am fairly new to using SQL. Any help will be greatly appreciated.

Sign in to reply to this post

Jason ByrnesWebAssist

the orders detail table will only store the information from the cart, no user entered information.

the orders table is the only one that will store user entered information.

on the confirm page, add the following code at line 1 to strip any commas from the info posted from the checkout form:

php:
<?php

if($_SERVER['REQUEST_METHOD'] == "POST") {
    foreach(
$_POST as $k => $v) {
        
$_POST[$k] = str_replace(","""$v);
    }
}
?>
Sign in to reply to this post

Armen

Thanks Jason! That's exactly what I was looking for.

Sign in to reply to this post

Web Designer Troy

SQL Injection problem with DataAssist

For a site of mine I'm getting the following error:

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\' convert#int,convert#varchar,0x7b5d## \' AND ID= -1)' at line 1"

This happens when I use the following URL:

page.php?ID='+convert(int,convert(varchar,0x7b5d))+'

This shows that Im prone to SQL Injection. How do I prevent this?

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of the page please

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...