<%
'安全
'UserAgent=Trim(Request.Servervariables("HTTP_USER_AGENT"))
'If not (Instr(UserAgent,"MSIE")>0 or Instr(UserAgent,"NetCaptor")>0) Then
'  call msgbox("非法操作，不要使用\nTeleport、WebZip、FlashGet、Offline、GoogleBot、WebCrawler、Scooter、MyIe或下载本站。",1)
'End If

'过滤文字
Function ChkBadWords(fString)
  bwords = split(BadWords, "|")
  For i = 0 to ubound(bwords)
    fString = Replace(fString, bwords(i), string(len(bwords(i)),"*"), 1,-1,1) 
  Next
  ChkBadWords = fString
  'strContent=ChkBadWords(strContent)
End Function

'过滤HTML代码
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
'////////////////////////////////
function RN_HTMLEncode(fString)
if not isnull(fString) then
    fString = replace(fString, "&gt;",">")
    fString = replace(fString, "&lt;","<")
    fString = Replace(fString, "&nbsp;",CHR(32))
    fString = Replace(fString, "&nbsp;",CHR(9))
    fString = Replace(fString,  "&quot;",CHR(34))
    fString = Replace(fString,  "&#39;",CHR(39))
    fString = Replace(fString,  "",CHR(13))
    fString = Replace(fString, "</P><P>",CHR(10) & CHR(10))
    fString = Replace(fString, "<BR> ",CHR(10))
    rn_HTMLEncode = fString
end if
end function

'写系统日志

Function syslog_function(log_username,log_content)
 '  On error resume next
   syslog_Sql = "Insert Into T_club_log (F_username,F_syslog,F_regtime) Values ('"&log_username&"','"&log_content&"','"&now()&"')"  
'response.write syslog_sql
   conn.Execute(syslog_sql)
   If err then 
	 Result = err.description
	 err.clear
   Else
	 Result = "OK"
   End if
   syslog_function = Result
 End Function
 
 
'过滤HTML代码2
function HTMLEncode2(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> ")
    HTMLEncode2 = fString
end if
end function


'过滤表单字符
function HTMLcode(fString)
if not isnull(fString) then
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
    fString = Replace(fString, CHR(10), "<BR>")
    HTMLcode = fString
end if
end function



'****************************************
'功能：过滤危险字符及返回标准内容
'说明：
'函数名					功能
'CheckStr				过滤非法字符
'CheckInt				过滤ID类参数，可以用下面的也是一样，不过该函数已经封闭错误的可能，所以如果使用该函数，黑客应该很明白了，会主动放弃脚本攻击
'MyRequest				和CheckInt任意选一种，这个函数是诱导黑客的，给他假信息，让他摸不到头脑。
'****************************************
Function CheckStr(Str)
	Resultstr = Replace(Trim(Str), "'", "")
	'Resultstr = Replace(Resultstr, ";", "")
	'Resultstr = Replace(Resultstr, "-", "")
	'Resultstr = Replace(Resultstr, "=", "")
	'Resultstr = Replace(Resultstr, "<", "")
	'Resultstr = Replace(Resultstr, ">", "")
	'Resultstr = Replace(Resultstr, "(", "")
	'Resultstr = Replace(Resultstr, ")", "")
	'Resultstr = Replace(Resultstr, "[", "")
	'Resultstr = Replace(Resultstr, "]", "")
	'Resultstr = Replace(Resultstr, " ", "")
	Checkstr  = Resultstr
End Function

'提示框
Function MsgBox(error,n)
  Copyright = "\n\n　　　　　Copyright by 2004 0574.Tv"
  Response.write "<script>alert('" & Replace(error,"'","\'") & Copyright & "');" & vbcrlf
  If Vartype(n) = 2 then
    If n = 1 then  Response.write "history.go(-1);" & vbcrlf
    If n = 3 then	Response.write "parent.top.location.reload();" & vbcrlf
    If n=4 or n=5 then Response.write "opener.location.reload();" & vbcrlf
    If n=2 or n=5 then Response.write "window.close();" & vbcrlf
  else
    Response.write "window.location.href='" & n & "';" & vbcrlf
  end if
  response.write " </script>"
End Function

'显示分页
Sub ShowPage(strParameter)
  if m_PageNo = ""  then m_PageNo =1
  if cint(m_PageNo) < 1 or cint(m_PageNo) > m_Page then m_PageNo = 1
  Response.write "<table width='98%' border=0 align='center'  cellspacing=0 >"
  Response.write "  <tr>"
  Response.write "    <td width='49%' height=22>"
  Response.write "	 共"
  Response.write "	 <font color=red><b>"& m_RecordCount &"</b></font>"
  Response.write "	 条记录 当前第"
  Response.write "	 <font color=red><b>"& m_PageNo &"</b></font>"
  Response.Write "     页/共"
  Response.write "	 <font color=red><b>"& m_Page &"</b></font>"
  Response.write "	 页"
  Response.write "	 </td>"
  Response.write "    <td width='60%' align='right'>"
  If m_PageNo > 1 then
    response.write "<a href='?Page=1&"&strParameter&"'> <img alt='首页' src='../Images/PageHome.gif' border=0 width='15' height='14'></a>"
  Else
    response.write "<img alt='首页' src='../Images/PageHome.gif' border=0 width='15' height='14'>"
  End if
  if m_PageNo > 1 then
    response.write "<a href='?PageNo="&m_PageNo-1&"&"&strParameter&"'><img alt='上一页' src='../Images/PageUp.gif' border=0 width='15' height='14'></a>"
  else
    response.write "<img alt='上一页' src='../Images/PageUp.gif' border=0 width='15' height='14'>"
  end if
  dim m_PageNumber,m,n,i
  m_PageNumber = 4 '数字分页个数+1
  if m_PageNo-int(m_PageNumber/2) <= 1 then m = 1 else m = m_PageNo-int(m_PageNumber/2)
  if m+m_PageNumber > m_Page then 
    n = m_Page
    if m_Page-m_PageNumber <= 1 then m=1 else m = m_Page - m_PageNumber
  else
    n = m+m_PageNumber
  end if
  for i = m to n
    if pno = cint(m_PageNo) then
      response.write "&nbsp;<font color=red>"&i&"</font>"
    else
      response.write "<b>&nbsp;<a href='?PageNo="&i&"&"&strParameter&"'>"&i&"</a></b>"
    end if
  next
  Response.Write "&nbsp"
  if int(m_PageNo) < int(m_Page) then
    response.write "<a href='?PageNo="&m_PageNo+1&"&"&strParameter&"'><img alt='下一页' src='../Images/PageDown.gif' border=0 width='15' height='14'></a>"
  else 
    response.write "<img alt='下一页' src='../Images/PageDown.gif' border=0 width='15' height='14'>"
  end if
  if int(m_PageNo) < int(m_Page) then
    response.write "<a href='?PageNo="&m_Page&"&"&strParameter&"'><img alt='末页' src='../Images/PageEnd.gif' border=0 width='15' height='14'></a>"
  else
    response.write "<img alt='末页' src='../Images/PageEnd.gif' border=0 width='15' height='14'>"
  end if
  Response.write "    </td>"
  Response.write "  </tr>"
  Response.write "</table>"
End Sub
%>