rock_xl1 Posted January 14, 2008 Share Posted January 14, 2008 Hi people. I have been workin in a wysiwyg editor like tinymce, but i have a big problem in my server i think. So the problem is, i do a text in wysiwyg editor trow a textbox that is convert to a variable, and save in a file. ok. But, when i open the file, or write the variable $text in screen the code inside (HTML) is changed... like: this code "<p style="text-align: center;">Test</p> " change to: "<p style=\"text-align: center;\">Test</p>" when the code goes to variable, he change... including "\" what with this, is not the same as whitout... I think that is about a php protection in the server... that modify html code. So what can i do to stop it? For exemple the wysiwyg editor in joomla is working fine... Thanks everyone Rafael Rocha - Portugal Quote Link to comment https://forums.phpfreaks.com/topic/85956-help-variable-that-modify-code/ Share on other sites More sharing options...
tinker Posted January 14, 2008 Share Posted January 14, 2008 When I was developing a wysiwyg, I was told to store the code as BBCode not html (after weighing up pro's and con's I succumbed). But what your problem look's like is that the speech marks have been escaped using 'mysql_real_escape_string()', therefore try something like: echo stripslashes("<p style=\"text-align: center;\">Test</p>"); Quote Link to comment https://forums.phpfreaks.com/topic/85956-help-variable-that-modify-code/#findComment-438865 Share on other sites More sharing options...
PFMaBiSmAd Posted January 14, 2008 Share Posted January 14, 2008 The php magic quotes settings are on and the form data is being escaped. (Magic quotes have been removed in php6 due to the number of problems like this when they do something that the programmer does not want to happen.) Either turn off magic_quotes_gpc in php.ini or a .htaccess file or use the stripslashes() function on the data to remove the slashes. If magic_quotes_runtime is also on and you are saving the data to a file or database and then reading the file and it has the slashes \ in it, then either turn off magic_quotes_runtime in php.ini or a .htaccess file or use the stripslashes() function on the data to remove the slashes. Quote Link to comment https://forums.phpfreaks.com/topic/85956-help-variable-that-modify-code/#findComment-438885 Share on other sites More sharing options...
rock_xl1 Posted January 15, 2008 Author Share Posted January 15, 2008 When I was developing a wysiwyg, I was told to store the code as BBCode not html (after weighing up pro's and con's I succumbed). But what your problem look's like is that the speech marks have been escaped using 'mysql_real_escape_string()', therefore try something like: echo stripslashes("<p style=\"text-align: center;\">Test</p>"); Thanks a LOT!!! IT WORKS!!!! Quote Link to comment https://forums.phpfreaks.com/topic/85956-help-variable-that-modify-code/#findComment-440108 Share on other sites More sharing options...
rock_xl1 Posted January 15, 2008 Author Share Posted January 15, 2008 The php magic quotes settings are on and the form data is being escaped. (Magic quotes have been removed in php6 due to the number of problems like this when they do something that the programmer does not want to happen.) Either turn off magic_quotes_gpc in php.ini or a .htaccess file or use the stripslashes() function on the data to remove the slashes. If magic_quotes_runtime is also on and you are saving the data to a file or database and then reading the file and it has the slashes \ in it, then either turn off magic_quotes_runtime in php.ini or a .htaccess file or use the stripslashes() function on the data to remove the slashes. THANKS A LOT!! IT WORKS!! ;) Quote Link to comment https://forums.phpfreaks.com/topic/85956-help-variable-that-modify-code/#findComment-440109 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.