avoiding tags in comments and post titles

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
scarface222
Forum Contributor
Posts: 354
Joined: Thu Mar 26, 2009 8:16 pm

avoiding tags in comments and post titles

Post by scarface222 »

Hey guys, quick question, was wondering if anyone knew a smart way to avoid users posting div tags or something in a topic title or comment that the browser will take literally, that will mess up the display of the page.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: avoiding tags in comments and post titles

Post by requinix »

Always run user input through htmlentities (better) or htmlspecialchars (okay) before displaying it.
scarface222
Forum Contributor
Posts: 354
Joined: Thu Mar 26, 2009 8:16 pm

Re: avoiding tags in comments and post titles

Post by scarface222 »

thanks man
Post Reply