close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


sql injection

Thread began 12/19/2009 9:45 pm by gruant2000381341 | Last modified 12/21/2009 12:38 pm by Jason Byrnes | 757 views | 1 replies |


sql injection

I was wondering if ecart has any protection built in to help stop sql injection attacks. I have reading up on the subject and wondered how to improve security on my site. I found this code and wondered what you thought of it, and how it could be incorporated into an ecart site.

just create a new php file called functions.php and include it in any page you want alpha strings filtered

* --filterString--
* strips new lines to prevent injection
* mysqli_real_escape to prevent injections
* trim whitespaces
* HTML special character removal
* strips any html or php tags
* @param string $str
* @return string
public function filterString($str)
$str = str_replace('\r', '', $str);
$str = str_replace('\n', '', $str);
$str = trim($str);
$str = htmlspecialchars($str);
$str = mysqli_real_escape_string($str);
$str = strip_tags($str);
return $str;

example on your parse page:

include_once 'functions.php';
$firstname = filterstring($_POST['firstname']);
$surname = filterstring($_POST['surname']);

and so on

Sign in to reply to this post

Jason ByrnesWebAssist

eCart and DataAssist include built in functions to help prevent against SQL injection attacks.

You could certainly use the code you have included as well. In the store cart summary server behavior, when you bind a Database column to a form value, it adds code similar to:

<?php echo ((isset($_POST["shipping_firstname"]))?$_POST["shipping_firstname"]:""); ?>

you can include the filterstring() function by editing that to:

<?php echo ((isset($_POST["shipping_firstname"]))?filterstring($_POST["shipping_firstname"]):""); ?>
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





Ease of use


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...