adrian28uk Posted June 4, 2008 Share Posted June 4, 2008 I have found a script that allows me to enter rich text via wysiwyg editor on my site. It works great and inserts the html code to the field [ descripton ] in my database. I am now scratching my head on how I convert this back to my webpage for a preview. When I output this back to my page it showing me the html code only. the < becomes < " becomes " And so on. I need it to output and convert the html code so it shows the preview Hope you can make some sense of thos. Link to comment https://forums.phpfreaks.com/topic/108744-outputting-html-source-back-to-php-page-from-field-in-mysql-database/ Share on other sites More sharing options...
pocobueno1388 Posted June 4, 2008 Share Posted June 4, 2008 Take a look at the html_entity_decode() function. Link to comment https://forums.phpfreaks.com/topic/108744-outputting-html-source-back-to-php-page-from-field-in-mysql-database/#findComment-557679 Share on other sites More sharing options...
adrian28uk Posted June 4, 2008 Author Share Posted June 4, 2008 That works a treat. Bloody hell I have messing around with this for about 2 hours looking for a function. Thank you very much. Link to comment https://forums.phpfreaks.com/topic/108744-outputting-html-source-back-to-php-page-from-field-in-mysql-database/#findComment-557683 Share on other sites More sharing options...
discomatt Posted June 4, 2008 Share Posted June 4, 2008 Be VERY careful with HTML input from untrusted sources. People can throw any data they want into a POST request, including dangerous javascript... if this is outputted to the end user at any point, an XXS attack can be easily performed. Link to comment https://forums.phpfreaks.com/topic/108744-outputting-html-source-back-to-php-page-from-field-in-mysql-database/#findComment-557687 Share on other sites More sharing options...
adrian28uk Posted June 4, 2008 Author Share Posted June 4, 2008 Then I suppose we need something that looks for a javascript tag? Link to comment https://forums.phpfreaks.com/topic/108744-outputting-html-source-back-to-php-page-from-field-in-mysql-database/#findComment-557690 Share on other sites More sharing options...
discomatt Posted June 4, 2008 Share Posted June 4, 2008 Here's a GREAT script that cleans XSS attacks for you http://htmlpurifier.org/ Link to comment https://forums.phpfreaks.com/topic/108744-outputting-html-source-back-to-php-page-from-field-in-mysql-database/#findComment-557692 Share on other sites More sharing options...
pocobueno1388 Posted June 4, 2008 Share Posted June 4, 2008 Here's a GREAT script that cleans XSS attacks for you http://htmlpurifier.org/ I second that. I've used the htmlpurifier class, and it works great. Link to comment https://forums.phpfreaks.com/topic/108744-outputting-html-source-back-to-php-page-from-field-in-mysql-database/#findComment-557738 Share on other sites More sharing options...
adrian28uk Posted June 4, 2008 Author Share Posted June 4, 2008 Brilliant. Thank you all for your help. Link to comment https://forums.phpfreaks.com/topic/108744-outputting-html-source-back-to-php-page-from-field-in-mysql-database/#findComment-557741 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.