Addslashes for database entry

Please post your suggestions or any hacks you have made here

Addslashes for database entry

Postby GreyHead on Wed Jan 02, 2008 10:48 pm

Hi Max,

I was just building a new form for my own website where I have some free-form textarea fields and I found that the Autogenerated code needed to have addslashes() to save correctly if there were any special characters in the field - in this case apostrophes in words like didn't.

I changed the Autogenerated code to read "'".addslashes($_POST['textarea_1'])."' ," and the form now works well.

Bob

PS I expected to have to add stripslashes for the data display but that seems fine.

Jooomla 1.0.13 with magic_quotes_gpc OFF
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3369
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Addslashes for database entry

Postby admin on Tue Jan 08, 2008 4:45 am

Hi Bob,

Could you please take a screenshot for the data which was coming from those fields in both the email and the data view pages at the admin ? please get them in screenshot because it may not look the same if you just pasted them here ;)

I will examine this issue and hopefully we will have a fix :)

Thanks!!

Max
ChronoForms/ChronoConnectivity/ChronoComments Developer Thanks for using our components!
If you have any problems with any extension please tell us.
If you like any of our extensions please post a review at Joomla.org
Want users to submit their content to your website ? try Submit Story
Want to list/edit/delete your data ? try ChronoConnectivity
Want to have stylish AJAX comments ? try ChronoComments
User avatar
admin
Platinum Boarder
 
Posts: 3099
Joined: Mon Aug 14, 2006 5:29 am

Re:Addslashes for database entry

Postby GreyHead on Tue Jan 08, 2008 1:33 pm

Hi Max,

Attached is the best I can do. I added some debug code to display the SQL statement from the AutoGenerated code. There are two data fields here after 'Testing'. The first is just the $_POST data, the second has addslashes added.

If I paste this SQL into PHPMyAdmin it fails because of the unescaped single quotes in the $_POST data.

Bob

Image
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3369
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Addslashes for database entry

Postby admin on Tue Jan 08, 2008 6:51 pm

Hi Bob,

Thank you, I got it, I will develop some way to check for magic quotes and add the addslashes if necessary then :)

Sincerely,

Max
ChronoForms/ChronoConnectivity/ChronoComments Developer Thanks for using our components!
If you have any problems with any extension please tell us.
If you like any of our extensions please post a review at Joomla.org
Want users to submit their content to your website ? try Submit Story
Want to list/edit/delete your data ? try ChronoConnectivity
Want to have stylish AJAX comments ? try ChronoComments
User avatar
admin
Platinum Boarder
 
Posts: 3099
Joined: Mon Aug 14, 2006 5:29 am

Re:Addslashes for database entry

Postby GreyHead on Tue Jan 08, 2008 7:24 pm

Hi Max,

In Joomla 1.0.x the code seems to be
Code: Select all
HTML_admin_misc::get_php_setting('magic_quotes_gpc',1,1);
- from admin.admin.html.php line 201

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3369
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany


Return to ChronoForms Suggestions & Hacks

Who is online

Users browsing this forum: No registered users and 2 guests