I have an ASP news page to which you can add comments. The comments open up in a new window, and users can click reply to reply to them after which they are taken to the parent page which has a comment form to fill in. The comments show fine, except when you click reply, and they contain either the " or the ' ie, apostrophe or double quotes, . what happens with the apostrophe is that instead of an
'
it shows
ampersand, hash, 39 and semicolon. (I tried adding them here, but they turned into an apostrophe. so i had to edit this post and type in this sentence)
One of the include files that is the "inc.api.as p" has the code for all this i think, and i think it needs altering somewhere. I'm not sure if it's the parent page inc_api code that needs altering or the pop page which shows the comment.
Here is part of the inc_api.com page with the relevant code which may need fixing. Any suggestions welcome. Thanks in advance
'
it shows
ampersand, hash, 39 and semicolon. (I tried adding them here, but they turned into an apostrophe. so i had to edit this post and type in this sentence)
One of the include files that is the "inc.api.as p" has the code for all this i think, and i think it needs altering somewhere. I'm not sure if it's the parent page inc_api code that needs altering or the pop page which shows the comment.
Here is part of the inc_api.com page with the relevant code which may need fixing. Any suggestions welcome. Thanks in advance
Code:
<p>
<%
'// REPLACES INVALID CHARS FROM STRING TO BE PASSED INTO JavaScript
'// REPLACES THE FOLLOWING CHARS: "-'-(-) with `-`-[-`]
FUNCTION FIX_JS_STR(val)
Dim TMP_VAL
TMP_VAL = val
If Len(TMP_VAL) > 0 Then
TMP_VAL = Replace(TMP_VAL,chr(34),""")
TMP_VAL = Replace(TMP_VAL,"'","`")
TMP_VAL = Replace(TMP_VAL,"(","[")
TMP_VAL = Replace(TMP_VAL,")","]")
End IF
FIX_JS_STR = TMP_VAL
END FUNCTION
'// ENCRYPTS STRING SUCH AS PASSWORD
'// Returns encrypted string such as: BTEGE^J] to password
FUNCTION EnCrypt(strCryptThis)
Dim strChar, iKeyChar, iStringChar, i
for i = 1 to Len(strCryptThis)
iKeyChar = Asc(mid("2564218975223456482120840",i,1))
iStringChar = Asc(mid(strCryptThis,i,1))
iCryptChar = iKeyChar Xor iStringChar
strEncrypted = strEncrypted & Chr(iCryptChar)
next
EnCrypt = strEncrypted
END FUNCTION
'// DECRYPT STRING SUCH AS PASSWORD
'// Returns decrypted string such as: password to BTEGE^J]
FUNCTION DeCrypt(strEncrypted)
Dim strChar, iKeyChar, iStringChar, i
for i = 1 to Len(strEncrypted)
iKeyChar = (Asc(mid("2564218975223456482120840",i,1)))
iStringChar = Asc(mid(strEncrypted,i,1))
iDeCryptChar = iKeyChar Xor iStringChar
strDecrypted = strDecrypted & Chr(iDeCryptChar)
next
DeCrypt = strDecrypted
END FUNCTION
PRIVATE FUNCTION APO(val)
Dim tmpSTR
tmpSTR = val
IF NOT tmpSTR = "" THEN
tmpSTR = Replace(Trim(tmpSTR),chr(34),""")
tmpSTR = Replace(Trim(tmpSTR),"'","''")
tmpSTR = Replace(Trim(tmpSTR),"<","<")
tmpSTR = Replace(Trim(tmpSTR),">",">")
IF DB_TO_USE = 3 THEN tmpSTR = Replace(Trim(tmpSTR),"\","\\")
END IF
'APO = tmpSTR
APO = replace(val, "'", "'")
END FUNCTION
PRIVATE FUNCTION APO_LAX(val)
Dim strRES
strRES = Replace(Trim(val),"'","''")
IF DB_TO_USE = 3 THEN strRES = Replace(Trim(strRES),"\","\\")
'APO_LAX = strRES
APO_LAX = replace(val, "'", "'")
END FUNCTION
PRIVATE FUNCTION APO_INJ(val)
Dim tmpSTR
tmpSTR = val
IF NOT tmpSTR = "" THEN
tmpSTR = Replace(Trim(tmpSTR),chr(34),""")
tmpSTR = Replace(Trim(tmpSTR),"<","<")
tmpSTR = Replace(Trim(tmpSTR),">",">")
IF DB_TO_USE = 3 THEN tmpSTR = Replace(Trim(tmpSTR),"\","\\")
END IF
'APO_INJ = tmpSTR
APO_INJ = replace(val, "'", "'")
END FUNCTION
Comment