Jump to content

Htmlspecialchars and me. Question about safety and flexibility.


majocmatt

Recommended Posts

I have a site where I let users input text into my mysql database. I run their inputs through mysql_real_escape_string before I enter it into the DB and on the output I run it through htmlspecialchars.

 

My question is: How can I add the ability for users to add things such as hyperlinks or images when all the <> brackets and such are converted to their entity counterpart? I don't want them to actually be able to input HTML, or scripts, but I would like to give them the freedom to insert hyperlinks and images, that will parse correctly on the viewing page.

 

What's the best way around this?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.