Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

don't want html tags in my forum

Status
Not open for further replies.

tranquillo

Technical User
Jan 6, 2003
22
SE
Hi...

I've built a forum/guestbook thing for a website. it's verry basic. it simply writes text into a database and then shows it on a new page. the problem is that if someone writes a html tag such as a <img src...> the image will show... I don'w want that...
can someone help me with this?

thanx.

-s
 
i do not allow tags at all in my forum and simply do not write that message into db, for this reason i use this regexp, it also detects any code that needs to be enclosed in <starting_string ending_string> like for php <? ?>

preg_match('/<([a-z]+)[^>]*>.+<\/([a-z]+)[^>]*>|<(\?|%|([a-z]+)[^>]*).*(\?|%|)>/is',$str_msg_new)

u can use it also in javascript, so before submitting the info check the text entered
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top