Jump to content

Sanitizing using HTMLawed


kreut

Recommended Posts

Hello,

 

I'm trying to sanitize user input and have been banging my head over HTMLpurifier the last several days (some weird encoding issues).  So...I decided to try out HTMLawed.  Using the following code:

 require_once('htmLawed/htmLawed.php'); 
$text ='<script type="text/javascript">This is bad stuff</script><p>hello how are < you?';
$out = htmLawed($text);
echo $out;

 

I would think that it would get rid of my javascript.  But, in the browser $text looked exactly the same.  This is such a newbie question that I'm embarrassed to ask it as the HTMLawed documentation "looked" great.  Can someone please explain the error of my ways?

 

Thanks so much,

 

Eric

 

Link to comment
Share on other sites

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.