Solved

Storing bullet lists in database but no other tags  (especially javascript)

Posted on 2014-11-23
3
195 Views
Last Modified: 2014-12-09
Hi

I have a website where the user wants to store some bullet pointed lists in the database

According to pages like this i can use rich text editors and they will store the html tags
http://www.kevinroth.com/rte/.

I am  a bit nervous as i always use striptags to get rid of html or code before it goes into the database
I could use striptags and allow lists? I appreciate this might remove any formatting they add so i might allow bold, italics and headers?

Is this 'safe'? Will is still keep javascript out?

Thanks experts
0
Comment
Question by:andieje
  • 2
3 Comments
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 40460531
A quick look at the Kevin Roth site gives us this:
The Cross-Browser Rich Text Editor (RTE) is based on the designMode() functionality introduced in Internet Explorer 5, ...
Since IE5 is completely obsolete and unsupported by anyone any more, a more reasonable approach might be to learn about one of the modern textarea editors.  The two that are open-source and currently popular are TinyMCE (Used by WordPress) and CKEditor.  Once you dig into the internals of either of those packages you will quickly find ways to do almost everything you want with a rich text editor.

I have not used either in a few years, and technology is always advancing, but I know for sure that TinyMCE has the ability to restrict the types of tags that users can enter.  The docs for valid_elements and invalid_elements describe this.
0
 

Author Comment

by:andieje
ID: 40485709
to summise - it should be possible with the right editor?
0
 

Author Closing Comment

by:andieje
ID: 40489595
thanks
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
designing in object programming 12 75
when to use sequences in mysql 4 27
Fulfillment API php code sample 1 38
Really simple no curl. Send a post 3 times 4 24
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question