Can anyone offer suggestions on how to stop html being carried over in forms in inputs and text areas? I am affrain of people adding outside links and more.
I read that for security purposes, webmasters should stop html being entered into databases. Do you have a suggestion with posting the from info into a db and then printing the data?
willybfriendly
7:08 pm on Nov 4, 2009 (gmt 0)
Use strip_tags BEFORE putting it into the DB. Stripping tags is just one small part of cleaning/filtering user supplied data. There are several good threads [google.com] about this in these forums.
coopster
12:21 pm on Nov 5, 2009 (gmt 0)
Many content management systems (CMS) allow rich text editing (RTE) where a user may enter and submit html content. First, you have to know your potential user and whether or not you want to allow HTML to be entered and stored for display on your site. Next, you decide to what level. Should I allow ALL html? Just bold, italics, and the like? The function mentioned helps you on the server side to do the cleanup you desire.
Advice: decide on the potential user first. If it is a public blog, allow maybe just some minimum markup. Allow it in the client code (JavaScript) and then be certain to scrub it on the server by stripping undesired tags.