This is a fairly common issue. Fortunutly the answer is res. straight
forward.
I am not sure what language you are using, but using VBScript in an ASP page
you would use Server.HTMLEncode(yourtext) when you save it, then you the
following function to decode it when you want to display the data.
I am sure there are a few other ways to do it, but I know I have used
before.
Jeremy
Function HTMLDecode(sText)
Dim I
sText = Replace(sText, """, Chr(34))
sText = Replace(sText, "<" , Chr(60))
sText = Replace(sText, ">" , Chr(62))
sText = Replace(sText, "&" , Chr(38))
sText = Replace(sText, " ", Chr(32))
For I = 1 to 255
sText = Replace(sText, "&#" & I & ";", Chr(I))
Next
HTMLDecode = sText
End Function
_____
From: [email protected]
[mailto:[email protected]] On Behalf Of PDS - John
Sent: 4 August 2009 20:34
To: [email protected]
Subject: [DUG-Offtopic] Web question
Hi
I have a web application where people can submit questions. A smart "IT -
joker" could enter the text "</table>" screwing the whole page:(
What can I do to prevent this "unwanted feature" and just showing the text
as such?
John C
_______________________________________________
NZ Borland Developers Group Offtopic mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/offtopic
Unsubscribe: send an email to [email protected] with
Subject: unsubscribe