Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 498
  • Last Modified:

Where is this strange code coming from in my php/mysql app and how do I get rid of it?

Last week, Thursday to be exact, the autogen php/mysql web form we have has a textarea field where we use tinyMCE to allow client to input and format their text. Suddenly on Thursday the text would not appear in the form, along with the border that surrounds the textarea data in display mode, but when we went to the edit screen where the tinyMCE field is, we could see the text. I came in today and looked at the db and see all this odd code in the db [see below].  Think the user copied and pasted some word doc into the field, but now now matter what I get that odd code.

I have overwritten the code with straight, clean text, load the page it work, but then it eventually reverts to this odd code-- and at some point you refresh your browser and no longer see any text from the php form. When I look in the db again, all this code[see below]is back in the field.

I been surfing/researching and various suggestions include updating tinyMCE, which I did, but same things happens.

Does anyone have any idea what I should do, what part of the code to attack, is it the db or the tinyMCE? All help is much appreciated. [Note: app has been running successfully for about 2 years.]

Example of Code:
<p><!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:AllowPNG />
> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml>
> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom>
> <w:TrackMoves /> <w:TrackFormatting /> <w:PunctuationKerning />
> <w:ValidateAgainstSchemas />
> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
> <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
> <w:DoNotPromoteQF />

Open in new window

0
justmelat
Asked:
justmelat
1 Solution
 
Loganathan NatarajanLAMP DeveloperCommented:
It is a problem with your content placed from MS Word document etc.,   Before you copy/paste to the editor .. you need to strip or remove those word formatting .. there is feature in CKEditor.
0
 
rinfoCommented:
These are html comments that has been included for being used in copy paste.
You should provide provision to strip such comments by using
html = html.replace("(?s)<!--\\[if(.*?)\\[endif\\] *-->", "") in a java script.
and it will take care of  such insertions.
0
 
Ray PaseurCommented:
I can't vouch for this, but it seems promising.
http://www.tinymce.com/wiki.php/Plugin%3apaste
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
justmelatAuthor Commented:
Hi Ray

I tried adding paste in the init but something is still off in this:
 
After many hours of this, here is another kink.  In more researching I found some issues with copy/paste in tinyMCE, so in a desperate move, I took the clients' text and just re-typed it in myself, adding no formatting.  

I started paragraph by paragraph.  The first one went in/displayed fine, as well as the second, third, all the way to the 6, when I got to the seventh paragraph, saved everything, went back to the form to view, nothing from the textarea field would display.  There is even a border around this section, it would not display.  I went back to the db, all the text is still there [no funky MS code], but will not display on the form.  Are there some limitations as it relates to the textarea field that I am not aware of?  

I have increased the column rows to 30 for the textarea field, changed the field type in the db from a **text** field to a **mediumtext** field.  Did all that and still, once I get to a certain point, nothing displays.  Any suggestions on what I am missing?
0
 
Ray PaseurCommented:
No suggestions, sorry.  I have never seen TinyMCE malfunction in the way you describe.  And with only a few paragraphs of data you are certainly not hitting limits that would lead to data truncation.

My experience with TinyMCE goes like this.  If you are a really naive client, you will just type your information into the textarea and everything will work well.  If you are a really sophisticated client you will know well enough not to paste MSFT formatting into any textarea and everything will work well.  But if you're both clever and unsophisticated you can screw things up completely.  

I once wrote a CMS for a client who insisted on doing their own updates to the web pages.  After about two months of destroying the formatting and content of their pages, they gave up and went back to paying me to do their updates.  I think if they had just spent the two months learning a little HTML they would have been way ahead!  That's probably not going to help you solve your TinyMCE issues, but at least you know that you have company in those trenches.
0
 
justmelatAuthor Commented:
LOL - good one Ray.  The tinyMCE has been in place and working for two years, so not sure what changed so much, except that originally the client did copy/paste from a word doc.  But now that I have re-typed everything - that issue is no longer relevant.  

And you are right, even with these 8 paragraphs the client has, it't not like a novel or anything. so I don't know what is going on and worse, I can't confirm that it's tinyMCE, or textarea field, or the db or the browsers.  

Not sure which I hate worse, having a big, complex issue to figure out or having a seemingly small issue that takes you thru hundreds of hoops.

Thanks for your comments - I do appreciate your time.
0
 
Ray PaseurCommented:
Do you have phpMyAdmin?  If not, get it.  It will give you an easy way to look into the DB and fix things that need hands-on work.
0
 
justmelatAuthor Commented:
i have phpAdmin, but also have navicat - really nice, simple db interface.  And from it, I can see that all the text is in the field, it just won't show up on the form at a certain point.
0
 
justmelatAuthor Commented:
great as usual
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now