Jump to content

Recommended Posts

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 ;)

Link to comment
https://forums.phpfreaks.com/topic/85956-help-variable-that-modify-code/
Share on other sites

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>");

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.

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!!!! ;D;)

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!! :D;)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.