laPistola Posted December 14, 2008 Share Posted December 14, 2008 ok i have problem i use the TinyMCE wysiwyg editor on my site but its came to my attention that when a user copied from a MS Word document it also pastes in the back ground a hole load of other code that when is viewed on a page comments out everything so all you see is what ever is before the call for the post. now this code i talk of is 19k charactors long and appares to be the settings code that all office doucments would make use off when pasting from one program to the other. To stop this being a problem this time i just removed the code in phpMyAdmin but what if a user pastes from word again and its very possible as its a story website. My thoughts was to see if there was a way to delete say everything starting from <!--[if through to <!--[End IF]--> but how would i go about doing this? Quote Link to comment https://forums.phpfreaks.com/topic/136937-removing-code-between-to-points/ Share on other sites More sharing options...
laPistola Posted December 15, 2008 Author Share Posted December 15, 2008 is this possible ?? thank you Quote Link to comment https://forums.phpfreaks.com/topic/136937-removing-code-between-to-points/#findComment-716130 Share on other sites More sharing options...
9three Posted December 15, 2008 Share Posted December 15, 2008 Use htmlspecialchars http://us2.php.net/manual/en/function.htmlspecialchars.php Quote Link to comment https://forums.phpfreaks.com/topic/136937-removing-code-between-to-points/#findComment-716176 Share on other sites More sharing options...
laPistola Posted December 30, 2008 Author Share Posted December 30, 2008 all that will do is make the 19k characters show on page, i need a way to remove them upon user posting the document! Quote Link to comment https://forums.phpfreaks.com/topic/136937-removing-code-between-to-points/#findComment-725795 Share on other sites More sharing options...
laffin Posted December 30, 2008 Share Posted December 30, 2008 it's possible either use strpos or preg_replace. with strpos, u can use substr, to catch the prefix/suffix of that comment block. (2 strpos,2 substr) with preg_replace, well ya just replace it with an empty string. Quote Link to comment https://forums.phpfreaks.com/topic/136937-removing-code-between-to-points/#findComment-725998 Share on other sites More sharing options...
laPistola Posted December 30, 2008 Author Share Posted December 30, 2008 right so i can make the script detect if this code is there first then execute a script that could find the last position of the code i need to remove using strpos() then simply remove it using substr() great idea thank you!! Quote Link to comment https://forums.phpfreaks.com/topic/136937-removing-code-between-to-points/#findComment-726155 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.