I developed a web application, that permits my users to manage some aspects of a web site dynamically (yes, some kind of cms) in LAMP environment (debian, apache, php, mysql
The general best strategy here is to whitelist specific tags and attributes that you deem safe, and escape/remove everything else. For example, a sensible whitelist might be , ,
,
,
,
. Alternatively, consider human-friendly markup like Textile or Markdown that can be easily converted into safe HTML.,