Xindi CMS is a small, lightweight and flexible content management system. It's great for web developers looking for a simple way to make site content editable by their clients.
Open source, free and flexible, Xindi is available in CFML and PHP versions.
I am a web developer living and working in Exeter, Devon (United Kingdom). I use my blog to document and share the things I learn and I hope fellow developers will find it to be a useful resource.
Wednesday, October 5, 2011
Simple CRUD using CFGRID
I'm currently working on a project where my client needs to be able to create, read, update and delete records in a table displayed on a web page. In ColdFusion CFGRID solves this problem and here's a simple example using the CFARTGALLERY sample database that comes with ColdFusion 9.
Firstly, create an Artist.cfc file containing the following code.
Now create an index.cfm file containing the following code.
Load the index.cfm page in your web browser and the final result looks a bit like this...
Just a warning that the qArtists query in the getArtists() method is open to SQL injections. A user could use either of the "gridsort" arguments to potentially inject malicious SQL.
To solve this problem, you can use a helper function to make sure that the column and sort direction are valid values.
Dan, people should be using their own in-house cf application firewall instead of relying on human coders ;-)
an application firewall that checks inserted fields against their datatype in the db at the minimum (and key injection keywords), and by using custom datatypes, checking against custom rules. This also allows you to use CFINSERT and CFUPDATE safely also.
I can't believe people are still relying on sql parameter checks in their code for attack protection, it's soo 1990! (but better than nothing) Miss one, and you're application is open for attack. Not worth the risk.
Just fyi: CF 8 gave me an error on lines 71 and 72 of Artist.cfc. It was complaining about volname and value. Solution is to remove the var word from each line.
Tuesday, August 28, 2012
Simon Bingham
Yes, in CF8 you have to var scope your variables at the start of your method whereas in CF9 you can do it anyway.
Monday, March 11, 2013
Chuck Duppong
Simon, THANKS for the example. It helped me finally get off the ground with crud in cf.