Jump to content

BBcode, forms and database security


AdRock

Recommended Posts

I have a form where the user can enter some BBcode to style text but I am really concerned about database security.

 

When I submit a form, I use stripslashes to get rid of the crap before it enters the database but will this affect the BBcode as it has a slash i.e. [/tag]

 

What is the best way so i can insert the BBcode or the converted HTML into my database without compromising my database?

Link to comment
https://forums.phpfreaks.com/topic/67381-bbcode-forms-and-database-security/
Share on other sites

Using stripslashes wont effect your BBcode as it strips \. Those / are backslashes. Also just to let u know, stripping slashes is reverse of addslashes. To protect sql injections u add slashes to special characters like ' or ". When outputting to the user u strip those slashes with stripslashes(). As jesirose said, use mysql_real_escape_string() as it escapes special characters in data which are going to be inserted in mysql.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.