Jump to content


Photo

Stop processing html apart from 1 tag


  • Please log in to reply
2 replies to this topic

#1 jaymc

jaymc
  • Members
  • PipPipPip
  • Advanced Member
  • 1,521 posts
  • LocationLiverpool

Posted 18 October 2006 - 11:55 AM

Right, I have a PM system which allows members to send messages to each other

Now, when reading these messages I want to protect the script by disabling the processing of html

So, if a member types out a message like so "<b>hi</b> how are you

Then hi will not be in bold, it will simply be displayed with those bold tags around it, the same as it works on here

However, and this is the tricky part, I want it to stop the processing of any HTML, apart from the <img> tags (for use with displaying emoticons in the message)

Any feasable way to go about this?

On the same note, I also want any PHP in messages to be displayed on page, not parsed or ignored
I would love to change the world, but they won't give me the source code

SEO Agency

#2 xsist10

xsist10
  • Members
  • PipPipPip
  • Advanced Member
  • 114 posts

Posted 18 October 2006 - 12:04 PM

See http://www.php.net/strip_tags.

<?php

echo strip_tags($msg, "<img>");

?>

SA PHP Archives - www.phparchives.za.org

#3 jaymc

jaymc
  • Members
  • PipPipPip
  • Advanced Member
  • 1,521 posts
  • LocationLiverpool

Posted 18 October 2006 - 12:17 PM

worked a treat, thanks!
I would love to change the world, but they won't give me the source code

SEO Agency




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users