<%
'========================================================================================
' 文 件 名: commfun.asp
' 版    本: 岭峰网行业专用留言系统3.10.0 (LFMessS 2020 - 3.10.0.F Build 200604)
' 说    明: 公共函数库 | 请勿自行修改该处文件，以确保程序正确的执行
' 文件日期: 2020-06-04
' 设 计 者: 疾风之狼
'========================================================================================
' 郑州文达岭峰网络科技有限公司.
'========================================================================================
' Copyright (C) 2001-2020 岭峰网. All rights reserved.
' 网    站: http://www.lfmesss.com
' 电子邮件: support@lfmesss.com
' 联系ＱＱ: 85112407
'========================================================================================

Function qq(LingFengNet_MS_num_1)
	IF Left(LingFengNet_MS_num_1, 4) = ""& LingFengNet_MS_language_addnew_mess_mes_3 &"" Then
		qqxs = "http://wpa.qq.com/msgrd?V=1&Uin="& Right(LingFengNet_MS_num_1, (Len(LingFengNet_MS_num_1) - 4)) &"&Site="& LingFengNet_MS_language_QQ_all &"&Menu=no"
	Else
		qqxs = "#"
	End IF   
	qq = qqxs  
End Function

Sub Chkproxy()
	IF flg = "manok" and LingFengNet_MS_proxylf = 0 Then
		IF Instr(allhttp, "proxy") <> 0 or Instr(allhttp,"http_via") <> 0 or Request.ServerVariables("HTTP_X_FORWARDED_FOR") <> "" Then
			Server.Transfer("noallow"& Get_Suffix() &"")
		End IF 
	End IF
End Sub

Function sjs()
    Dim MyValue 
    Randomize 
    MyValue = Int((9 * Rnd) + 1)
    sjs = MyValue 
End Function

Function checkup()
	Dim checkupArray
	checkupArray = Array(319,348,377,406,435,464)
	For i = Lbound(checkupArray) to Ubound(checkupArray)
		checkup = checkup & Mid(LingFengNet_MS_language_cop, checkupArray(i), 1)
	Next
	checkup = checkup
	'checkup =" wfr"
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 = Lcase(Mid(name, i, 1))
			IF InStr("abcdefghijklmnopqrstuvwxyz_-.", 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 ChkMail(ByVal Email) 
	Dim Rep,Pmail : ChkMail = True : Set Rep = New RegExp 
	Rep.Pattern = "([.a-zA-Z0-9_-]){2,10}@([a-zA-Z0-9_-]){2,10}(.([a-zA-Z0-9]){2,}){1,4}$" 
	Pmail = Rep.Test(Email) : Set Rep = Nothing 
	IF Not Pmail Then ChkMail = False 
End Function 

Function RegExp_LFW_vbs(patrn, strng) 
	Dim regEx, retVal 
	Set regEx = New RegExp 
	regEx.Pattern = patrn
	regEx.IgnoreCase = False 
	retVal = regEx.Test(strng) 
	RegExp_LFW_vbs = retVal
End Function 

Function rrstr(str)
	str = "|" & str & "|"
	str = Replace(str,"||", "|")
	rrstr = str
End Function

Function admin_ip(userip)
    Dim My_ip 
    My_ip = Right(userip, 3)
	IF Left(My_ip, 1) = "." Then
		My_ip = "*.*.*."& Right(userip, 2)
	Else
		My_ip = "*.*.*."& My_ip
	End IF
    admin_ip = My_ip
End Function 

Function nobr(str_br)
	str_br = Replace(str_br, ""& Chr(13) &"", "<br>")
	str_br = Replace(str_br, ""& Chr(10) &"", "<br>")
	'str_br = Replace(str_br,""& Chr(34) &"","<br>")
	str_br = Replace(str_br, "  ", "&ensp;&ensp;")
	nobr = str_br
End Function

Function nobr_no(str_br_no)
	str_br_no = Replace(str_br_no, ""& Chr(13) &"", "")
	str_br_no = Replace(str_br_no, ""& Chr(10) &"", "")
	'str_br_no = Replace(str_br_no,""& Chr(34) &"","")
	nobr_no = str_br_no
End Function 

Function chkquanban(str)
	LingFengNet_MS_chkquanban_xiao =  "0|1|2|3|4|5|6|7|8|9|.|%" 
	LingFengNet_MS_chkquanban_da =  "０|１|２|３|４|５|６|７|８|９|．|％" 
	chkquanban_da = Split(LingFengNet_MS_chkquanban_da,"|")
	chkquanban_xiao = Split(LingFengNet_MS_chkquanban_xiao,"|")
	For i = 0 to Ubound(chkquanban_da)
		chkquanban_da_new = chkquanban_da(i)
		chkquanban_xiao_new = chkquanban_xiao(i)
		IF Instr(1, str, chkquanban_xiao_new, vbTextCompare) <> 0 Then
			str = Replace(str, chkquanban_da_new, chkquanban_xiao_new)
		End IF
	Next
	chkquanban = str
End Function 

Function CheckExt(FileExt, CheckPlus)
	IF CheckPlus = 1 Then
		DimFileExt = DimFileExt_plus
	Else
		DimFileExt = DimFileExt	
	End IF	
	IF DimFileExt = "*" Then CheckExt = True
	Ext = Split(DimFileExt, ",")
	For i = 0 To Ubound(Ext)
		IF Lcase(FileExt) = Ext(i) Then 
			CheckExt = True
			Exit Function
		End IF
	Next
End Function

Function GetDateModify(filepath)
	Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.GetFile(filepath) 
	s = f.DateLastModified 
	Set f = Nothing
	Set fso = Nothing
	GetDateModify = s
End Function

Function GetDateCreate(filepath)
	Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.GetFile(filepath) 
	s = f.DateCreated 
	Set f = Nothing
	Set fso = Nothing
	GetDateCreate = s
End Function

Function chkURLEncode(Str)
	temp = Replace(Str, "%", "%25")
	temp = Replace(temp, "#", "%23")
	temp = Replace(temp, "&", "%26")
	chkURLEncode = temp
End Function

Function clebr(Str)
	temp = Server.HtmlEncode(Replace(Str, "<br>", ""))
	clebr = temp
End Function

Function chan_chr(Str)
	temp = Replace(Str, ""& Chr(13) &"", "")
	temp = Replace(temp, ""& Chr(10) &"", "")
	temp = Replace(temp, ""& Chr(34) &"", ""& Chr(34) & Chr(34) &"")
	chan_chr = temp
End Function

Function tohh_chr(Str)
	temp = Replace(Str, "|", ""& Chr(13) & Chr(10) &"")
	tohh_chr = temp
End Function

Function tosh_chr(Str)
	temp = Replace(Str, ""& Chr(13) & Chr(10) &"", "|")
	tosh_chr = temp
End Function

Function toxs_chr(Str)
	temp = Replace(Str, "|", "、")
	toxs_chr = temp
End Function

Function toshpass_chr(Str)
	IF Instr(Str,""& Chr(13) & Chr(10) &"") = 0 Then
		IF Len(Str) = 32 Then
			toshpass_chr = Str
		Else
			toshpass_chr = LFW_md5_32_pass(Str)
			'toshpass_chr=Str
		End IF		
	Else	
		passReturn = Split(Str, ""& Chr(13) & Chr(10) &"")
		For i = LBound(passReturn) To UBound(passReturn)
			IF Len(passReturn(i)) = 32 Then
				toshpass_chr_sub = passReturn(i)
			Else
				toshpass_chr_sub = LFW_md5_32_pass(passReturn(i))
				'toshpass_chr_sub=passReturn(i)
			End IF
			IF i = LBound(passReturn) Then
				toshpass_chr = toshpass_chr_sub
			Else	
				toshpass_chr = toshpass_chr & "|" & toshpass_chr_sub
			End IF
		Next
	End IF	
End Function

Function CreateSelect(str, todo)
	Selstr = Split(str, "|")
	IF todo = "yes" Then
		Response.Write "<option value="& Selstr(0) &" selected>"& Selstr(0) &"</option>" & vbCR
	End IF	
	For i = 0 To Ubound(Selstr) STEP 1 
		Response.Write "<option value=" & Selstr(i) & ">" & Selstr(i) & "</option>" & vbCR
	next
End Function

Function Get_ReplaceSuffix(str)
	IF LingFengNet_MS_Rewrite <> 0 Then
		Get_ReplaceSuffix = str
	Else		
		Get_ReplaceSuffix = Replace(str, ".asp", ".html")
	End IF
End Function

Function Get_Suffix()
	IF LingFengNet_MS_Rewrite <> 0 Then
		Get_Suffix = ".asp"
	Else
		Get_Suffix = ".html"
	End IF
End Function

Function Get_FileName(filename)
	Dim objFSO,objFile
	Get_FileName = 0
	Set objFSO = Server.CreateObject("scripting.FileSystemObject") 
	IF objFSO.FileExists(Server.MapPath(filename)) Then 
		Set objFile = objFSO.GetFile(Server.MapPath(filename)) 
		IF objFile.Size <> 155 Then
			Get_FileName = 1
		End IF
	Else 
		Get_FileName = 1
	End IF 
	Set objFile = Nothing 
	Set objFSO = Nothing 
End Function

Function SendSysMail(subject, email, sender, content)
	'On Error Resume Next
	Set JMail = Server.CreateObject("JMail.Message") 
	JMail.Silent = True
	JMail.Logging = True
	JMail.Charset = LingFengNet_MS_language_meta_mes_1 ' 邮件字符集，默认为"US-ASCII"

	'//发送者信息
	JMail.From = LingFengNet_MS_ToMail_ServerPost ' 发送者地址
	JMail.FromName = sender ' 发送者姓名
	JMail.MailServerUserName = LingFengNet_MS_ToMail_ServerAccount '身份验证的用户名
	JMail.MailServerPassword = LingFengNet_MS_ToMail_ServerCommand ' 身份验证的密码	
	JMail.Subject = subject ' 邮件主题	
	JMail.AddRecipient(email)
	
	'//设置优先级
	JMail.Priority = 3	
	
	JMail.AddHeader "Priority", "3"
	JMail.AddHeader "MSMail-Priority", "Normal"	

	'//邮件主体
	JMail.ContentType = "text/html"
	JMail.HTMLBody = content
	
	'//邮件主体（文本部分）
	'JMail.Body = "正文"

	JMail.Send(LingFengNet_MS_ToMail_ServerPost)
	JMail.Close()
	Set JMail = Nothing
End function

Function getTopic(txt, length)
	txt = Trim(txt)
	txtLength = Strlength(txt)	
	IF txtLength > length Then
		getTopic = LeftStr(txt,length) &"..."
	Else
		getTopic = txt
	End IF
End Function

Function Strlength(Str) 
	Temp_Str = Len(Str) 
	For i = 1 To Temp_Str 
		Test_Str = (Mid(Str, i, 1)) 
		IF Asc(Test_Str) > 0 Then 
			Strlength = Strlength + 1 
		Else 
			Strlength = Strlength + 2 
		End IF 
	Next 
End Function 

Function LeftStr(StrValue, NumValue)
	Dim nStr,a,i
	For i = 1 to Len(StrValue)
		a = Mid(StrValue, i, 1)
		IF Asc(a) < 0 Then
			nStr = nStr + 2
		Else
			nStr = nStr + 1
		End IF
		LeftStr = LeftStr & a
		IF nStr >= CInt(NumValue) Then Exit Function
	Next
End Function

Function CheckSize(ByteSize)
	IF ByteSize => 1024000 Then
		ByteSize = FormatNumber(ByteSize / 1024000) &" MB"
	ElseIF ByteSize => 1024 Then
		ByteSize = FormatNumber(ByteSize / 1024) &" KB"
	Else
		ByteSize = ByteSize &" 字节"
	End IF
	CheckSize = ByteSize
End Function

Function CData(dbPathOrg)
	Set fso = CreateObject("Scripting.FileSystemObject")
	dbPath = Server.Mappath(dbPathOrg)
	Set oldfile = fso.GetFile(dbPath)
	filesizeold = CheckSize(oldfile.size)
	Dim fso, Engine, strDBPath
'	strDBPath = Left(dbPath, InStrRev(dbPath, "\"))
'	strDBPath = strDBPath & "config/temp.asp"
	strDBPath = "../config/temp.asp"
	
	IF fso.FileExists(dbPath) Then
		Set Engine = CreateObject("JRO.JetEngine")
		On Error Resume Next
		Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath, _
		"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath
		fso.CopyFile strDBPath, dbPath
		filesizenew = CheckSize(oldfile.size)
		fso.DeleteFile(strDBPath)
		Set fso = Nothing
		Set Engine = Nothing
		logstr = LingFengNet_MS_language_Warning_CData_7
		Call logtodo(logstr, 1, "ok")
		Response.Write "<meta http-equiv=Content-Type content=text/html;charset="& LingFengNet_MS_language_meta_mes_1 &"><script>alert('"& LingFengNet_MS_language_Warning_CData_1 &"" & dbPathOrg & " "& LingFengNet_MS_language_Warning_CData_2  & "\n\n" & LingFengNet_MS_language_Warning_CData_5 & filesizeold &"，"& LingFengNet_MS_language_Warning_CData_6 & filesizenew &"。');history.go(-1);</script>"
		Response.End
	Else
		logstr = LingFengNet_MS_language_Warning_CData_8
		Call logtodo(logstr ,1, "err")
		Response.Write "<meta http-equiv=Content-Type content=text/html;charset="& LingFengNet_MS_language_meta_mes_1 &"><script>alert('"& LingFengNet_MS_language_Warning_CData_1 &"" & dbPathOrg & " "& LingFengNet_MS_language_Warning_CData_3 & "\n\n" & LingFengNet_MS_language_Warning_CData_5 & filesizeold &"，"& LingFengNet_MS_language_Warning_CData_6 & filesizenew &"。');history.go(-1);</script>"
		Response.End
	End IF
End Function

Function getDateNow()
	s = Hour(time())
	f = Minute(time())
	m = Second(time())
	IF Len(s) = 1 Then s = "0" & s
	IF Len(f) = 1 Then f = "0" & f
	IF Len(m) = 1 Then m = "0" & m
	n = Year(date())
	y = Month(date())
	r = Day(date())
	IF Len(y) = 1 Then y = "0" & y
	IF Len(r) = 1 Then r = "0" & r
	LFW_nowsj = n & "-" & y & "-" & r & " "
	getDateNow = LFW_nowsj & s & ":" & f & ":" & m
End Function

'过滤HTML代码的函数包括过滤CSS和JS
Function RemoveHTML(strHTML)    
	StrHtml = Replace(StrHtml, vbCrLf, "") 
	StrHtml = Replace(StrHtml, Chr(13)&Chr(10), "") 
	StrHtml = Replace(StrHtml, Chr(13), "") 
	StrHtml = Replace(StrHtml, Chr(10), "") 
	StrHtml = Replace(StrHtml, " "," ") 
	StrHtml = Replace(StrHtml, "    ", "")
	
	Dim objRegExp, Match, Matches 
	Set objRegExp = New Regexp 
	
	objRegExp.IgnoreCase = True 
	objRegExp.Global = True
	
	'取闭合的<> 
	objRegExp.Pattern = "<style(.+?)/style>" 
	'进行匹配 
	Set Matches = objRegExp.Execute(strHTML) 
	
	' 遍历匹配集合，并替换掉匹配的项目 
	For Each Match in Matches 
		strHtml = Replace(strHTML, Match.Value, "") 
	Next
	
	'取闭合的<> 
	objRegExp.Pattern = "<script(.+?)/script>" 
	'进行匹配 
	Set Matches = objRegExp.Execute(strHTML) 
	
	' 遍历匹配集合，并替换掉匹配的项目 
	For Each Match in Matches 
		strHtml = Replace(strHTML,Match.Value,"") 
	Next
	
	'取闭合的<> 
	objRegExp.Pattern = "<.+?>" 
	'进行匹配 
	Set Matches = objRegExp.Execute(strHTML) 
	
	' 遍历匹配集合，并替换掉匹配的项目 
	For Each Match in Matches 
		strHtml = Replace(strHTML,Match.Value,"") 
	Next
	
	RemoveHTML = strHTML 
	Set objRegExp = Nothing 
End Function	

Function IsObjInstalled(strClassString)
	On Error Resume Next
	IsObjInstalled = False
	Err = 0
	Dim xTestObj
	Set xTestObj = Server.CreateObject(strClassString)
	IF 0 = Err Then IsObjInstalled = True
	Set xTestObj = Nothing
	Err = 0
End Function

Function DiffADate(theDate)
	DiffADate = DateDiff("d", theDate, Now)
End Function

Function getLylx(str)
	getLylx = "<select name=""lylx""><option value=""0"" selected>"& LingFengNet_MS_language_Warning_search_3 &"</option>"
	strARR = Split(str, "|")
	For i = 0 to ubound(strARR)
		lylx = strARR(i)
		getLylx = getLylx & "<option value="""& lylx &""" >"& lylx &"</option>"
	Next
	getLylx = getLylx&"</select>"
End Function

Function get_enpass(digits)
	Dim char_array(50)
	char_array(0) = "1"
	char_array(1) = "1"
	char_array(2) = "2"
	char_array(3) = "3"
	char_array(4) = "4"
	char_array(5) = "5"
	char_array(6) = "6"
	char_array(7) = "7"
	char_array(8) = "8"
	char_array(9) = "9"
	char_array(10) = "A"
	char_array(11) = "B"
	char_array(12) = "C"
	char_array(13) = "D"
	char_array(14) = "E"
	char_array(15) = "F"
	char_array(16) = "G"
	char_array(17) = "H"
	char_array(18) = "I"
	char_array(19) = "J"
	char_array(20) = "K"
	char_array(21) = "L"
	char_array(22) = "M"
	char_array(23) = "N"
	char_array(24) = "O"
	char_array(25) = "P"
	char_array(26) = "Q"
	char_array(27) = "R"
	char_array(28) = "S"
	char_array(29) = "T"
	char_array(30) = "U"
	char_array(31) = "V"
	char_array(32) = "W"
	char_array(33) = "X"
	char_array(34) = "Y"
	char_array(35) = "Z"
	randomize
	Do while Len(output) < digits
		num = char_array(Int((35 - 0 + 1) * Rnd + 0))
		output = output + num
	Loop
	get_enpass = output
End Function
	
Function getHTTPPage(url) 
	Dim Http 
	Set Http = Server.Createobject("MSXML2.serverXMLHTTP") 
	Http.open "GET", url, False 
	Http.send() 
	IF Http.readystate <> 4 Then 
		Exit Function 
	End IF 
	getHTTPPage = BytesToBstr(Http.responseBody, "GB2312") 
	Set http = Nothing 
	IF Err.Number <> 0 Then Err.Clear 
End Function 

Function BytesToBstr(body, Cset)
	Dim objstream
	Set objstream = Server.CreateObject("ADODB.Stream")
	objstream.Type = 1
	objstream.Mode = 3
	objstream.Open
	objstream.Write body
	objstream.Position = 0
	objstream.Type = 2
	objstream.CharSet = Cset
	BytesToBstr = objstream.ReadText 
	objstream.Close
	Set objstream = Nothing
End Function

Function Newstring(wstr, strng)
	Newstring = Instr(Lcase(wstr), Lcase(strng))
	IF Newstring <= 0 Then Newstring = Len(wstr)
End Function

Function autoup()
	IF Day(date()) = LingFengNet_MS_autoupdate and Day(Application("LingFengNet_MS_autoup")) <> LingFengNet_MS_autoupdate and LingFengNet_MS_autoupdate <> 0 Then 
		Response.Write "<meta http-equiv=content-type content=text/html;charset="& LingFengNet_MS_language_meta_mes_1 &"><script>ask=confirm('"& LingFengNet_MS_language_check_update_10 &"'); if (ask==true){window.location='admin_checkupdate_GB"& Get_Suffix() &"';}else{} </script>"
		Application("LingFengNet_MS_autoup") = date()
	End IF
End Function

Function autobak()
	IF IsObjInstalled("Scripting.FileSystemObject") and LingFengNet_MS_autobak <> 0 Then
		IF DiffADate(Application("LingFengNet_MS_server")) >= LingFengNet_MS_autobak or IsNull(Application("LingFengNet_MS_server")) Then
			n = Year(date())
			y = Month(date())
			r = Day(date())
			s = Hour(time())
			f = Minute(time())
			IF Len(y) = 1 Then y = "0" & y
			IF Len(r) = 1 Then r = "0" & r
			IF Len(s) = 1 Then s = "0" & s
			IF Len(f) = 1 Then f = "0" & f
			LingFengNet_MS_nowsj = n & "-"& y &"-"& r &"-"& s&f
			Dbpath = "../data/#"& LingFengNet_MS_language_bakdata_mes_9 & LingFengNet_MS_nowsj &".asp"
			Dbpath = Server.Mappath(Dbpath) 
			db2 = Server.Mappath(dbnow)
			Set Fso = Server.Createobject("Scripting.FileSystemobject")
			fso.copyfile db2, dbpath, True
			Set fso = Nothing
			Application("LingFengNet_MS_server") = now()
		End IF
	End IF	
End Function

Sub ShowAllFile(Path)
	IF Not Response.IsClientConnected Then Response.End()
	Set FSO = CreateObject("Scripting.FileSystemObject")
	IF Not FSO.FolderExists(path) Then Exit Sub
	Set f = FSO.GetFolder(Path)
	dirName = FSO.GetFilename(Path)
	IF dirName = "upload" Then
		CheckPlus = 1
	Else
		CheckPlus = 0
	End IF		
	Set fc2 = f.files
	For Each myfile in fc2
		IF CheckExt(FSO.GetExtensionName(path & "\" & myfile.name), CheckPlus) and myfile.Size < AspSize Then
			Call ScanFile(Path & Temp & "\" & myfile.name, "")
			SumFiles = SumFiles + 1
		End IF
	Next
	Set fc = f.SubFolders
	For Each f1 in fc
		ShowAllFile path & "\" & f1.name
		SumFolders = SumFolders + 1
    Next
	Set FSO = Nothing
End Sub

Function ScanFile(FilePath, InFile)
	IF InFile <> "" Then
		Infiles =  alertimg & "<span style=color:red>"& LingFengNet_MS_language_safecenter_22 &"<a href=""http://"& Request.Servervariables("server_name") & "/" & chkURLEncode(InFile) & """ target=_blank>"& InFile & "</a>"& LingFengNet_MS_language_safecenter_23 &"</span>"
	End IF
	temp = "<a href=""http://" & Request.ServerVariables("server_name") & "/" & chkURLEncode(Replace(Replace(FilePath, Server.MapPath("\")&"\", "", 1, 1, 1),"\", "/"))&""" target=_blank>" & Replace(FilePath,server.MapPath("\")&"\", "", 1, 1, 1) & "</a>"
	On Error Resume Next 
	Set tStream = Server.CreateObject("ADODB.Stream")
	tStream.Type = 1
	tStream.Mode = 3
	tStream.Open
	tStream.Position = 0
	tStream.LoadFromFile FilePath
	IF err Then Exit Function End IF
	tStream.type = 2
	tStream.charset = LingFengNet_MS_language_meta_mes_1
	Do Until tStream.EOS
		filetxt = filetxt & LCase(Replace(tStream.ReadText(102400), Chr(0), ""))
	Loop
	tStream.close()
	Set tStream = Nothing

	Set FSOs = CreateObject("Scripting.FileSystemObject")	
	IF Len(filetxt) > 0 Then
		'特征码检查
		filetxt = vbcrlf & filetxt
			'Check "WScr"&DoMyBest&"ipt.Shell"
			IF Instr( filetxt, Lcase("WScr"&DoMyBest&"ipt.Shell") ) or Instr( filetxt, Lcase("clsid:72C24DD5-D70A"&DoMyBest&"-438B-8A42-98424B88AFB8") ) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>WScr"&DoMyBest&"ipt.Shell "& LingFengNet_MS_language_safecenter_24 &" clsid:72C24DD5-D70A"&DoMyBest&"-438B-8A42-98424B88AFB8</td><td>" & alertimg & "<span style=color:red>"& LingFengNet_MS_language_safecenter_25 &"</span>"&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check "PH"&DoMyBest&"P"
			IF Instr( filetxt, Lcase("Ph"&DoMyBest&"p") ) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>Binary format</td><td>" & alertimg & "<span style=color:red>"& LingFengNet_MS_language_safecenter_26 &"</span>"&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check "She"&DoMyBest&"ll.Application"
			IF Instr( filetxt, Lcase("She"&DoMyBest&"ll.Application") ) or Instr( filetxt, Lcase("clsid:13709620-C27"&DoMyBest&"9-11CE-A49E-444553540000") ) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>She"&DoMyBest&"ll.Application "& LingFengNet_MS_language_safecenter_24 &" clsid:13709620-C27"&DoMyBest&"9-11CE-A49E-444553540000</td><td>" & alertimg & "<span style=color:red>"& LingFengNet_MS_language_safecenter_25 &"</span>"&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check Unicode
			IF Instr( filetxt, chr(-22048)) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>无</td><td>" & alertimg & "<span style=color:red>"& LingFengNet_MS_language_safecenter_27 &"</span>"&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check .Encode
			Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "\bLANGUAGE\s*=\s*[""]?\s*(vbscript|jscript|javascript).encode\b"
			IF regEx.Test(filetxt) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>(vbscript|jscript|javascript).Encode</td><td>" & alertimg & "<span style=color:red>"& LingFengNet_MS_language_safecenter_28 &"</span>"&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check ASP backdoor
			regEx.Pattern = "\bEv"&"al\b"
			IF regEx.Test(filetxt) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>Ev"&"al</td><td>e"&"val()"& LingFengNet_MS_language_safecenter_29 &"ev"&"al(X)<br>"& LingFengNet_MS_language_safecenter_30 &""&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check exe&cute backdoor
			regEx.Pattern = "[^.]\bExe"&"cute\b"
			IF regEx.Test(filetxt) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>Exec"&"ute</td><td>" & alertimg & "<span style=color:red>e"&"xecute()"& LingFengNet_MS_language_safecenter_31 &"ex"&"ecute(X)</span><br>"&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check .(Open|Create)TextFile
			regEx.Pattern = "\.(Open|Create)TextFile\b"
			IF regEx.Test(filetxt) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>.Crea"&"teTextFile|.O"&"penTextFile</td><td>"& LingFengNet_MS_language_safecenter_32 &""&infiles&""& LingFengNet_MS_language_safecenter_33 &"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check .SaveT&oFile
			regEx.Pattern = "\.SaveT"&"oFile\b"
			IF regEx.Test(filetxt) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>.Sa"&"veToFile</td><td>"& LingFengNet_MS_language_safecenter_34 &""&infiles&""& LingFengNet_MS_language_safecenter_35 &"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check .&Save
			regEx.Pattern = "\.Sa"&"ve\b"
			IF regEx.Test(filetxt) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>.Sa"&"ve</td><td>"& LingFengNet_MS_language_safecenter_36 &""&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check set Server
			regEx.Pattern = "set\s*.*\s*=\s*server\s"
			IF regEx.Test(filetxt) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>Set xxx=Se"&"rver</td><td>" & alertimg & "<span style=color:red>"& LingFengNet_MS_language_safecenter_38 &"Set xxx=Ser" & jj & "ver"& LingFengNet_MS_language_safecenter_37 &".execute</span><br>"&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check Server.(Transfer|Ex&ecute)
			regEx.Pattern = "Server.(Ex"&"ecute|Transfer)([ \t]*|\()[^""]\)"
			IF regEx.Test(filetxt) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>Server.Ex"&"ecute</td><td>" & alertimg & "<span style=color:red>"& LingFengNet_MS_language_safecenter_39 &"Server.e"&"xecute()"& LingFengNet_MS_language_safecenter_40 &"</span><br>"&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check .Ru&n
			regEx.Pattern = "\.R"&"un\b"
			IF regEx.Test(filetxt) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>.Ru"&"n</td><td>" & alertimg & "<span style=color:red>"& LingFengNet_MS_language_safecenter_41 &"</span><br>"&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check .Exe&c
			regEx.Pattern = "\.Ex"&"ec\b"
			IF regEx.Test(filetxt) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>.Ex"&"ec</td><td>" & alertimg & "<span style=color:red>"& LingFengNet_MS_language_safecenter_42 &"</span><br>"&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			'Check .Shel&lExecute
			regEx.Pattern = "\.Shel"&"lExecute\b"
			IF regEx.Test(filetxt) Then
				Report = Report&"<tr><td>"&Temp&"</td><td>.ShellE"&"xecute</td><td>" & alertimg & "<span style=color:red>"& LingFengNet_MS_language_safecenter_43 &"</span><br>"&infiles&"</td><td>"& LingFengNet_MS_language_safecenter_18 &""&GetDateCreate(filepath)&"<br>"& LingFengNet_MS_language_safecenter_19 &""&GetDateModify(filepath)&"</td></tr>"
				Sun = Sun + 1
			End IF
			Set regEx = Nothing
			
		'Check include file with "
		Set regEx = New RegExp
		regEx.IgnoreCase = True
		regEx.Global = True
		regEx.Pattern = "<!--\s*#include\s*file\s*=\s*"".*"""
		Set Matches = regEx.Execute(filetxt)
		For Each Match in Matches
			tFile = Replace(Mid(Match.Value, Instr(Match.Value, """") + 1, Len(Match.Value) - Instr(Match.Value, """") - 1),"/","\")
			IF Not CheckExt(FSOs.GetExtensionName(tFile)) Then
				Call ScanFile( Mid(FilePath,1,InStrRev(FilePath,"\"))&tFile, Replace(FilePath,server.MapPath("\")&"\","",1,1,1) )
				SumFiles = SumFiles + 1
			End IF
		Next
		Set Matches = Nothing
		Set regEx = Nothing
		
		'Check include file with '
		Set regEx = New RegExp
		regEx.IgnoreCase = True
		regEx.Global = True
		regEx.Pattern = "<!--\s*#include\s*file\s*=\s*'.*'"
		Set Matches = regEx.Execute(filetxt)
		For Each Match in Matches
			tFile = Replace(Mid(Match.Value, Instr(Match.Value, "'") + 1, Len(Match.Value) - Instr(Match.Value, "'") - 1),"/","\")
			IF Not CheckExt(FSOs.GetExtensionName(tFile)) Then
				Call ScanFile( Mid(FilePath,1,InStrRev(FilePath,"\"))&tFile, Replace(FilePath,server.MapPath("\")&"\","",1,1,1) )
				SumFiles = SumFiles + 1
			End IF
		Next
		Set Matches = Nothing
		Set regEx = Nothing
		
		'Check include virtual with "
		Set regEx = New RegExp
		regEx.IgnoreCase = True
		regEx.Global = True
		regEx.Pattern = "<!--\s*#include\s*virtual\s*=\s*"".*"""
		Set Matches = regEx.Execute(filetxt)
		For Each Match in Matches
			tFile = Replace(Mid(Match.Value, Instr(Match.Value, """") + 1, Len(Match.Value) - Instr(Match.Value, """") - 1),"/","\")
			IF Not CheckExt(FSOs.GetExtensionName(tFile)) Then
				Call ScanFile( Server.MapPath("\")&"\"&tFile, Replace(FilePath,server.MapPath("\")&"\","",1,1,1) )
				SumFiles = SumFiles + 1
			End IF
		Next
		Set Matches = Nothing
		Set regEx = Nothing
		
		'Check include virtual with '
		Set regEx = New RegExp
		regEx.IgnoreCase = True
		regEx.Global = True
		regEx.Pattern = "<!--\s*#include\s*virtual\s*=\s*'.*'"
		Set Matches = regEx.Execute(filetxt)
		For Each Match in Matches
			tFile = Replace(Mid(Match.Value, Instr(Match.Value, "'") + 1, Len(Match.Value) - Instr(Match.Value, "'") - 1),"/","\")
			IF Not CheckExt(FSOs.GetExtensionName(tFile)) Then
				Call ScanFile( Server.MapPath("\")&"\"&tFile, Replace(FilePath,server.MapPath("\")&"\","",1,1,1) )
				SumFiles = SumFiles + 1
			End IF
		Next
		Set Matches = Nothing
		Set regEx = Nothing
				
		'Check Server&.Execute|Transfer
		Set regEx = New RegExp
		regEx.IgnoreCase = True
		regEx.Global = True
		regEx.Pattern = "Server.(Exec"&"ute|Transfer)([ \t]*|\()"".*"""
		Set Matches = regEx.Execute(filetxt)
		For Each Match in Matches
			tFile = Replace(Mid(Match.Value, Instr(Match.Value, """") + 1, Len(Match.Value) - Instr(Match.Value, """") - 1),"/","\")
			IF Not CheckExt(FSOs.GetExtensionName(tFile)) Then
				Call ScanFile( Mid(FilePath,1,InStrRev(FilePath,"\"))&tFile, Replace(FilePath,server.MapPath("\")&"\","",1,1,1) )
				SumFiles = SumFiles + 1
			End IF
		Next
		Set Matches = Nothing
		Set regEx = Nothing
			
		'Check RunatScript
		Set XregEx = New RegExp
		XregEx.IgnoreCase = True
		XregEx.Global = True
		XregEx.Pattern = "<scr"&"ipt\s*(.|\n)*?runat\s*=\s*""?server""?(.|\n)*?>"
		Set XMatches = XregEx.Execute(filetxt)
		For Each Match in XMatches
			tmpLake2 = Mid(Match.Value, 1, InStr(Match.Value, ">"))
			srcSeek = InStr(1, tmpLake2, "src", 1)
			IF srcSeek > 0 Then
				srcSeek2 = Instr(srcSeek, tmpLake2, "=")
				For i = 1 To 50
					tmp = Mid(tmpLake2, srcSeek2 + i, 1)
					IF tmp <> " " and tmp <> chr(9) and tmp <> vbCrLf Then
						Exit For
					End IF
				Next
				IF tmp = """" Then
					tmpName = Mid(tmpLake2, srcSeek2 + i + 1, Instr(srcSeek2 + i + 1, tmpLake2, """") - srcSeek2 - i - 1)
				Else
					IF InStr(srcSeek2 + i + 1, tmpLake2, " ") > 0 Then tmpName = Mid(tmpLake2, srcSeek2 + i, Instr(srcSeek2 + i + 1, tmpLake2, " ") - srcSeek2 - i) Else tmpName = tmpLake2
					IF InStr(tmpName, chr(9)) > 0 Then tmpName = Mid(tmpName, 1, Instr(1, tmpName, chr(9)) - 1)
					IF InStr(tmpName, vbCrLf) > 0 Then tmpName = Mid(tmpName, 1, Instr(1, tmpName, vbcrlf) - 1)
					IF InStr(tmpName, ">") > 0 Then tmpName = Mid(tmpName, 1, Instr(1, tmpName, ">") - 1)
				End IF
				Call ScanFile( Mid(FilePath,1,InStrRev(FilePath,"\"))&tmpName , Replace(FilePath,server.MapPath("\")&"\","",1,1,1))
				SumFiles = SumFiles + 1
			End IF
		Next
		Set Matches = Nothing
		Set regEx = Nothing
		
	End IF
	set fsos = Nothing
End Function

Function logok()
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql = "SELECT * FROM ok"
	rs.open sql,conn,3,2
	rs.addnew
	rs("ip") = Request.ServerVariables("REMOTE_ADDR")
	rs("addtime") = now()
	rs("okname") = adminname
	rs("okpass") = LingFengNet_MS_language_oklist_mes_6
	rs.update
	rs.close
	Set rs = Nothing
	conn.close
	Set conn = Nothing
End Function

Function logerr()
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql = "SELECT * FROM err"
	rs.open sql,conn,3,2
	rs.addnew
	rs("ip") = Request.ServerVariables("REMOTE_ADDR")
	rs("addtime") = now()
	rs("errname") = adminname
	rs("errpass") = adminpass
	rs.update
	rs.close
	Set rs = Nothing
	conn.close
	Set conn = Nothing
End Function

Function logout()
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql = "SELECT * FROM ok"
	rs.open sql,conn,3,2
	rs.addnew
	rs("ip") = Request.ServerVariables("REMOTE_ADDR")
	rs("addtime") = now()
	rs("okname") = Session("LingFengNet_MS_admin_flg_adminname")
	rs("okpass") = LingFengNet_MS_language_oklist_mes_7
	rs.update
	rs.close
	Set rs = Nothing
	conn.close
	Set conn = Nothing
End Function

Function logtodo(str,todo,fordb)
	Set rslog = Server.CreateObject("ADODB.Recordset")
	sql = "SELECT * FROM ["&fordb&"]"
	rslog.open sql,conn,3,2
	rslog.addnew
	rslog("ip") = Request.ServerVariables("REMOTE_ADDR")
	rslog("addtime") = now()
	rslog(fordb&"name")= Session("LingFengNet_MS_admin_flg_adminname")
	rslog(fordb&"pass") = str
	rslog.update
	rslog.close
	Set rslog = Nothing
	IF todo = 1 Then
		conn.close
		Set conn = Nothing
	End IF
End Function

Function nocab()
	Response.Expires = -9999
	Response.ExpiresAbsolute = Now() - 1
	Response.AddHeader "Pragma","No-Cache"
	Response.AddHeader "Cache-Control","Private"
	Response.CacheControl = "No-Cache"
End Function
%>