<%
'******************************************************
'文件名： inputReplaceChar
'作  用：input过滤非法输入字符
'参  数：strChar-----要过滤的字符
'返回值：处理后的字符串
'******************************************************


 function inputReplaceChar(strChar)
      
	strChar = Replace(strChar,CHR(13),"")
	strChar = Replace(strChar,CHR(10) & CHR(10),"")
	strChar = Replace(strChar,CHR(10),"")
        strChar = replace(strChar,">","")   
        strChar = replace(strChar,"<","")
        strChar = replace(strChar,"\","") 
        strChar = replace(strChar,"%","")   
        strChar = replace(strChar,"&nbsp;","") 
        strChar = replace(strChar,"&","")   
        strChar = replace(strChar," ","")
        strChar = replace(strChar,"'",  " ") 
        strChar = replace(strChar,"‘","")
        strChar = replace(strChar,"’","")  
        strChar = replace(strChar,"“","") 
        strChar = replace(strChar,"”","") 
        strChar = replace(strChar,"。","") 
        strChar = replace(strChar,"，","")      
        strChar = replace(strChar,"""","")
        strChar = Replace(strChar,CHR(32),"")   '&nbsp;
        strChar = Replace(strChar,CHR(9),"")    '&nbsp;
        strChar = Replace(strChar,CHR(39),"&#39;") '单引号过滤
        strChar = replace(strChar,";","；")     '分号过滤
        strChar = replace(strChar,"--", "——") '--过滤
        strChar = replace(strChar,"%20","")    '特殊字符过滤
        strChar = replace(strChar,"==","")     '==过滤
        strChar = replace(strChar,"=","")     '=过滤
        strChar = Replace(strChar,CHR(34),"&quot;")
       inputReplaceChar = strChar
 End function
'******************************************************
'文件名： HTMLEncode
'作  用：TEXTAREA过滤非法输入字符
'参  数：HTMLEncode2-----要过滤的字符
'返回值：处理后的字符串
'******************************************************
function HTMLEncode(fString)
    if not isnull(fString) then
        fString = replace(fString,">","&gt;")
        fString = replace(fString,"<","&lt;")

        fString = Replace(fString,CHR(32),"&nbsp;")
        fString = Replace(fString,CHR(9),"&nbsp;")
        fString = Replace(fString,CHR(34),"&quot;")
        fString = Replace(fString,CHR(39),"&#39;")
        fString = Replace(fString,CHR(13),"")
        fString = Replace(fString,CHR(10)&CHR(10),"</P><P>")
        fString = Replace(fString,CHR(10),"<BR>")

        HTMLEncode = fString
    end if
end function


'******************************************************
'文件名： HTMLEncode2
'作  用：TEXTAREA过滤非法输入字符
'参  数：HTMLEncode2-----要过滤的字符
'返回值：处理后的字符串
'******************************************************

 function HTMLEncode2(fString)
	fString = Replace(fString,CHR(13),"")
	fString = Replace(fString,CHR(10)&CHR(10),"</P><P>")
	fString = Replace(fString,CHR(10),"<BR>")
        fString = replace(fString,">","&gt;")   
        fString = replace(fString,"<","&lt;")   
        fString = replace(fString,"&","&amp;")   
        fString = replace(fString," ","&nbsp;")   
        fString = replace(fString,"""","&quot;")
        fString = replace(fString,"%20","")
        
       HTMLEncode2 = fString
   End function

'******************************************************
'文件名： trimVBcrlf
'作  用：input去掉字符串头尾的连续的回车和空格
'参  数：input-----要过滤的字符
'返回值：处理后的字符串
'******************************************************

function trimVBcrlf(str)
trimVBcrlf=rtrimVBcrlf(ltrimVBcrlf(str))
end function

'******************************************************
'文件名： inputReplace
'作  用：input过滤非法输入字符
'参  数：strChar-----要过滤的字符
'返回值：处理后的字符串
'******************************************************


 function inputReplace(strChar)
	strChar = Replace(strChar,CHR(13),"")
	strChar = Replace(strChar,CHR(10) & CHR(10),"")
	strChar = Replace(strChar,CHR(10),"")
        strChar = replace(strChar,">","")   
        strChar = replace(strChar,"<","")
        strChar = replace(strChar,"\","") 
        strChar = replace(strChar,"%","")   
        strChar = replace(strChar,"&nbsp;","") 
        strChar = replace(strChar,"&","")   
        strChar = replace(strChar," ","")
        strChar = replace(strChar,"'","") 
        strChar = replace(strChar,"‘","")
        strChar = replace(strChar,"’","")  
        strChar = replace(strChar,"“","") 
        strChar = replace(strChar,"”","") 
        strChar = replace(strChar,"。","") 
        strChar = replace(strChar,"，","")      
        strChar = replace(strChar,"""","")
        strChar = Replace(strChar,CHR(32),"")   '&nbsp;
        strChar = Replace(strChar,CHR(9),"")    '&nbsp;
        strChar = Replace(strChar,CHR(39),"&#39;") '单引号过滤
        strChar = replace(strChar,";","；")     '分号过滤
        strChar = replace(strChar,"--","——") '--过滤
        strChar = replace(strChar,"%20","")    '特殊字符过滤
        strChar = replace(strChar,"==","")     '==过滤
        strChar = replace(strChar,"=","")     '=过滤
        strChar = Replace(strChar,CHR(34),"&quot;")
        
       inputReplace = strChar
 End function

 

Function sqlCheckstr(strChar) 
     If Isnull(strChar) Then 
      sqlCheckStr = "" 
      Exit Function 
     End If
     strChar = Replace(strChar,"'","")
     strChar = Replace(strChar,";","")  
     strChar = Replace(strChar,CHR(13),"")
     strChar = Replace(strChar,CHR(10) & CHR(10),"")
     strChar = Replace(strChar,CHR(10),"")
     strChar = replace(strChar,">","")   
     strChar = replace(strChar,"<","")
     strChar = replace(strChar,"\","") 
     strChar = replace(strChar,"%","")   
     strChar = replace(strChar,"&nbsp;","") 
     strChar = replace(strChar,"&","")   
     strChar = replace(strChar,"  ","")
     strChar = replace(strChar,"'","") 
     strChar = replace(strChar,"‘","")
     strChar = replace(strChar,"’","")  
     strChar = replace(strChar,"“","") 
     strChar = replace(strChar,"”","") 
     strChar = replace(strChar,"。","") 
     strChar = replace(strChar,"，","")      
     strChar = replace(strChar,"""","")
     strChar = Replace(strChar,CHR(32),"")   '&nbsp;
     strChar = Replace(strChar,CHR(9),"")    '&nbsp;
     strChar = Replace(strChar,CHR(39),"&#39;") '单引号过滤
     strChar = replace(strChar,";", "；")     '分号过滤
     strChar = replace(strChar,"--", "——") '--过滤
     strChar = replace(strChar,"%20","")    '特殊字符过滤
     strChar = replace(strChar,"==","")     '==过滤
     strChar = replace(strChar,"=","")     '=过滤
     strChar = Replace(strChar,CHR(34),"&quot;")
     strChar = Replace(strChar,Chr(0),"") 
     strChar = Replace(strChar,"""","") 
     strChar = Replace(strChar,"[","") 
     strChar = Replace(strChar,"]","")
     strChar = Replace(strChar,"{","") 
     strChar = Replace(strChar,"}","")  
     strChar = Replace(strChar,"""","") 
     strChar = Replace(strChar,"=","") 
     strChar = Replace(strChar,"'","")
     strChar = Replace(strChar,Chr(13),"") 
     strChar = Replace(strChar,"@#","")  
     strChar = Replace(strChar,"'","")  
     strChar = Replace(strChar,"script","") 
     strChar = Replace(strChar,"SCRIPT","") 
     strChar = Replace(strChar,"Script","") 
     strChar = Replace(strChar,"sCript","") 
     strChar = Replace(strChar,"object","") 
     strChar = Replace(strChar,"OBJECT","") 
     strChar = Replace(strChar,"Object","") 
     strChar = Replace(strChar,"object","") 
     strChar = Replace(strChar,"applet","") 
     strChar = Replace(strChar,"APPLET","") 
     strChar = Replace(strChar,"Applet","") 
     strChar = Replace(strChar,"applet","") 
     strChar = Replace(strChar,"select","") 
     strChar = Replace(strChar,"execute","") 
     strChar = Replace(strChar,"exec","") 
     strChar = Replace(strChar,"join","") 
     strChar = Replace(strChar,"union","") 
     strChar = Replace(strChar,"where","") 
     strChar = Replace(strChar,"insert","") 
     strChar = Replace(strChar,"delete","") 
     strChar = Replace(strChar,"update","") 
     strChar = Replace(strChar,"like","") 
     strChar = Replace(strChar,"drop","") 
     strChar = Replace(strChar,"create","") 
     strChar = Replace(strChar,"rename","") 
     strChar = Replace(strChar,"count","") 
     strChar = Replace(strChar,"chr","") 
     strChar = Replace(strChar,"mid","") 
     strChar = Replace(strChar,"truncate","") 
     strChar = Replace(strChar,"nchar","") 
     strChar = Replace(strChar,"char","") 
     strChar = Replace(strChar,"alter","") 
     strChar = Replace(strChar,"cast","") 
     strChar = Replace(strChar,"exists","") 
     strChar = Replace(strChar,"vbCrlf","")
     strChar = Replace(strChar,"xp_cmdshell","")
     strChar = Replace(strChar,"net%20localgroup%20administrators","")
     strChar = Replace(strChar,"net%20user", "")
     strChar = Replace(strChar,"delete%20from","")
     strChar = Replace(strChar,"and", "")
     strChar = Replace(strChar,"drop%20table","")
     strChar = Replace(strChar,"from","")
     strChar = Replace(strChar,"and","")
     strChar = Replace(strChar,"/add","")
     strChar = Replace(strChar,"Asc","")
     strChar = Replace(strChar,"and","")
     sqlCheckstr = strChar
End Function

Function sqltxtCheckstr(strChar) 
     If Isnull(strChar) Then 
      sqlCheckStr = "" 
      Exit Function 
     End If
     strChar = Replace(strChar,"'","")
     strChar = Replace(strChar,";","")  
     strChar = Replace(strChar,CHR(13),"")
     strChar = Replace(strChar,CHR(10)&CHR(10),"")
     strChar = Replace(strChar,CHR(10),"")
     strChar = replace(strChar,">","")   
     strChar = replace(strChar,"<","")
     strChar = replace(strChar,"\","") 
     strChar = replace(strChar,"%","")   
     strChar = replace(strChar,"&nbsp;","") 
     strChar = replace(strChar,"&","")   
     strChar = replace(strChar," ","")
     strChar = replace(strChar,"'","") 
     strChar = replace(strChar,"‘","")
     strChar = replace(strChar,"’","")  
     strChar = replace(strChar,"“","") 
     strChar = replace(strChar,"”","") 
     strChar = replace(strChar,"。","") 
     strChar = replace(strChar,"’","")      
     strChar = replace(strChar,"""","")
     strChar = Replace(strChar,CHR(32),"")   '&nbsp;
     strChar = Replace(strChar,CHR(9), "")    '&nbsp;
     strChar = Replace(strChar,CHR(39),"&#39;") '单引号过滤
     strChar = replace(strChar,";","；")     '分号过滤
     strChar = replace(strChar,"--","——") '--过滤
     strChar = replace(strChar,"%20","")    '特殊字符过滤
     strChar = replace(strChar,"==","")     '==过滤
     strChar = replace(strChar,"=","")     '=过滤
     strChar = Replace(strChar,CHR(34), "&quot;")
     strChar = Replace(strChar,Chr(0),"") 
     strChar = Replace(strChar,"""","") 
     strChar = Replace(strChar,"[","") 
     strChar = Replace(strChar,"]","")
     strChar = Replace(strChar,"{","") 
     strChar = Replace(strChar,"}","")  
     strChar = Replace(strChar,"""","") 
     strChar = Replace(strChar,"=","") 
     strChar = Replace(strChar,"'","")
     strChar = Replace(strChar,Chr(13),"") 
     strChar = Replace(strChar,"@#","")  
     strChar = Replace(strChar,"'","")  
     strChar = Replace(strChar,"script","") 
     strChar = Replace(strChar,"SCRIPT","") 
     strChar = Replace(strChar,"Script","") 
     strChar = Replace(strChar,"sCript","") 
     strChar = Replace(strChar,"object","") 
     strChar = Replace(strChar,"OBJECT","") 
     strChar = Replace(strChar,"Object","") 
     strChar = Replace(strChar,"object","") 
     strChar = Replace(strChar,"applet","") 
     strChar = Replace(strChar,"APPLET","") 
     strChar = Replace(strChar,"Applet","") 
     strChar = Replace(strChar,"applet","") 
     strChar = Replace(strChar,"select","") 
     strChar = Replace(strChar,"execute","") 
     strChar = Replace(strChar,"exec","") 
     strChar = Replace(strChar,"join","") 
     strChar = Replace(strChar,"union","") 
     strChar = Replace(strChar,"where","") 
     strChar = Replace(strChar,"insert","") 
     strChar = Replace(strChar,"delete","") 
     strChar = Replace(strChar,"update","") 
     strChar = Replace(strChar,"like","") 
     strChar = Replace(strChar,"drop","") 
     strChar = Replace(strChar,"create","") 
     strChar = Replace(strChar,"rename","") 
     strChar = Replace(strChar,"count","") 
     strChar = Replace(strChar,"chr","") 
     strChar = Replace(strChar,"mid","") 
     strChar = Replace(strChar,"truncate","") 
     strChar = Replace(strChar,"nchar","") 
     strChar = Replace(strChar,"char","") 
     strChar = Replace(strChar,"alter","") 
     strChar = Replace(strChar,"cast","") 
     strChar = Replace(strChar,"exists","") 
     strChar = Replace(strChar,"vbCrlf","")
     strChar = Replace(strChar,"xp_cmdshell","")
     strChar = Replace(strChar,"net%20localgroup%20administrators","")
     strChar = Replace(strChar,"net%20user","")
     strChar = Replace(strChar,"delete%20from","")
     strChar = Replace(strChar,"and", "")
     strChar = Replace(strChar,"drop%20table","")
     strChar = Replace(strChar,"from","")
     strChar = Replace(strChar,"and","")
     strChar = Replace(strChar,"/add","")
     strChar = Replace(strChar,"Asc","")
     strChar = Replace(strChar,"and","")
     sqlCheckstr = strChar
End Function

Function sqlhtmCheckstr(strChar) 
     If Isnull(strChar) Then 
      sqlCheckStr = "" 
      Exit Function 
     End If
     strChar = Replace(strChar,"script","") 
     strChar = Replace(strChar,"SCRIPT","") 
     strChar = Replace(strChar,"Script","") 
     strChar = Replace(strChar,"sCript","") 
     sqlCheckstr = strChar
End Function

Function SafeRequest(ParaName,ParaType)
       Dim ParaValue
       ParaValue=Request(ParaName)
       If ParaType=1 then
              If not isNumeric(ParaValue) then
                     Response.write "<center>参数" & ParaName & "必须为数字型，请正确操作！</center>"
                     Response.end
              End if
       Else
              ParaValue=replace(ParaValue,"'","''")
       End if
       SafeRequest=ParaValue
End function

Function FormatSQL(strChar)
if strChar="" then
FormatSQL=""
else
     strChar = Replace(strChar,"(","")
     strChar = Replace(strChar,"(","")
     strChar = Replace(strChar,")","")
     strChar = Replace(strChar,"*","")
     strChar = Replace(strChar,"?","")
     strChar = Replace(strChar,"'","")
     strChar = Replace(strChar,";","") 
     strChar = Replace(strChar,CHR(13),"")
     strChar = Replace(strChar,CHR(10)&CHR(10),"")
     strChar = Replace(strChar,CHR(10),"")
     strChar = replace(strChar,">","")   
     strChar = replace(strChar,"<","")
     strChar = replace(strChar,"\","") 
     strChar = replace(strChar,"%","")   
     strChar = replace(strChar,"&nbsp;","") 
     strChar = replace(strChar,"&","")   
     strChar = replace(strChar," ","")
     strChar = replace(strChar,"'","") 
     strChar = replace(strChar,"‘","")
     strChar = replace(strChar,"’","")  
     strChar = replace(strChar,"“","") 
     strChar = replace(strChar,"”","") 
     strChar = replace(strChar,"。","") 
     strChar = replace(strChar,"，","")      
     strChar = replace(strChar,"""","")
     strChar = Replace(strChar,CHR(32),"")   '&nbsp;
     strChar = Replace(strChar,CHR(9),"")    '&nbsp;
     strChar = Replace(strChar,CHR(39),"") '单引号过滤
     strChar = replace(strChar,";","；")     '分号过滤
     strChar = replace(strChar,"--","——") '--过滤
     strChar = replace(strChar,"%20","")    '特殊字符过滤
     strChar = replace(strChar,"==","")     '==过滤
     strChar = replace(strChar,"=","")     '=过滤
     strChar = Replace(strChar,CHR(34),"&quot;")
     strChar = Replace(strChar,Chr(0),"") 
     strChar = Replace(strChar,"""","") 
     strChar = Replace(strChar,"[","") 
     strChar = Replace(strChar,"]","")
     strChar = Replace(strChar,"{","") 
     strChar = Replace(strChar,"}","")  
     strChar = Replace(strChar,"""","")
     strChar = Replace(strChar,"'","‘")  
     strChar = Replace(strChar,"=","") 
     strChar = Replace(strChar,"@#","")   
     strChar = Replace(strChar,"script","") 
     strChar = Replace(strChar,"SCRIPT","") 
     strChar = Replace(strChar,"Script","") 
     strChar = Replace(strChar,"sCript","") 
     strChar = Replace(strChar,"object","") 
     strChar = Replace(strChar,"OBJECT","") 
     strChar = Replace(strChar,"Object","") 
     strChar = Replace(strChar,"object","") 
     strChar = Replace(strChar,"applet","") 
     strChar = Replace(strChar,"APPLET","") 
     strChar = Replace(strChar,"Applet","") 
     strChar = Replace(strChar,"applet","") 
     strChar = Replace(strChar,"select","") 
     strChar = Replace(strChar,"execute","") 
     strChar = Replace(strChar,"exec","") 
     strChar = Replace(strChar,"join","") 
     strChar = Replace(strChar,"union","") 
     strChar = Replace(strChar,"where","") 
     strChar = Replace(strChar,"insert","") 
     strChar = Replace(strChar,"delete","") 
     strChar = Replace(strChar,"update","") 
     strChar = Replace(strChar,"like","") 
     strChar = Replace(strChar,"drop","") 
     strChar = Replace(strChar,"create","") 
     strChar = Replace(strChar,"rename","") 
     strChar = Replace(strChar,"count","") 
     strChar = Replace(strChar,"chr","") 
     strChar = Replace(strChar,"mid","") 
     strChar = Replace(strChar,"truncate","") 
     strChar = Replace(strChar,"nchar","") 
     strChar = Replace(strChar,"char","") 
     strChar = Replace(strChar,"alter","") 
     strChar = Replace(strChar,"cast","") 
     strChar = Replace(strChar,"exists","") 
     strChar = Replace(strChar,"vbCrlf","")
     strChar = Replace(strChar,"xp_cmdshell","")
     strChar = Replace(strChar,"net%20localgroup%20administrators","")
     strChar = Replace(strChar,"net%20user","")
     strChar = Replace(strChar,"delete%20from","")
     strChar = Replace(strChar,"and", "")
     strChar = Replace(strChar,"drop%20table","")
     strChar = Replace(strChar,"from","")
     strChar = Replace(strChar,"and","")
     strChar = Replace(strChar,"/add","")
     strChar = Replace(strChar,"Asc","")
     FormatSQL=strChar
end if
End Function 



%>
