When someone makes a post and uses <a href in their text, text gets converted into live link. How can I remove this, or stop users from doing this. It is asp, using .mdb file, and field is memo. Thanks.
txbakers
4:18 am on Mar 31, 2006 (gmt 0)
When they make the submit, before you write it to the database, do a String(field).replace("<a href","") which will remove the code.
You might want to make this more elegant though.
brickwall
5:25 am on Mar 31, 2006 (gmt 0)
it is always a good idea to do some processing on text submitted on your form fields before committing them to the db. prevents a lot of problems later on, especially those dreaded sql injections.
carguy84
6:45 am on Mar 31, 2006 (gmt 0)
Use a regular expression. A straight up replace won't work, because the < a href could look like: <a title="Bon Jovi" href="example.com" >
mattglet
11:59 am on Mar 31, 2006 (gmt 0)
Another feasible option other than the regex would be to replace all "<" and ">" with "<" and ">" before inserting into the database.
Of course, when it's displayed on the page, it will output the code like this: