I am working on a CMS with codeigniter. Users are supposed to know HTML and construct the page themselves. Now, I am having problems with storing some tags in the database (mysql database).
Users can upload images to the server and then use the path of the image in the code. The code is edited in a . When I try to update the code of a certain page to:
<img src="assets/fileserver/versje2.jpg" alt="" />
everything works. But when I apply inline style to it
<img style="width: 200px;" src="assets/fileserver/versje2.jpg" alt="" />
it won't work. It simply ignores the style and the following is stored in the database:
<img src="assets/fileserver/versje2.jpg" alt="" />
it simply removes the style. How is this possible?
I have tried:
-htmlspecialchars
-htmlentities
$config['global_xss_filtering'] = FALSE;
$config['global_xss_filtering'] = TRUE;
Any suggestions on what the problem could be?
Maybe you need to save it with htmlspecialchars($saveToDB)
function,
edit in input such like that: <input name="someHtmlCode" value="<?=$saveToDB;?>" />
and than echo with htmlspecialchars_decode
function in your html file on site:$html = htmlspecialchars_decode($dataFromDB)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With