PDA

View Full Version : tags


sporter
10-20-2005, 07:14 AM
On my site people may use some html code to enter into a textarea. However I don't wanna let them display images and links to other pages.
To be exactly, I only want them to use:

<P> & </P>
<EM> & </EM>
<U> & </U>
<STRONG> & </STRONG>
<P align=center> & </P>
<P align=left> & </P>
<P align=right> & </P>
<P align=justify> & </P>

So I want to delete all other html tags & javascript, or anything else they can put in. What lines do I need to make sure they only use the tags above and for the rest plain text ?

bazz
10-20-2005, 11:06 AM
heh, I betcha FishMonger will show you a better way :p :) but it seems to me that it would be easier to prevent the imaging and linking.

possibly with

$textarea =~ s/<img.*?>//g;
$textarea =~ s/<a.*?>//g;

If anyone were to make an img link where it didn't begin with <img then, that first line of mine wouldn't work. But I'm not sure that they could do that anyway.

Bazz