<%@language="vbscript" codepage="936" %> <% Option Explicit '************************************************************** ' Software name: PowerEasy SiteWeaver ' Web: http://www.powereasy.net ' Copyright (C) 2005-2009 佛山市动易网络科技有限公司 版权所有 '************************************************************** Response.Buffer = True Dim BeginTime BeginTime = Timer %> <% Const SystemDatabaseType = "SQL" '系统数据库类型,"SQL"为MS SQL2000数据库,"ACCESS"为MS ACCESS 2000数据库 '如果是ACCESS数据库,请认真修改好下面的数据库的文件名 Const DBFileName = "\database\SiteWeaver.mdb" 'ACCESS数据库的文件名,请使用相对于网站根目录的的绝对路径 '如果是安装在网站根目录,直接修改文件名即可。如果是安装在网站某一目录下,则在前面加上此目录, '例如,系统安装在“http://www.powereasy.net/PE2006/”目录下(PE2006为安装目录),则这里应该修改为:Const DBFileName = "\PE2006\database\SiteWeaver6.5.mdb" '如果是SQL数据库,请认真修改好以下数据库选项 Const SqlUsername = "kyopkq_113" 'SQL数据库用户名 Const SqlPassword = "a138000A" 'SQL数据库用户密码 Const SqlDatabaseName = "kyopkq_113m" 'SQL数据库名 Const SqlHostIP = "(local)" 'SQL主机IP地址。本地(指网站与数据库在同一台服务器上)可用“(local)”或“127.0.0.1”,非本机(指网站与数据库分别在不同的服务器上)请填写数据库服务器的真实IP) '以下代码请勿改动 Dim Conn Dim PE_True, PE_False, PE_Now, PE_OrderType, PE_DatePart_D, PE_DatePart_Y, PE_DatePart_M, PE_DatePart_W, PE_DatePart_H Sub OpenConn() 'On Error Resume Next Dim ConnStr If SystemDatabaseType = "SQL" Then ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlHostIP & ";" Else ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DBFileName) End If Set Conn = Server.CreateObject("ADODB.Connection") Conn.open ConnStr If Err Then Err.Clear Set Conn = Nothing Response.Write "数据库连接出错,请检查Conn.asp文件中的数据库参数设置。" Response.End End If If SystemDatabaseType = "SQL" Then PE_True = "1" PE_False = "0" PE_Now = "GetDate()" PE_OrderType = " desc" PE_DatePart_D = "d" PE_DatePart_Y = "yyyy" PE_DatePart_M = "m" PE_DatePart_W = "ww" PE_DatePart_H = "hh" Else PE_True = "True" PE_False = "False" PE_Now = "Now()" PE_OrderType = " asc" PE_DatePart_D = "'d'" PE_DatePart_Y = "'yyyy'" PE_DatePart_M = "'m'" PE_DatePart_W = "'ww'" PE_DatePart_H = "'h'" End If End Sub Sub CloseConn() On Error Resume Next If IsObject(Conn) Then Conn.Close Set Conn = Nothing End If Set regEx = Nothing Set PE_Cache = Nothing End Sub %> <% '如果网站频道启用子域名功能,则需要修改下面的设置 Const Enable_SubDomain = False '子域名功能开关 True=启用,False=禁用 Const DomainRoot = "113m.com" '网站域名根 Const strSubDomains = "www|news|shop|soft" '主机名(子域名)列表。比如要启用"news.powereasy.net",这里就加上"news",多个子域名之间用半角"|"分隔 Const EnableStopInjection = False '是否启用防SQL注入功能,True为启用,False为禁用 Const ShowUnpass = True '后台待审核详细资料开关 True=启用,False=禁用 Const FriendSiteCheckCode = True '友情连接验证码开关 True=启用,False=禁用 Const EnableSiteManageCode = True '是否启用后台管理认证码 是: True 否: False Const SiteManageCode = "woaihjl" '后台管理认证码,您可以修改成您的管理员认证码:××××××××× Const MaxPerPage_Create = 100 '生成HTML时,每页生成的数量,建议不要超过100,否则可能会导致页面超时 Const SleepTime = 1 '每页生成完毕后,暂停时间,单位为秒。如果为0,则不暂停,生成当前页面后马上跳转到下一页继续生成。建议设置为3-10 %> <% '************************************************************** ' Software name: PowerEasy SiteWeaver ' Web: http://www.powereasy.net ' Copyright (C) 2005-2009 佛山市动易网络科技有限公司 版权所有 '************************************************************** '判断当前访问者是否已经登录,若已登录,则读取数据并做必要赋值 Function CheckUserLogined() Dim UserPassword, LastPassword Dim rsUser, sqlUser UserID = 0 GroupID = 0 Balance = 0 UserPoint = 0 UserExp = 0 LoginTimes = 0 UserChargeType = 0 CheckUserLogined = False UserName = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("UserName"))) UserPassword = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("UserPassword"))) LastPassword = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("LastPassword"))) If (UserName = "" Or UserPassword = "" Or LastPassword = "") Then ReDim UserSetting(50) CheckUserLogined = False Exit Function End If sqlUser = "SELECT UserID,UserName,GroupID,LoginTimes FROM PE_User WHERE UserName='" & UserName & "' AND UserPassword='" & UserPassword & "' AND LastPassword='" & LastPassword & "' and IsLocked=" & PE_False & "" Set rsUser = Conn.Execute(sqlUser) If rsUser.BOF And rsUser.EOF Then ReDim UserSetting(50) CheckUserLogined = False Else UserName = rsUser("UserName") CheckUserLogined = True UserID = rsUser("UserID") GroupID = rsUser("GroupID") LoginTimes = rsUser("LoginTimes") End If Set rsUser = Nothing End Function '给用户的相应变量赋值 Sub GetUser(sUserName) Dim rsUser, rsGroup Set rsUser = Conn.Execute("SELECT * FROM PE_User WHERE UserName='" & sUserName & "'") If Not (rsUser.BOF And rsUser.EOF) Then UserID = rsUser("UserID") GroupID = rsUser("GroupID") UserType = rsUser("UserType") CompanyID = rsUser("CompanyID") ContacterID = rsUser("ContacterID") ClientID = rsUser("ClientID") Balance = rsUser("Balance") UserPoint = rsUser("UserPoint") UserExp = rsUser("UserExp") ValidNum = rsUser("ValidNum") ValidUnit = rsUser("ValidUnit") BeginTime = rsUser("BeginTime") ValidDays = ChkValidDays(rsUser("ValidNum"), rsUser("ValidUnit"), rsUser("BeginTime")) email = rsUser("Email") UnsignedItems = rsUser("UnsignedItems") If PresentExpPerLogin > 0 Then If DateDiff("D", rsUser("LastPresentTime"), Now()) > 0 Or IsNull(rsUser("LastPresentTime")) Then Conn.Execute ("update PE_User set UserExp=UserExp+" & PresentExpPerLogin & ",LastPresentTime=" & PE_Now & " where UserID=" & UserID & "") End If End If If PE_CLng(Session("UserID")) = 0 Then Conn.Execute ("update PE_User set LastLoginIP='" & UserTrueIP & "',LastLoginTime=" & PE_Now & ",LoginTimes=LoginTimes+1 where UserID=" & UserID & "") Session("UserID") = UserID End If If rsUser("Blog") = True Then BlogFlag = True Else BlogFlag = False End If Set rsGroup = Conn.Execute("select * from PE_UserGroup where GroupID=" & rsUser("GroupID") & "") GroupName = rsGroup("GroupName") GroupType = rsGroup("GroupType") If rsUser("SpecialPermission") = True Then arrClass_Browse = Trim(rsUser("arrClass_Browse")) arrClass_View = Trim(rsUser("arrClass_View")) arrClass_Input = Trim(rsUser("arrClass_Input")) UserSetting = Split(Trim(rsUser("UserSetting")) & ",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", ",") Else arrClass_Browse = Trim(rsGroup("arrClass_Browse")) arrClass_View = Trim(rsGroup("arrClass_View")) arrClass_Input = Trim(rsGroup("arrClass_Input")) UserSetting = Split(Trim(rsGroup("GroupSetting")) & ",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", ",") End If rsGroup.Close Set rsGroup = Nothing NeedlessCheck = PE_CLng(UserSetting(1)) EnableModifyDelete = PE_CLng(UserSetting(2)) MaxPerDay = PE_CLng(UserSetting(3)) PresentExpTimes = PE_CDbl(UserSetting(4)) MaxSendNum = PE_CLng(UserSetting(7)) MaxFavorite = PE_CLng(UserSetting(8)) Discount_Member = PE_CDbl(UserSetting(11)) UserEnableComment = PE_CBool(UserSetting(5)) UserCheckComment = PE_CBool(UserSetting(6)) If UserSetting(12) = 1 Then IsOffer = "是" Else IsOffer = "否" End If UserChargeType = PE_CLng(UserSetting(14)) Dim Message Set Message = Conn.Execute("select Count(0) from PE_Message where Incept = '" & UserName & "' and delR=0 and Flag=0 and IsSend=1") If Message.EOF And Message.Bof Then UnreadMsg = 0 Else UnreadMsg = Message(0) End If Set Message = Nothing End If Set rsUser = Nothing End Sub '************************************************** '函数名:GetSubStr '作 用:截字符串,汉字一个算两个字符,英文算一个字符 '参 数:str ----原字符串 ' strlen ----截取长度 ' bShowPoint ---- 是否显示省略号 '返回值:截取后的字符串 '************************************************** Function GetSubStr(ByVal str, ByVal strlen, bShowPoint) If IsNull(str) Or str = "" Then GetSubStr = "" Exit Function End If Dim l, t, c, i, strTemp str = Replace(Replace(Replace(Replace(str, " ", " "), """, Chr(34)), ">", ">"), "<", "<") l = Len(str) t = 0 strTemp = str strlen = PE_CLng(strlen) For i = 1 To l c = Abs(Asc(Mid(str, i, 1))) If c > 255 Then t = t + 2 Else t = t + 1 End If If t >= strlen Then strTemp = Left(str, i) Exit For End If Next str = Replace(Replace(Replace(Replace(str, " ", " "), Chr(34), """), ">", ">"), "<", "<") strTemp = Replace(Replace(Replace(Replace(strTemp, " ", " "), Chr(34), """), ">", ">"), "<", "<") If strTemp <> str And bShowPoint = True Then strTemp = strTemp & "…" End If GetSubStr = strTemp End Function '************************************************** '函数名:GetStrLen '作 用:求字符串长度。汉字算两个字符,英文算一个字符。 '参 数:str ----要求长度的字符串 '返回值:字符串长度 '************************************************** Function GetStrLen(str) On Error Resume Next Dim WINNT_CHINESE WINNT_CHINESE = (Len("中国") = 2) If WINNT_CHINESE Then Dim l, t, c Dim 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 End If Next GetStrLen = t Else GetStrLen = Len(str) End If If Err.Number <> 0 Then Err.Clear End Function Function Charlong(ByVal str) If str = "" Then Charlong = 0 Exit Function End If str = Replace(Replace(Replace(Replace(str, " ", " "), """, Chr(34)), ">", ">"), "<", "<") Charlong = GetStrLen(str) End Function '************************************************** '函数名:JoinChar '作 用:向地址中加入 ? 或 & '参 数:strUrl ----网址 '返回值:加了 ? 或 & 的网址 '************************************************** Function JoinChar(ByVal strUrl) If strUrl = "" Then JoinChar = "" Exit Function End If If InStr(strUrl, "?") < Len(strUrl) Then If InStr(strUrl, "?") > 1 Then If InStr(strUrl, "&") < Len(strUrl) Then JoinChar = strUrl & "&" Else JoinChar = strUrl End If Else JoinChar = strUrl & "?" End If Else JoinChar = strUrl End If End Function '************************************************** '函数名:ShowPage '作 用:显示“上一页 下一页”等信息 '参 数:sFileName ----链接地址 ' TotalNumber ----总数量 ' MaxPerPage ----每页数量 ' CurrentPage ----当前页 ' ShowTotal ----是否显示总数量 ' ShowAllPages ---是否用下拉列表显示所有页面以供跳转。 ' strUnit ----计数单位 ' ShowMaxPerPage ----是否显示每页信息量选项框 '返回值:“上一页 下一页”等信息的HTML代码 '************************************************** Function ShowPage(sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit, ShowMaxPerPage) Dim TotalPage, strTemp, strUrl, i If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then ShowPage = "" Exit Function End If If totalnumber Mod MaxPerPage = 0 Then TotalPage = totalnumber \ MaxPerPage Else TotalPage = totalnumber \ MaxPerPage + 1 End If If CurrentPage > TotalPage Then CurrentPage = TotalPage strTemp = "
" If ShowTotal = True Then strTemp = strTemp & "共 " & totalnumber & " " & strUnit & "   " End If If ShowMaxPerPage = True Then strUrl = JoinChar(sfilename) & "MaxPerPage=" & MaxPerPage & "&" Else strUrl = JoinChar(sfilename) End If If CurrentPage = 1 Then strTemp = strTemp & "首页 | 上一页 |" Else strTemp = strTemp & "首页 |" strTemp = strTemp & " 上一页 | " End If strTemp = strTemp & " " If ShowAllPages = True Then Dim Jmaxpages If (CurrentPage - 4) <= 0 Or TotalPage < 10 Then Jmaxpages = 1 Do While (Jmaxpages < 10) If Jmaxpages = CurrentPage Then strTemp = strTemp & "" & Jmaxpages & " " Else If strUrl <> "" Then strTemp = strTemp & "" & Jmaxpages & " " End If End If If Jmaxpages = TotalPage Then Exit Do Jmaxpages = Jmaxpages + 1 Loop ElseIf (CurrentPage + 4) >= TotalPage Then Jmaxpages = TotalPage - 8 Do While (Jmaxpages <= TotalPage) If Jmaxpages = CurrentPage Then strTemp = strTemp & "" & Jmaxpages & " " Else If strUrl <> "" Then strTemp = strTemp & "" & Jmaxpages & " " End If End If Jmaxpages = Jmaxpages + 1 Loop Else Jmaxpages = CurrentPage - 4 Do While (Jmaxpages < CurrentPage + 5) If Jmaxpages = CurrentPage Then strTemp = strTemp & "" & Jmaxpages & " " Else If strUrl <> "" Then strTemp = strTemp & "" & Jmaxpages & " " End If End If Jmaxpages = Jmaxpages + 1 Loop End If End If If CurrentPage >= TotalPage Then strTemp = strTemp & "| 下一页 | 尾页" Else strTemp = strTemp & " | 下一页 |" strTemp = strTemp & " 尾页" End If If ShowMaxPerPage = True Then strTemp = strTemp & "   " & strUnit & "/页" Else strTemp = strTemp & " " & MaxPerPage & "" & strUnit & "/页" End If If ShowAllPages = True Then strTemp = strTemp & "  转到第页" End If strTemp = strTemp & "
" ShowPage = strTemp End Function '************************************************** '函数名:ShowPage_en '作 用:显示英文“上一页 下一页”等信息 '参 数:sFileName ----链接地址 ' TotalNumber ----总数量 ' MaxPerPage ----每页数量 ' CurrentPage ----当前页 ' ShowTotal ----是否显示总数量 ' ShowAllPages ---是否用下拉列表显示所有页面以供跳转。 ' strUnit ----计数单位 ' ShowMaxPerPage ----是否显示每页信息量选项框 '返回值:“上一页 下一页”等信息的HTML代码 '************************************************** Function ShowPage_en(sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit, ShowMaxPerPage) Dim TotalPage, strTemp, strUrl, i If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then ShowPage_en = "" Exit Function End If If totalnumber Mod MaxPerPage = 0 Then TotalPage = totalnumber \ MaxPerPage Else TotalPage = totalnumber \ MaxPerPage + 1 End If If CurrentPage > TotalPage Then CurrentPage = TotalPage strTemp = "
" If ShowTotal = True Then strTemp = strTemp & "Total " & totalnumber & " " & strUnit & "  " End If If ShowMaxPerPage = True Then strUrl = JoinChar(sfilename) & "MaxPerPage=" & MaxPerPage & "&" Else strUrl = JoinChar(sfilename) End If If CurrentPage = 1 Then strTemp = strTemp & "FirstPage PreviousPage " Else strTemp = strTemp & "FirstPage " strTemp = strTemp & "PreviousPage " End If If CurrentPage >= TotalPage Then strTemp = strTemp & "NextPage LastPage" Else strTemp = strTemp & "NextPage " strTemp = strTemp & "LastPage" End If strTemp = strTemp & " CurrentPage: " & CurrentPage & "/" & TotalPage & " " If ShowMaxPerPage = True Then strTemp = strTemp & " " & strUnit & "/Page" Else strTemp = strTemp & " " & MaxPerPage & "" & strUnit & "/Page" End If If ShowAllPages = True Then If TotalPage > 20 Then strTemp = strTemp & "  GoTo Page:" Else strTemp = strTemp & " GoTo:" End If End If strTemp = strTemp & "
" ShowPage_en = strTemp End Function '************************************************** '函数名:IsObjInstalled '作 用:检查组件是否已经安装 '参 数:strClassString ----组件名 '返回值:True ----已经安装 ' False ----没有安装 '************************************************** Function IsObjInstalled(strClassString) On Error Resume Next IsObjInstalled = False Err = 0 Dim xTestObj Set xTestObj = CreateObject(strClassString) If Err.Number = 0 Then IsObjInstalled = True Set xTestObj = Nothing Err = 0 End Function '************************************************** '过程名:WriteErrMsg '作 用:显示错误提示信息 '参 数:无 '************************************************** Sub WriteErrMsg(sErrMsg, sComeUrl) Response.Write "错误信息" & vbCrLf Response.Write "

" & vbCrLf Response.Write "" & vbCrLf Response.Write " " & vbCrLf Response.Write " " & vbCrLf Response.Write " " & vbCrLf Response.Write "
错误信息
产生错误的可能原因:" & sErrMsg & "
" If sComeUrl <> "" Then Response.Write "<< 返回上一页" Else Response.Write "【关闭】" End If Response.Write "
" & vbCrLf Response.Write "" & vbCrLf End Sub '************************************************** '过程名:WriteSuccessMsg '作 用:显示成功提示信息 '参 数:无 '************************************************** Sub WriteSuccessMsg(sSuccessMsg, sComeUrl) Response.Write "成功信息" & vbCrLf Response.Write "

" & vbCrLf Response.Write "" & vbCrLf Response.Write " " & vbCrLf Response.Write " " & vbCrLf Response.Write " " & vbCrLf Response.Write "
恭喜你!

" & sSuccessMsg & "
" If sComeUrl <> "" Then Response.Write "<< 返回上一页" Else Response.Write "【关闭】" End If Response.Write "
" & vbCrLf Response.Write "" & vbCrLf End Sub '************************************************** '函数名:FoundInArr '作 用:检测数组中是否有指定的数值 '参 数:strArr ----- 调入的数组 ' strItem ----- 检测的字符 ' strSplit ----- 分割字符 '返回值:True ----有 ' False ----没有 '************************************************** Function FoundInArr(strArr, strItem, strSplit) Dim arrTemp, arrTemp2, i, j FoundInArr = False If IsNull(strArr) Or IsNull(strItem) Or Trim(strArr) = "" Or Trim(strItem) = "" Then Exit Function End If If IsNull(strSplit) Or strSplit = "" Then strSplit = "," End If If InStr(Trim(strArr), strSplit) > 0 Then If InStr(Trim(strItem), strSplit) > 0 Then arrTemp = Split(strArr, strSplit) arrTemp2 = Split(strItem, strSplit) For i = 0 To UBound(arrTemp) For j = 0 To UBound(arrTemp2) If LCase(Trim(arrTemp2(j))) <> "" And LCase(Trim(arrTemp(i))) <> "" And LCase(Trim(arrTemp2(j))) = LCase(Trim(arrTemp(i))) Then FoundInArr = True Exit Function End If Next Next Else arrTemp = Split(strArr, strSplit) For i = 0 To UBound(arrTemp) If LCase(Trim(arrTemp(i))) = LCase(Trim(strItem)) Then FoundInArr = True Exit Function End If Next End If Else If LCase(Trim(strArr)) = LCase(Trim(strItem)) Then FoundInArr = True End If End If End Function '************************************************** '函数名:GetRndPassword '作 用:得到指定位数的随机数密码 '参 数:PasswordLen ---- 位数 '返回值:密码字符串 '************************************************** Function GetRndPassword(PasswordLen) Dim Ran, i, strPassword strPassword = "" For i = 1 To PasswordLen Randomize Ran = CInt(Rnd * 2) Randomize If Ran = 0 Then Ran = CInt(Rnd * 25) + 97 strPassword = strPassword & UCase(Chr(Ran)) ElseIf Ran = 1 Then Ran = CInt(Rnd * 9) strPassword = strPassword & Ran ElseIf Ran = 2 Then Ran = CInt(Rnd * 25) + 97 strPassword = strPassword & Chr(Ran) End If Next GetRndPassword = strPassword End Function '************************************************** '函数名:GetRndNum '作 用:产生制定位数的随机数 '参 数:iLength ---- 随即数的位数 '返回值:随机数 '************************************************** Function GetRndNum(iLength) Dim i, str1 For i = 1 To (iLength \ 5 + 1) Randomize str1 = str1 & CStr(CLng(Rnd * 90000) + 10000) Next GetRndNum = Left(str1, iLength) End Function '************************************************** '函数名:GetIDByDefault '作 用:获取ID值,如果ID为0,则使用缺省值 '参 数:ItemID ---- 项目ID值 ' DefaultID ---- 缺省ID值 '************************************************** Function GetIDByDefault(ItemID, DefaultID) Dim iItemID iItemID = ItemID If iItemID = 0 Then iItemID = DefaultID If IsNull(iItemID) Then iItemID = 0 GetIDByDefault = iItemID End Function '************************************************** '函数名:FillInArrStr '作 用:使用一个用逗号分隔的字符串来填充另外一个逗号分隔的字符串,使其达到指定的项目数 '参 数:strSource ---- 原字符串 ' strFill ---- 填充字符串 ' ItemNum ---- 指定填充后的项目数 '返回值:填充后的字符串 '************************************************** Function FillInArrStr(ByVal strSource, ByVal strFill, ItemNum) Dim arrSource, arrFill, SourceItemNum, FillItemNum, i If IsNull(strSource) Or IsNull(strFill) Then FillInArrStr = "" Exit Function End If arrSource = Split(strSource, ",") arrFill = Split(strFill, ",") SourceItemNum = UBound(arrSource) + 1 FillItemNum = UBound(arrFill) + 1 If SourceItemNum < ItemNum And SourceItemNum + FillItemNum >= ItemNum Then For i = 0 To ItemNum - SourceItemNum - 1 strSource = strSource & "," & arrFill(SourceItemNum + FillItemNum - ItemNum + i) Next End If FillInArrStr = strSource End Function '************************************************** '函数名:XmlText '作 用:从语言包中读取指定节点的值 '参 数:iBigNode ---- 大节点 ' iSmallNode ---- 小节点 ' DefChar ---- 默认值 '返回值:语言包中指定节点的值 '************************************************** Function XmlText(ByVal iBigNode, ByVal iSmallNode, ByVal DefChar) Dim LangRoot, LangSub If IsNull(iBigNode) Or IsNull(iSmallNode) Then XmlText = DefChar Else Set LangRoot = XmlDoc.getElementsByTagName(iBigNode) If LangRoot.Length = 0 Then XmlText = DefChar Else Set LangSub = LangRoot(0).getElementsByTagName(iSmallNode) If LangSub.Length = 0 Then XmlText = DefChar Else XmlText = LangSub(0).text End If End If Set LangRoot = Nothing End If End Function '************************************************** '函数名:GetFirstSeparatorToEnd '作 用:截取从第一个分隔符到结尾的字符串 '参 数:str ----原字符串 ' separator ----分隔符 '返回值:截取后的字符串 '************************************************** Function GetFirstSeparatorToEnd(ByVal str, separator) GetFirstSeparatorToEnd = Right(str, Len(str) - InStr(str, separator)) End Function '************************************************** '函数名:ChkValidDays '作 用:有效期的函数 '参 数:iValidNum ----有效期 ' iValidUnit ----有效期单位 ' iBeginTime ---- 开始计算日期 '返回值:剩余的有效天数 '************************************************** Function ChkValidDays(iValidNum, iValidUnit, iBeginTime) If (iValidNum = "" Or IsNumeric(iValidNum) = False Or iValidUnit = "" Or IsNumeric(iValidUnit) = False Or iBeginTime = "" Or IsDate(iBeginTime) = False) Then ChkValidDays = 0 Exit Function End If Dim tmpDate, arrInterval arrInterval = Array("h", "D", "m", "yyyy") If iValidNum = -1 Then ChkValidDays = 99999 Else tmpDate = DateAdd(arrInterval(iValidUnit), iValidNum, iBeginTime) ChkValidDays = DateDiff("D", Date, tmpDate) End If End Function '************************************************** '函数名:GetNumString '作 用:获得项目随即数 '返回值:随机无重复的数字(用于上传,生成) '************************************************** Function GetNumString() Dim v_ymd, v_hms, v_mmm v_ymd = Year(Now) & Right("0" & Month(Now), 2) & Right("0" & Day(Now), 2) v_hms = Right("0" & Hour(Now), 2) & Right("0" & Minute(Now), 2) & Right("0" & Second(Now), 2) Randomize v_mmm = Right("0" & CStr(CLng(99 * Rnd) + 1), 2) GetNumString = v_ymd & v_hms & v_mmm End Function '************************************************** '函数名:GetMinID '作 用:取某一表某一字段中的最大值 '参 数:SheetName ----查询表 ' FieldName ----查询字段 '返回值:该字段最小值 '************************************************** Function GetMinID(SheetName, FieldName) Dim mrs Set mrs = Conn.Execute("select min(" & FieldName & ") from " & SheetName & "") If IsNull(mrs(0)) Then GetMinID = 1 Else GetMinID = mrs(0) End If Set mrs = Nothing End Function '************************************************** '函数名:GetNewID '作 用:取某一表某一字段中的最大值+1 '参 数:SheetName ----查询表 ' FieldName ----查询字段 '返回值:该字段最大值+1 '************************************************** Function GetNewID(SheetName, FieldName) Dim mrs Set mrs = Conn.Execute("select max(" & FieldName & ") from " & SheetName & "") If IsNull(mrs(0)) Then GetNewID = 1 Else GetNewID = mrs(0) + 1 End If Set mrs = Nothing End Function '************************************************** '函数名:PE_Replace '作 用:容错替换 '参 数:expression ---- 主数据 ' find ---- 被替换的字符 ' replacewith ---- 替换后的字符 '返回值:容错后的替换字符串,如果 replacewith 空字符,被替换的字符 替换成空 '************************************************** Function PE_Replace(ByVal expression, ByVal find, ByVal replacewith) If IsNull(expression) Or IsNull(find) Then PE_Replace = expression ElseIf IsNull(replacewith) Then PE_Replace = Replace(expression, find, "") Else PE_Replace = Replace(expression, find, replacewith) End If End Function '************************************************** '函数名:IsExists '作 用:判断数据库中的数据表的字段是否存在 '参 数:fieldName ---- 字段名称 ' tableName ---- 数据表名称 '返回值:如果改数据表存在改字段,则返回True,否则返回False '************************************************** Function IsExists(fieldName, tableName) On Error Resume Next IsExists = True CONN.execute ("select " & fieldName & " from " & tableName) If Err Then IsExists = False End If Err.Clear End Function '************************************************** '函数名:Refresh '作 用:等待特定时间后跳转到指定的网址 '参 数:url ---- 跳转网址 ' refreshTime ---- 等待跳转时间 '************************************************** Sub Refresh(url,refreshTime) Response.Write "" & vbCrLf Response.Write "" & vbCrLf End Sub %> <% '************************************************************** ' Software name: PowerEasy SiteWeaver ' Web: http://www.powereasy.net ' Copyright (C) 2005-2009 佛山市动易网络科技有限公司 版权所有 '************************************************************** '************************************************** '函数名:PE_CBool '作 用:将字符转为布尔弄变量 '参 数:strBool---- 字符 '返回值:True/False '************************************************** Function PE_CBool(strBool) If strBool = True Or LCase(Trim(strBool)) = "true" Or LCase(Trim(strBool)) = "yes" Or Trim(strBool) = "1" Then PE_CBool = True Else PE_CBool = False End If End Function '************************************************** '函数名:PE_CLng '作 用:将字符转为整型数值 '参 数:str1 ---- 字符 '返回值:如果传入的参数不是数值,返回0,其他情况返回对应的数值 '************************************************** Function PE_CLng(ByVal str1) If IsNumeric(str1) Then PE_CLng = Fix(CDbl(str1)) Else PE_CLng = 0 End If End Function '************************************************** '函数名:PE_CLng1 '作 用:将字符转为整型数值 '参 数:str1 ---- 字符 '返回值:如果传入的参数不是数值,返回1,其他情况返回对应的数值 '************************************************** Function PE_CLng1(ByVal str1) If IsNumeric(str1) Then PE_CLng1 = CLng(str1) If PE_CLng1 <= 0 Then PE_CLng1 = 1 Else PE_CLng1 = 1 End If End Function '************************************************** '函数名:PE_CDbl '作 用:将字符转为双精度数值 '参 数:str1 ---- 字符 '返回值:如果传入的参数不是数值,返回0,其他情况返回对应的数值 '************************************************** Function PE_CDbl(ByVal str1) If IsNumeric(str1) Then PE_CDbl = CDbl(str1) Else PE_CDbl = 0 End If End Function '************************************************** '函数名:PE_CDate '作 用:将字符转为日期 '参 数:str1 ---- 字符 '返回值:如果参数不是日期型字符,则返回当前时间,否则返回对应的日期型数据 '************************************************** Function PE_CDate(ByVal str1) If IsDate(str1) Then PE_CDate = CDate(str1) Else PE_CDate = Now End If End Function '************************************************** '函数名:EncodeIP '作 用:将IP地址转为数字 '参 数:Sip ---- IP地址 '返回值:数字 '************************************************** Function EncodeIP(sip) Dim strIP strIP = Split(sip, ".") If UBound(strIP) < 3 Then EncodeIP = 0 Exit Function End If If IsNumeric(strIP(0)) = False Or IsNumeric(strIP(1)) = False Or IsNumeric(strIP(2)) = False Or IsNumeric(strIP(3)) = False Then sip = 0 Else sip = CSng(strIP(0)) * 256 * 256 * 256 + CLng(strIP(1)) * 256 * 256 + CLng(strIP(2)) * 256 + CLng(strIP(3)) - 1 End If EncodeIP = sip End Function '************************************************** '函数名: '作 用: '参 数: '返回值: '************************************************** '白名单的端点可以访问和黑名单的端点将不允许访问。 Function ChecKIPlock(ByVal sLockType, ByVal sLockList, ByVal sUserIP) Dim IPlock, rsLockIP Dim arrLockIPW, arrLockIPB, arrLockIPWCut, arrLockIPBCut IPlock = False ChecKIPlock = IPlock Dim i, sKillIP If sLockType = "" Or IsNull(sLockType) Then Exit Function If sLockList = "" Or IsNull(sLockList) Then Exit Function If sUserIP = "" Or IsNull(sUserIP) Then Exit Function sUserIP = CDbl(EncodeIP(sUserIP)) rsLockIP = Split(sLockList, "|||") If sLockType = 4 Then arrLockIPB = Split(Trim(rsLockIP(1)), "$$$") For i = 0 To UBound(arrLockIPB) If arrLockIPB(i) <> "" Then arrLockIPBCut = Split(Trim(arrLockIPB(i)), "----") IPlock = True If CDbl(arrLockIPBCut(0)) > sUserIP Or sUserIP > CDbl(arrLockIPBCut(1)) Then IPlock = False If IPlock Then Exit For End If Next If IPlock = True Then arrLockIPW = Split(Trim(rsLockIP(0)), "$$$") For i = 0 To UBound(arrLockIPW) If arrLockIPW(i) <> "" Then arrLockIPWCut = Split(Trim(arrLockIPW(i)), "----") IPlock = True If CDbl(arrLockIPWCut(0)) <= sUserIP And sUserIP <= CDbl(arrLockIPWCut(1)) Then IPlock = False If IPlock Then Exit For End If Next End If Else If sLockType = 1 Or sLockType = 3 Then arrLockIPW = Split(Trim(rsLockIP(0)), "$$$") For i = 0 To UBound(arrLockIPW) If arrLockIPW(i) <> "" Then arrLockIPWCut = Split(Trim(arrLockIPW(i)), "----") IPlock = True If CDbl(arrLockIPWCut(0)) <= sUserIP And sUserIP <= CDbl(arrLockIPWCut(1)) Then IPlock = False If IPlock = False Then Exit For End If Next End If If IPlock = False And (sLockType = 2 Or sLockType = 3) Then arrLockIPB = Split(Trim(rsLockIP(1)), "$$$") For i = 0 To UBound(arrLockIPB) If arrLockIPB(i) <> "" Then arrLockIPBCut = Split(Trim(arrLockIPB(i)), "----") IPlock = True If CDbl(arrLockIPBCut(0)) > sUserIP Or sUserIP > CDbl(arrLockIPBCut(1)) Then IPlock = False If IPlock Then Exit For End If Next End If End If ChecKIPlock = IPlock End Function '************************************************** '函数名:IsValidEmail '作 用:检查Email地址合法性 '参 数:email ----要检查的Email地址 '返回值:True ----Email地址合法 ' False ----Email地址不合法 '************************************************** Function IsValidEmail(Email) regEx.Pattern = "^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$" IsValidEmail = regEx.Test(Email) End Function '************************************************** '函数名:IsValidStr '作 用:检查字符是否在有效范围内 '参 数:str ----要检查的字符 '返回值:True ----字符合法 ' False ----字符不合法 '************************************************** Function IsValidStr(ByVal str) Dim i, c For i = 1 To Len(str) c = LCase(Mid(str, i, 1)) If InStr("abcdefghijklmnopqrstuvwxyz1234567890", c) <= 0 Then IsValidStr = False Exit Function End If Next If IsNumeric(Left(str, 1)) Then IsValidStr = False Else IsValidStr = True End If End Function '************************************************** '函数名:IsValidJsFileName '作 用:检查是否是有效的JS文件名 '参 数:str ----要检查的字符 '返回值:True ----文件名合法 ' False ----文件名不合法 '************************************************** Function IsValidJsFileName(ByVal str, ByVal ContentType) Dim i, c For i = 1 To Len(str) c = LCase(Mid(str, i, 1)) If InStr("abcdefghijklmnopqrstuvwxyz_1234567890.", c) <= 0 Then IsValidJsFileName = False Exit Function End If Next If ContentType = 0 Then If LCase(Right(str, 3)) <> ".js" Then IsValidJsFileName = False Else IsValidJsFileName = True End If Else If LCase(Right(str, 5)) <> ".html" Then IsValidJsFileName = False Else IsValidJsFileName = True End If End If End Function '************************************************** '函数名:ReplaceBadChar '作 用:过滤非法的SQL字符 '参 数:strChar-----要过滤的字符 '返回值:过滤后的字符 '************************************************** 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 '************************************************** '函数名:ReplaceLabelBadChar '作 用:函数标签过滤非法的SQL字符 '参 数:strChar-----要过滤的字符 '返回值:过滤后的字符 '************************************************** Function ReplaceLabelBadChar(strChar) If strChar = "" Or IsNull(strChar) Then ReplaceLabelBadChar = "" 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, "@@", "@") Dim oldString oldString = "" Do While oldString <> tempChar oldString = tempChar regEx.Pattern = "(select|union|update|insert|delete|exec|from|pe_admin|--)?" tempChar = regEx.Replace(tempChar, "") Loop ReplaceLabelBadChar = tempChar End Function '************************************************** '函数名:ReplaceUrlBadChar '作 用:过滤Url中非法的SQL字符 '参 数:strChar-----要过滤的字符 '返回值:过滤后的字符 '************************************************** Function ReplaceUrlBadChar(strChar) If strChar = "" Or IsNull(strChar) Then ReplaceUrlBadChar = "" 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, "@@", "@") ReplaceUrlBadChar = tempChar End Function '================================================= '函数名:ReplaceBadUrl '作 用:过滤非法Url地址函数 '================================================= Function ReplaceBadUrl(ByVal strContent) regEx.Pattern = "(a|%61|%41)(d|%64|%44)(m|%6D|4D)(i|%69|%49)(n|%6E|%4E)(\_|%5F)(.*?)(.|%2E)(a|%61|%41)(s|%73|%53)(p|%70|%50)" Set Matches = regEx.Execute(strContent) For Each Match In Matches strContent = Replace(strContent, Match.value, "") Next regEx.Pattern = "(u|%75|%55)(s|%73|%53)(e|%65|%45)(r|%72|%52)(\_|%5F)(.*?)(.|%2E)(a|%61|%41)(s|%73|%53)(p|%70|%50)" Set Matches = regEx.Execute(strContent) For Each Match In Matches strContent = Replace(strContent, Match.value, "") Next ReplaceBadUrl = strContent End Function '************************************************** '函数名:CheckBadChar '作 用:检查是否包含非法的SQL字符 '参 数:strChar-----要检查的字符 '返回值:True ----字符合法 ' False ----字符不合法 '************************************************** Function CheckBadChar(strChar) Dim strBadChar, arrBadChar, i strBadChar = "@@,+,',%,^,&,?,(,),<,>,[,],{,},/,\,;,:," & Chr(34) & ",--,union,select,insert,delete,from,pe_admin" arrBadChar = Split(strBadChar, ",") If strChar = "" Then CheckBadChar = False Else Dim tempChar tempChar = LCase(strChar) For i = 0 To UBound(arrBadChar) If InStr(tempChar, arrBadChar(i)) > 0 Then CheckBadChar = False Exit Function End If Next End If CheckBadChar = True End Function Function CheckUserBadChar(strChar) Dim strBadChar, arrBadChar, i strBadChar = "',%,^,&,?,(,),<,>,[,],{,},/,\,;,:," & Chr(34) & ",*,|,"",.,#,union,select,insert,delete,from,pe_admin" arrBadChar = Split(strBadChar, ",") If strChar = "" Then CheckUserBadChar = False Else Dim tempChar tempChar = LCase(strChar) For i = 0 To UBound(arrBadChar) If InStr(tempChar, arrBadChar(i)) > 0 Then CheckUserBadChar = False Exit Function End If Next End If CheckUserBadChar = True End Function '************************************************** '函数名:CheckValidStr '作 用:检查数组中有无相同的字符 '参 数:arrInvalidStr ----要查询的数组 ' str1 ---- 要比较的字符 '返回值:True ----是否存在 '************************************************** Function CheckValidStr(arrInvalidStr, str1) Dim arrStr, i If InStr(arrInvalidStr, ",") > 0 Then arrStr = Split(arrInvalidStr, ",") For i = 0 To UBound(arrStr) If LCase(Trim(arrStr(i))) = LCase(Trim(str1)) Then CheckValidStr = False Exit Function End If Next Else If LCase(Trim(arrInvalidStr)) = LCase(Trim(str1)) Then CheckValidStr = False Exit Function End If End If CheckValidStr = True End Function '************************************************** '函数名:IsValidID '作 用:检查传过来的ID是否是合法ID或者ID串 '参 数:Check_ID ---- ID 字符串 '返回值:True ---- 合法ID '************************************************** Function IsValidID(Check_ID) Dim FixID, i If IsNull(Check_ID) Or Check_ID = "" Then IsValidID = False Exit Function End If FixID = Replace(Check_ID, "|", "") FixID = Replace(FixID, ",", "") FixID = Replace(FixID, "-", "") FixID = Trim(Replace(FixID, " ", "")) If FixID = "" Or IsNull(FixID) Then IsValidID = False Else For i = 1 To Len(FixID) Step 100 If Not IsNumeric(Mid(FixID, i, 100)) Then IsValidID = False Exit Function End If Next IsValidID = True End If End Function '************************************************** '函数名:PE_ConvertBR '作 用:将文本区域内的
替换换行 '参 数:fString ---- 要处理的字符串 '返回值:处理后的字符串 '************************************************** Function PE_ConvertBR(ByVal fString) If IsNull(fString) Or Trim(fString) = "" Then PE_ConvertBR = "" Exit Function End If fString = Replace(fString, "

", Chr(10) & Chr(10)) fString = Replace(fString, "
", Chr(10)) fString = Replace(fString, "
", Chr(10)) PE_ConvertBR = fString End Function '************************************************** '函数名:PE_HTMLEncode '作 用:将html 标记替换成 能在IE显示的HTML '参 数:fString ---- 要处理的字符串 '返回值:处理后的字符串 '************************************************** Function PE_HTMLEncode(ByVal fString) If IsNull(fString) Or Trim(fString) = "" Then PE_HTMLEncode = "" Exit Function End If fString = Replace(fString, ">", ">") fString = Replace(fString, "<", "<") fString = Replace(fString, Chr(32), " ") fString = Replace(fString, Chr(9), " ") fString = Replace(fString, Chr(34), """) fString = Replace(fString, Chr(39), "'") fString = Replace(fString, Chr(13), "") fString = Replace(fString, Chr(10) & Chr(10), "

") fString = Replace(fString, Chr(10), "
") PE_HTMLEncode = fString End Function '************************************************** '函数名:PE_HtmlDecode '作 用:还原Html标记,配合PE_HTMLEncode 使用 '参 数:fString ---- 要处理的字符串 '返回值:处理后的字符串 '************************************************** Function PE_HtmlDecode(ByVal fString) If IsNull(fString) Or Trim(fString) = "" Then PE_HtmlDecode = "" Exit Function End If fString = Replace(fString, ">", ">") fString = Replace(fString, "<", "<") fString = Replace(fString, " ", " ") fString = Replace(fString, """, Chr(34)) fString = Replace(fString, "'", Chr(39)) fString = Replace(fString, "

", Chr(10) & Chr(10)) fString = Replace(fString, "
", Chr(10)) PE_HtmlDecode = fString End Function '************************************************** '函数名:nohtml '作 用:过滤html 元素 '参 数:str ---- 要过滤字符 '返回值:没有html 的字符 '************************************************** Function nohtml(ByVal str) If IsNull(str) Or Trim(str) = "" Then nohtml = "" Exit Function End If regEx.Pattern = "(\<.[^\<]*\>)" str = regEx.Replace(str, "") regEx.Pattern = "(\<\/[^\<]*\>)" str = regEx.Replace(str, "") regEx.Pattern = "\[NextPage(.*?)\]" '解决“当在文章模块的频道中发布的是图片并使用分页标签[NextPage]或内容开始的前几行就使用分页标签时,一旦使用搜索来搜索该文时,搜索页就会显示分页标签”的问题 str = regEx.Replace(str, "") str = Replace(str, "'", "") str = Replace(str, Chr(34), "") str = Replace(str, vbCrLf, "") str = Trim(str) nohtml = str End Function '************************************************** '函数名:xml_nohtml '作 用:过滤xml 和 html 元素 '参 数:str ---- 要过滤字符 '返回值:没有 xml 和 html 的字符串 '************************************************** Function xml_nohtml(ByVal fString) If IsNull(fString) Or Trim(fString) = "" Then xml_nohtml = "" Exit Function End If Dim str, k str = Replace(fString, ">", ">") str = Replace(str, "<", "<") str = Replace(str, " ", "") str = Replace(str, """, "") str = Replace(str, "'", "") str = nohtml(str) str = Replace(Replace(str, "", "") xml_nohtml = str End Function '************************************************** '函数名:unicode '作 用:转换为 UTF8 编码 '参 数:str ---- 要转换的字符 '返回值:转换后的字符 '************************************************** Function unicode(ByVal str) Dim i, j, c, i1, i2, u, fs, f, p unicode = "" p = "" For i = 1 To Len(str) c = Mid(str, i, 1) j = AscW(c) If j < 0 Then j = j + 65536 End If If j >= 0 And j <= 128 Then If p = "c" Then unicode = " " & unicode p = "e" End If unicode = unicode & c Else If p = "e" Then unicode = unicode & " " p = "c" End If unicode = unicode & ("&#" & j & ";") End If Next End Function '************************************************** '函数名:Jencode '作 用:替换那26个片假名字符(效率很差目前没有用到) '参 数:str ---- 要替换的字符 ' DatabaseType ---- 数据库类型 '返回值:替换后的字符 '************************************************** Function Jencode(ByVal iStr, DatabaseType) If IsNull(iStr) Or IsEmpty(iStr) Or iStr = "" Or DatabaseType = "SQL" Then Jencode = "" Exit Function End If Dim E, f, i E = Array("Jn0;", "Jn1;", "Jn2;", "Jn3;", "Jn4;", "Jn5;", "Jn6;", "Jn7;", "Jn8;", "Jn9;", "Jn10;", "Jn11;", "Jn12;", "Jn13;", "Jn14;", "Jn15;", "Jn16;", "Jn17;", "Jn18;", "Jn19;", "Jn20;", "Jn21;", "Jn22;", "Jn23;", "Jn24;", "Jn25;") f = Array(Chr(-23116), Chr(-23124), Chr(-23122), Chr(-23120), Chr(-23118), Chr(-23114), Chr(-23112), Chr(-23110), Chr(-23099), Chr(-23097), Chr(-23095), Chr(-23075), Chr(-23079), Chr(-23081), Chr(-23085), Chr(-23087), Chr(-23052), Chr(-23076), Chr(-23078), Chr(-23082), Chr(-23084), Chr(-23088), Chr(-23102), Chr(-23104), Chr(-23106), Chr(-23108)) Jencode = iStr For i = 0 To 25 Jencode = Replace(Jencode, f(i), E(i)) Next End Function Function Juncode(ByVal iStr, DatabaseType) If IsNull(iStr) Or IsEmpty(iStr) Or iStr = "" Or DatabaseType = "SQL" Then Juncode = "" Exit Function End If Dim E, f, i E = Array("Jn0;", "Jn1;", "Jn2;", "Jn3;", "Jn4;", "Jn5;", "Jn6;", "Jn7;", "Jn8;", "Jn9;", "Jn10;", "Jn11;", "Jn12;", "Jn13;", "Jn14;", "Jn15;", "Jn16;", "Jn17;", "Jn18;", "Jn19;", "Jn20;", "Jn21;", "Jn22;", "Jn23;", "Jn24;", "Jn25;") f = Array(Chr(-23116), Chr(-23124), Chr(-23122), Chr(-23120), Chr(-23118), Chr(-23114), Chr(-23112), Chr(-23110), Chr(-23099), Chr(-23097), Chr(-23095), Chr(-23075), Chr(-23079), Chr(-23081), Chr(-23085), Chr(-23087), Chr(-23052), Chr(-23076), Chr(-23078), Chr(-23082), Chr(-23084), Chr(-23088), Chr(-23102), Chr(-23104), Chr(-23106), Chr(-23108)) Juncode = iStr For i = 0 To 25 Juncode = Replace(Juncode, E(i), f(i)) Next End Function Function IsValidPhone(Phone) Dim i, c IsValidPhone = True For i = 1 To Len(Phone) c = LCase(Mid(Phone, i, 1)) If InStr("-()", c) <= 0 And Not IsNumeric(c) Then IsValidPhone = False Exit Function End If Next End Function '************************************************** '函数名:DelRightComma '作 用:删除字符串(如:"1,3,5,8")右侧多余的逗号以消除SQL查询时出错的问题,Comma:逗号。 '参 数:str ---- 待处理的字符串 '************************************************** Function DelRightComma(ByVal str) str = Trim(str) If Right(str, 1) = "," Then str = Left(str, Len(str) - 1) End If DelRightComma = str End Function '************************************************** '函数名:FilterArrNull '作 用:过滤数组空字符 '************************************************** Function FilterArrNull(ByVal ArrString, ByVal CompartString) Dim arrContent, arrTemp, i If CompartString = "" Or ArrString = "" Then FilterArrNull = ArrString Exit Function End If If InStr(ArrString, CompartString) = 0 Then FilterArrNull = ArrString Exit Function Else arrContent = Split(ArrString, CompartString) For i = 0 To UBound(arrContent) If Trim(arrContent(i)) <> "" Then If arrTemp = "" Then arrTemp = Trim(arrContent(i)) Else arrTemp = arrTemp & CompartString & Trim(arrContent(i)) End If End If Next End If FilterArrNull = arrTemp End Function '================================================= '函数名:FilterJS() '作 用:过滤非法JS字符 '参 数:strInput 需要过滤的内容 '================================================= Function FilterJS(ByVal strInput) If IsNull(strInput) Or Trim(strInput) = "" Then FilterJS = "" Exit Function End If Dim reContent ' 替换掉HTML字符实体(Character Entities)名字和分号之间的空白字符,比如:ä ;替换成ä regEx.Pattern = "(&#*\w+)[\x00-\x20]+;" strInput = regEx.Replace(strInput, "$1;") ' 将无分号结束符的数字编码实体规范成带分号的标准形式 regEx.Pattern = "(&#x*[0-9A-F]+);*" strInput = regEx.Replace(strInput, "$1;") ' 将  < > & "字符实体中的 & 替换成 & 以便在进行HtmlDecode时保留这些字符实体 'RegEx.Pattern = "&(amp|lt|gt|nbsp|quot);" 'strInput = RegEx.Replace(strInput, "&$1;") ' 将HTML字符实体进行解码,以消除编码字符对后续过滤的影响 'strInput = HtmlDecode(strInput); ' 将ASCII码表中前32个字符中的非打印字符替换成空字符串,保留 9、10、13、32,它们分别代表 制表符、换行符、回车符和空格。 regEx.Pattern = "[\x00-\x08\x0b-\x0c\x0e-\x19]" strInput = regEx.Replace(strInput, "") oldhtmlString = "" Do While oldhtmlString <> strInput oldhtmlString = strInput regEx.Pattern = "(<[^>]+src[\x00-\x20]*=[\x00-\x20]*[^>]*?)&#([^>]*>)" '过虑掉 src 里的 &# strInput = regEx.Replace(strInput, "$1&#$2") regEx.Pattern = "(<[^>]+style[\x00-\x20]*=[\x00-\x20]*[^>]*?)&#([^>]*>)" '过虑掉style 里的 &# strInput = regEx.Replace(strInput, "$1&#$2") regEx.Pattern = "(<[^>]+style[\x00-\x20]*=[\x00-\x20]*[^>]*?)\\([^>]*>)" '替换掉style中的 "\" strInput = regEx.Replace(strInput, "$1/$2") Loop ' 替换以on和xmlns开头的属性,动易系统的几个JS需要保留 regEx.Pattern = "on(load\s*=\s*""*'*resizepic\(this\)'*""*)" strInput = regEx.Replace(strInput, "off$1") regEx.Pattern = "on(mousewheel\s*=\s*""*'*return\s*bbimg\(this\)'*""*)" strInput = regEx.Replace(strInput, "off$1") regEx.Pattern = "(<[^>]+[\x00-\x20""'/])(on|xmlns)([^>]*)>" strInput = regEx.Replace(strInput, "$1pe$3>") regEx.Pattern = "off(load\s*=\s*""*'*resizepic\(this\)'*""*)" strInput = regEx.Replace(strInput, "on$1") regEx.Pattern = "off(mousewheel\s*=\s*""*'*return\s*bbimg\(this\)'*""*)" strInput = regEx.Replace(strInput, "on$1") ' 替换javascript regEx.Pattern = "([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`'""]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:" strInput = regEx.Replace(strInput, "$1=$2nojavascript...") ' 替换vbscript regEx.Pattern = "([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`'""]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:" strInput = regEx.Replace(strInput, "$1=$2novbscript...") '替换style中的注释部分,比如:

regEx.Pattern = "(<[^>]+style[\x00-\x20]*=[\x00-\x20]*[^>]*?)/\*[^>]*\*/([^>]*>)" strInput = regEx.Replace(strInput, "$1$2") ' 替换expression regEx.Pattern = "(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([`'""]*).*[eeE][xxX][ppP][rrR][eeE][ssS][ssS][iiI][ooO][nnN][\x00-\x20]*[\(\(][^>]*>" strInput = regEx.Replace(strInput, "$1>") ' 替换behaviour regEx.Pattern = "(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([`'""]*).*behaviour[^>]*>>" strInput = regEx.Replace(strInput, "$1>") ' 替换behavior regEx.Pattern = "(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([`'""]*).*behavior[^>]*>>" strInput = regEx.Replace(strInput, "$1>") ' 替换script regEx.Pattern = "(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([`'""]*).*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*>" strInput = regEx.Replace(strInput, "$1>") ' 替换namespaced elements 不需要 regEx.Pattern = "]*>" strInput = regEx.Replace(strInput, " ") Dim oldhtmlString oldhtmlString = "" Do While oldhtmlString <> strInput oldhtmlString = strInput '实行严格过滤 regEx.Pattern = "]*>?" strInput = regEx.Replace(strInput, " ") '过滤掉SHTML的Include包含文件漏洞 regEx.Pattern = "", "}") regEx.Pattern = "\{\$InstallDir\}(?!\{\$ChannelDir\})" strHtml = regEx.Replace(strHtml, strInstallDir) strHtml = PE_Replace(strHtml, "{$ADDir}", ADDir) strHtml = PE_Replace(strHtml, "{$SiteUrl}", SiteUrl) strHtml = PE_Replace(strHtml, "{$SiteName}", SiteName) strHtml = PE_Replace(strHtml, "{$WebmasterEmail}", WebmasterEmail) strHtml = PE_Replace(strHtml, "{$WebmasterName}", WebmasterName) strHtml = PE_Replace(strHtml, "{$Copyright}", Copyright) strHtml = PE_Replace(strHtml, "{$Meta_Keywords}", Meta_Keywords) strHtml = PE_Replace(strHtml, "{$Meta_Description}", Meta_Description) strHtml = Replace(strHtml, "{$ShowAD}", "") If InStr(strHtml, "{$ShowLogo}") > 0 Then strHtml = Replace(strHtml, "{$ShowLogo}", GetLogo(180, 60)) If InStr(strHtml, "{$ShowBanner}") > 0 Then strHtml = Replace(strHtml, "{$ShowBanner}", GetBanner(480, 60)) If InStr(strHtml, "{$ShowSiteCountAll}") > 0 Then strHtml = Replace(strHtml, "{$ShowSiteCountAll}", GetSiteCountAll()) If InStr(strHtml, "{$ShowChannel}") > 0 Then strHtml = Replace(strHtml, "{$ShowChannel}", GetChannelList(0)) If InStr(strHtml, "{$GetUserName}") > 0 Then strHtml = Replace(strHtml, "{$GetUserName}", GetUserName()) If InStr(strHtml, "{$AdminDir}") > 0 Then strHtml = Replace(strHtml, "{$AdminDir}", AdminDir) If InStr(strHtml, "{$ShowVoteJS_Comment}") > 0 Then strHtml = Replace(strHtml, "{$ShowVoteJS_Comment}", ShowVoteJS_Comment()) If ShowAdminLogin = True Then strHtml = Replace(strHtml, "{$ShowAdminLogin}", " " & XmlText("Site", "ReplaceCommon/AdminLogin", "管理登录") & " " & XmlText("Site", "ReplaceCommon/a2", "|") & " ") Else strHtml = Replace(strHtml, "{$ShowAdminLogin}", "") End If '替换{$YN(Condition,Fir,Sec)}标签 Dim strYN regEx.Pattern = "\{\$YN\((.*?)\)\}[^\]]" Set Matches = regEx.Execute(strHtml) For Each Match In Matches Dim TempNum1 IsEnd = True TempNum1 = 0 arrTemp = Split(Match.SubMatches(0), ",") ReDim arrTem(CInt(UBound(arrTemp))) For i = 0 To UBound(arrTemp) If InStr(arrTemp(i), "[") > 0 Then IsEnd = False arrTemp(i) = Replace(arrTemp(i), "[", "") End If If InStr(arrTemp(i), "]") > 0 Then IsEnd = True arrTemp(i) = Replace(arrTemp(i), "]", "") End If If IsEnd = False Then arrTem(TempNum1) = arrTem(TempNum1) & arrTemp(i) & "," End If If IsEnd = True Then arrTem(TempNum1) = arrTem(TempNum1) & arrTemp(i) tempSql = Replace(tempSql, "{input(" & TempNum1 & ")}", arrTem(TempNum1)) TempNum1 = TempNum1 + 1 End If Next If TempNum1 <> 3 Then strYN = "函数式标签:{$YN(参数列表)}的参数个数不对。请检查模板中的此标签。" Else strYN = YN(arrTem(0),arrTem(1),arrTem(2)) End If strHtml = Replace(strHtml, Left(Match.value,len(Match.value)-1), strYN) Next '替换{$GetLanguage(BigNode,SmallNode,DefChar)}标签 Dim strLanguage regEx.Pattern = "\{\$GetLanguage\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) <> 2 Then strLanguage = "函数式标签:{$GetLanguage(参数列表)}的参数个数不对。请检查模板中的此标签。" Else strLanguage = XmlText(arrTemp(0), arrTemp(1), arrTemp(2)) End If strHtml = Replace(strHtml, Match.Value, strLanguage) Next Dim strSlidePicJs regEx.Pattern = "\{\$SlidePicJs\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) <> 9 and UBound(arrTemp)<>10 Then strSlidePicJs = "函数式标签:{$SlidePicJs(参数列表)}的参数个数不对。请检查模板中的此标签。" Elseif UBound(arrTemp) = 9 then strSlidePicJs = SlidePicJs(PE_Clng(arrTemp(0)),PE_CLng(arrTemp(1)),PE_CLng(arrTemp(2)),PE_CLng(arrTemp(3)),PE_CLng(arrTemp(4)),arrTemp(5),0,PE_CLng(arrTemp(6)),PE_CLng(arrTemp(7)),PE_CLng(arrTemp(8)),PE_CLng(arrTemp(9))) Else strSlidePicJs = SlidePicJs(PE_Clng(arrTemp(0)),PE_CLng(arrTemp(1)),PE_CLng(arrTemp(2)),PE_CLng(arrTemp(3)),PE_CLng(arrTemp(4)),arrTemp(5),arrTemp(6),PE_CLng(arrTemp(7)),PE_CLng(arrTemp(8)),PE_CLng(arrTemp(9)),PE_CLng(arrTemp(10))) End If strHtml = Replace(strHtml, Match.value, strSlidePicJs) Next Dim strIsLogin regEx.Pattern = "\{\$IsLogin\(([\s\S]*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) <> 1 Then strIsLogin = "函数式标签:{$IsLogin(参数列表)}的参数个数不对。请检查模板中的此标签。" Else strIsLogin = IsLogin(arrTemp(0),arrTemp(1)) End If strHtml = Replace(strHtml, Match.value, strIsLogin) Next '替换频道导航 regEx.Pattern = "\{\$ShowChannel\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") strChannel = GetChannelList(PE_CLng(arrTemp(0))) strHtml = Replace(strHtml, Match.Value, strChannel) Next '替换Logo regEx.Pattern = "\{\$ShowLogo\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) <> 1 Then strLogo = "函数式标签:{$ShowLogo(参数列表)}的参数个数不对。请检查模板中的此标签。" Else strLogo = GetLogo(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1))) End If strHtml = Replace(strHtml, Match.Value, strLogo) Next '替换banner regEx.Pattern = "\{\$ShowBanner\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) <> 1 Then strBanner = "函数式标签:{$ShowBanner(参数列表)}的参数个数不对。请检查模板中的此标签。" Else strBanner = GetBanner(arrTemp(0), arrTemp(1)) End If strHtml = Replace(strHtml, Match.Value, strBanner) Next '替换广告 regEx.Pattern = "\{\$ShowAD\((.*?)\)\}" strHtml = regEx.Replace(strHtml, "") '替换指定ID广告 regEx.Pattern = "\{\$GetAD\((.*?)\)\}" strHtml = regEx.Replace(strHtml, "") '替换调查 If InStr(strHtml, "{$ShowVote}") > 0 Then strHtml = Replace(strHtml, "{$ShowVote}", GetVote()) '替换用户排行 regEx.Pattern = "\{\$ShowTopUser\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") Select Case UBound(arrTemp) Case 0 strTopUser = GetTopUser(PE_CLng(arrTemp(0)), 1, True, True, False, False, "more...", 1) Case 6 strTopUser = GetTopUser(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CBool(arrTemp(2)), PE_CBool(arrTemp(3)), PE_CBool(arrTemp(4)), PE_CBool(arrTemp(5)), arrTemp(6), 1) Case 7 strTopUser = GetTopUser(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CBool(arrTemp(2)), PE_CBool(arrTemp(3)), PE_CBool(arrTemp(4)), PE_CBool(arrTemp(5)), arrTemp(6), arrTemp(7)) Case Else strTopUser = "标签{$ShowTopUser(参数列表)}的参数个数不对" End Select strHtml = Replace(strHtml, Match.Value, strTopUser) Next '替换聚合列表 regEx.Pattern = "\{\$ShowSpaceList\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) < 8 Then strAuthorList = "函数式标签:{$ShowSpaceList(参数列表)}的参数个数不对。请检查模板中的此标签。" Else strAuthorList = GetBlogList(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CLng(arrTemp(2)), PE_CBool(arrTemp(3)), PE_CBool(arrTemp(4)), PE_CLng(arrTemp(5)), PE_CLng(arrTemp(6)), PE_CLng(arrTemp(7)), PE_CLng(arrTemp(8)), arrTemp(9), PE_CLng(arrTemp(10))) End If strHtml = Replace(strHtml, Match.Value, strAuthorList) Next '替换作者列表 regEx.Pattern = "\{\$ShowAuthorList\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) < 8 Then strAuthorList = "函数式标签:{$ShowAuthorList(参数列表)}的参数个数不对。请检查模板中的此标签。" Else If UBound(arrTemp) = 8 Then strAuthorList = GetAuthorList(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CLng(arrTemp(2)), PE_CLng(arrTemp(3)), PE_CLng(arrTemp(4)), PE_CLng(arrTemp(5)), PE_CLng(arrTemp(6)), PE_CLng(arrTemp(7)), arrTemp(8), 1) Else strAuthorList = GetAuthorList(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CLng(arrTemp(2)), PE_CLng(arrTemp(3)), PE_CLng(arrTemp(4)), PE_CLng(arrTemp(5)), PE_CLng(arrTemp(6)), PE_CLng(arrTemp(7)), arrTemp(8), PE_CLng(arrTemp(9))) End If End If strHtml = Replace(strHtml, Match.Value, strAuthorList) Next '替换厂商列表 regEx.Pattern = "\{\$ShowProducerList\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) < 9 Then strProducerList = "函数式标签:{$ShowProducerList(参数列表)}的参数个数不对。请检查模板中的此标签。" Else strProducerList = GetProducerList(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CLng(arrTemp(2)), PE_CLng(arrTemp(3)), PE_CLng(arrTemp(4)), PE_CLng(arrTemp(5)), PE_CLng(arrTemp(6)), PE_CLng(arrTemp(7)), arrTemp(8), PE_CLng(arrTemp(9))) End If strHtml = Replace(strHtml, Match.Value, strProducerList) Next '替换友情链接 regEx.Pattern = "\{\$ShowFriendSite\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) < 3 Then strFriendSite = "函数式标签:{$ShowFriendSite(参数列表)}的参数个数不对。请检查模板中的此标签。" Else If UBound(arrTemp) = 5 Then strFriendSite = ShowFriendSite(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CLng(arrTemp(2)), PE_CLng(arrTemp(3)), arrTemp(4), arrTemp(5), 88, False, True, 0) ElseIf UBound(arrTemp) = 6 Then strFriendSite = ShowFriendSite(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CLng(arrTemp(2)), PE_CLng(arrTemp(3)), arrTemp(4), arrTemp(5), PE_CLng(arrTemp(6)), False, True, 0) ElseIf UBound(arrTemp) = 9 Then strFriendSite = ShowFriendSite(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CLng(arrTemp(2)), PE_CLng(arrTemp(3)), arrTemp(4), arrTemp(5), PE_CLng(arrTemp(6)), PE_CBool(arrTemp(7)), PE_CBool(arrTemp(8)), PE_CLng(arrTemp(9))) Else strFriendSite = ShowFriendSite(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CLng(arrTemp(2)), PE_CLng(arrTemp(3)), 0, 0, 88, False, True, 0) End If End If strHtml = Replace(strHtml, Match.Value, strFriendSite) Next '替换公告 regEx.Pattern = "\{\$ShowAnnounce\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) < 1 Then strAnnounce = "函数式标签:{$ShowAnnounce(参数列表)}的参数个数不对。请检查模板中的此标签。" Else Select Case UBound(arrTemp) Case 1 strAnnounce = ShowAnnounce(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), True, True, 100) Case 3 strAnnounce = ShowAnnounce(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CBool(arrTemp(2)), PE_CBool(arrTemp(3)), 100) Case 4 strAnnounce = ShowAnnounce(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CBool(arrTemp(2)), PE_CBool(arrTemp(3)), PE_CLng(arrTemp(4))) Case Else strAnnounce = ShowAnnounce(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), True, True, 100) End Select End If strHtml = Replace(strHtml, Match.Value, strAnnounce) Next '替换指定专题列表 Dim strSpecial, arrTemp2 regEx.Pattern = "\{\$ShowSpecialList\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp2 = Split(Match.SubMatches(0), ",") If UBound(arrTemp2) + 1 <> 6 Then strSpecial = "函数式标签:{$ShowSpecialList(参数列表)}的参数个数不对。请检查模板中的此标签。" Else strSpecial = ShowSpecialList(PE_CLng(arrTemp2(0)), PE_CBool(arrTemp2(1)), PE_CLng(arrTemp2(2)), PE_CLng(arrTemp2(3)), PE_CLng(arrTemp2(4)), PE_CLng(arrTemp2(5))) End If strHtml = Replace(strHtml, Match.Value, strSpecial) Next '替换弹出式公告 regEx.Pattern = "\{\$PopAnnouceWindow\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) <> 1 Then strPopAnnouce = "函数式标签:{$PopAnnouceWindow(参数列表)}的参数个数不对。请检查模板中的此标签。" Else strPopAnnouce = PopAnnouceWindow(arrTemp(0), arrTemp(1)) End If strHtml = Replace(strHtml, Match.Value, strPopAnnouce) Next If ChannelID > 0 Then strHtml = PE_Replace(strHtml, "{$InstallDir}{$ChannelDir}", ChannelUrl) strHtml = PE_Replace(strHtml, "{$ChannelID}", ChannelID) strHtml = PE_Replace(strHtml, "{$ChannelDir}", ChannelDir) strHtml = PE_Replace(strHtml, "{$ChannelUrl}", ChannelUrl) strHtml = PE_Replace(strHtml, "{$ChannelName}", ChannelName) strHtml = PE_Replace(strHtml, "{$ChannelShortName}", ChannelShortName) strHtml = PE_Replace(strHtml, "{$UploadDir}", UploadDir) strHtml = PE_Replace(strHtml, "{$ChannelPicUrl}", ChannelPicUrl) strHtml = PE_Replace(strHtml, "{$Meta_Keywords_Channel}", Meta_Keywords_Channel) strHtml = PE_Replace(strHtml, "{$Meta_Description_Channel}", Meta_Description_Channel) '自设内容 strHtml = CustomContent("Channel", Custom_Content_Channel, strHtml) End If If strInstallDir<>"/" Then strHtml = PE_Replace(strHtml, strInstallDir & strInstallDir, strInstallDir)'兼容自动填充{$InstallDir}出现地址错误以及兼容频道变子站时标签内置方法获取标签路径写法 If InStr(strHtml, "{$MenuJS}") > 0 Then strHtml = PE_Replace(strHtml, "{$MenuJS}", GetMenuJS(ChannelDir, ShowClassTreeGuide)) If InStr(strHtml, "{$Skin_CSS}") > 0 Then strHtml = PE_Replace(strHtml, "{$Skin_CSS}", GetSkin_CSS(SkinID)) '替换底部栏目导航标签 Dim strNavigation regEx.Pattern = "\{\$ShowClassNavigation\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) <> 2 Then strNavigation = "函数式标签:{$ShowClassNavigation(参数列表)}的参数个数不对。请检查模板中的此标签。" Else strNavigation = GetClass_Navigation(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CLng(arrTemp(2))) End If strHtml = Replace(strHtml, Match.Value, strNavigation) Next Dim strBroClass regEx.Pattern = "\{\$GetBrotherClass\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp = Split(Match.SubMatches(0), ",") If UBound(arrTemp) <> 4 Then strBroClass = "函数式标签:{$GetBrotherClass(参数列表)}的参数个数不对。请检查模板中的此标签。" Else strBroClass = GetBrotherClass(PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)), PE_CLng(arrTemp(2)), PE_CLng(arrTemp(3)), PE_CLng(arrTemp(4))) End If strHtml = Replace(strHtml, Match.Value, strBroClass) Next Dim strChildClass regEx.Pattern = "\{\$ShowChildClass\((.*?)\)\}" Set Matches = regEx.Execute(strHtml) For Each Match In Matches arrTemp2 = Split(Match.SubMatches(0), ",") '此处判断为兼容旧版本标签GetChildClass(1, 0) '函数名:GetChildClass '参 数:ShowType--------显示方式,1为竖向列表,2为横向列表 ' Cols ----- 每行显示多少个栏目,竖向列表时无效 If UBound(arrTemp2) + 1 = 2 Then Select Case PE_CLng(arrTemp2(0)) Case 1 strChildClass = GetChildClass(0, 0, 3, 3, 0, True) Case 2 strChildClass = GetChildClass(0, 0, 3, 3, PE_CLng(arrTemp2(1)), True) Case Else strChildClass = GetChildClass(0, 0, 3, 3, 0, True) End Select ElseIf UBound(arrTemp2) + 1 = 6 Then Select Case LCase(arrTemp2(0)) Case "classid" strTemp = ClassID Case "parentid" strTemp = ParentID Case Else strTemp = PE_CLng(LCase(arrTemp2(0))) End Select strChildClass = GetChildClass(strTemp, PE_CLng(arrTemp2(1)), PE_CLng(arrTemp2(2)), PE_CLng(arrTemp2(3)), PE_CLng(arrTemp2(4)), PE_CBool(arrTemp2(5))) Else strChildClass = "函数式标签:{$ShowChildClass(参数列表)}的参数个数不对。请检查模板中的此标签。" End If strHtml = Replace(strHtml, Match.Value, strChildClass) Next End Sub '================================================= '函数名:ShowSpecialList '作 用:显示指定频道专题 '参 数: '1 ChannelID ---- 频道ID,0为全站专题,-1为所有频道专题 '2 IsElite ---- 是否是推荐专题,True为只显示推荐专题,False为显示所有专题 '3 SpecialNum ------最多显示多少个专题名称 '4 ShowPropertyType ---- 显示前的小图标,0为不显示,1为符号,其他为小图片:/images/Special_List*.gif '5 OpenType ---- 打开方式,0为在原窗口打开,1为在新窗口打开 '6 Cols ---- 每行的列数。超过此列数就换行。 '================================================= Function ShowSpecialList(ChannelID, IsElite, SpecialNum, ShowPropertyType, OpenType, Cols) Dim sqlSpecial, rsSpecial, strSpecial, i If SpecialNum <= 0 Or SpecialNum > 100 Then SpecialNum = 10 End If If Cols = 0 Then Cols = 1 If ChannelID = -1 Then sqlSpecial = "select S.ChannelID,S.SpecialID,S.SpecialName,S.SpecialDir,C.ChannelDir,C.FileExt_List,C.UseCreateHTML,S.Tips from PE_Special S left join PE_Channel C on S.ChannelID=C.ChannelID where 1=1" ElseIf ChannelID = 0 Then sqlSpecial = "select ChannelID,SpecialID,SpecialName,SpecialDir,Tips from PE_Special where ChannelID=0" Else sqlSpecial = "select S.ChannelID,S.SpecialID,S.SpecialName,S.SpecialDir,S.Tips,C.ChannelDir,C.FileExt_List,C.UseCreateHTML from PE_Special S left join PE_Channel C on S.ChannelID=C.ChannelID where S.ChannelID=" & ChannelID & "" End If If IsElite = True Then If ChannelID = 0 Then sqlSpecial = sqlSpecial & " and IsElite=" & PE_True & " order by OrderID" Else sqlSpecial = sqlSpecial & " and S.IsElite=" & PE_True & " order by S.OrderID" End If End If Set rsSpecial = Conn.Execute(sqlSpecial) If rsSpecial.BOF And rsSpecial.EOF Then strSpecial = " 没有任何专题栏目" Else i = 0 Do While Not rsSpecial.EOF If i > 0 Then If i Mod Cols = 0 Then strSpecial = strSpecial & "
" Else strSpecial = strSpecial & "  " End If End If If ShowPropertyType = 0 Then strSpecial = strSpecial & "" ElseIf ShowPropertyType = 1 Then strSpecial = strSpecial & "·" Else strSpecial = strSpecial & "" End If If rsSpecial("ChannelID") <> 0 Then If rsSpecial("UseCreateHTML") = 1 Or rsSpecial("UseCreateHTML") = 3 Then strSpecial = strSpecial & "  ".asp" Then strSpecial = strSpecial & " " Else strSpecial = strSpecial & " target=""_blank"">" End If strSpecial = strSpecial & rsSpecial("SpecialName") & "" rsSpecial.MoveNext i = i + 1 If i >= SpecialNum Then Exit Do Loop End If If Not rsSpecial.EOF Then If ChannelID = -1 Or ChannelID = 0 Then strSpecial = strSpecial & "

更多专题

" Else strSpecial = strSpecial & "

更多专题

" End If End If rsSpecial.Close Set rsSpecial = Nothing ShowSpecialList = strSpecial End Function '================================================== '函数名:GetInfoChannel '作 用:获取对象的频道参数 '参 数:InfoID ------对象ID ' :OutType -----输出方式 '================================================== Function GetInfoChannel(InfoID, OutType) If IsNull(InfoID) = True Or IsNull(OutType) = True Then GetInfoChannel = "" Exit Function End If Dim sqlInfo, rsInfo, rsChannel2, strTemp sqlInfo = "select top 1 ChannelID,ChannelName,LinkUrl,ChannelDir,Disabled,UploadDir from PE_Channel Where ChannelID=" & PE_CLng(InfoID) Set rsInfo = Conn.Execute(sqlInfo) If Not (rsInfo.BOF And rsInfo.EOF) Then If rsInfo("Disabled") = True Then strTemp = "" Else Select Case OutType Case 1 If IsNull(rsInfo("ChannelDir")) Then strTemp = rsInfo("LinkUrl") Else strTemp = rsInfo("ChannelDir") End If Case 2 strTemp = rsInfo("ChannelName") Case 3 strTemp = rsInfo("UploadDir") Case Else strTemp = "标签参数错" End Select End If End If rsInfo.Close Set rsInfo = Nothing GetInfoChannel = strTemp End Function '================================================== '函数名:GetInfoUrl '作 用:获取对象的路径 '参 数:InfoID ------对象ID ' :DataType ------数据库名称 '================================================== Function GetInfoUrl(InfoID, DataType, OutType) If IsNull(InfoID) = True Or IsNull(DataType) = True Or IsNull(OutType) = True Then GetInfoUrl = "" Exit Function End If Dim sqlInfo, rsInfo, rsChannel2, strTemp Dim ChannelDir, StructureType, FileNameType, FileExtType, iUseCreateHTML, CacheTemp, ChannelTemp,ChannelUrl Select Case DataType Case "Article" sqlInfo = "select top 1 A.ArticleID,A.ChannelID,A.ClassID,A.Title,A.UpdateTime,A.InfoPoint,C.ClassDir,C.ParentDir,C.ClassPurview from PE_Article A Left join PE_Class C on A.ClassID=C.ClassID Where A.ArticleID=" & PE_CLng(InfoID) Case "Soft" sqlInfo = "select top 1 A.SoftID,A.ChannelID,A.ClassID,A.SoftName,A.UpdateTime,A.InfoPoint,C.ClassDir,C.ParentDir,C.ClassPurview from PE_Soft A Left join PE_Class C on A.ClassID=C.ClassID Where A.SoftID=" & PE_Clng(InfoID) Case "Photo" sqlInfo = "select top 1 A.PhotoID,A.ChannelID,A.ClassID,A.PhotoName,A.UpdateTime,A.InfoPoint,C.ClassDir,C.ParentDir,C.ClassPurview from PE_Photo A Left join PE_Class C on A.ClassID=C.ClassID Where A.PhotoID=" & PE_CLng(InfoID) Case "Product" sqlInfo = "select top 1 A.ProductID,A.ChannelID,A.ClassID,A.ProductName,A.UpdateTime,A.Stocks,C.ClassDir,C.ParentDir,C.ClassPurview from PE_Product A Left join PE_Class C on A.ClassID=C.ClassID Where A.ProductID=" & PE_CLng(InfoID) Case Else GetInfoUrl = InfoID Exit Function End Select Set rsInfo = Conn.Execute(sqlInfo) If Not (rsInfo.BOF And rsInfo.EOF) Then If PE_Cache.CacheIsEmpty("InfoUrl_" & DataType) Then Set rsChannel2 = Conn.Execute("select ChannelID,ChannelDir,StructureType,FileNameType,FileExt_Item,UseCreateHTML from PE_Channel Where ChannelID=" & rsInfo(1) & " and Disabled=" & PE_False) If Not (rsChannel2.BOF And rsChannel2.EOF) Then ChannelDir = rsChannel2("ChannelDir") StructureType = rsChannel2("StructureType") FileNameType = rsChannel2("FileNameType") FileExtType = rsChannel2("FileExt_Item") iUseCreateHTML = rsChannel2("UseCreateHTML") CacheTemp = rsChannel2("ChannelID") & "|||" & rsChannel2("ChannelDir") & "|||" & rsChannel2("StructureType") & "|||" & rsChannel2("FileNameType") & "|||" & rsChannel2("FileExt_Item") & "|||" & rsChannel2("UseCreateHTML") PE_Cache.SetValue "InfoUrl_" & DataType, CacheTemp Else strTemp = InfoID End If rsChannel2.Close Set rsChannel2 = Nothing Else ChannelTemp = Split(PE_Cache.GetValue("InfoUrl_" & DataType), "|||") If rsInfo(1) = ChannelTemp(0) Then ChannelDir = ChannelTemp(1) StructureType = ChannelTemp(2) FileNameType = ChannelTemp(3) FileExtType = ChannelTemp(4) iUseCreateHTML = ChannelTemp(5) Else Set rsChannel2 = Conn.Execute("select ChannelID,ChannelDir,StructureType,FileNameType,FileExt_Item,UseCreateHTML from PE_Channel Where ChannelID=" & rsInfo(1) & " and Disabled=" & PE_False) If Not (rsChannel2.BOF And rsChannel2.EOF) Then ChannelDir = rsChannel2("ChannelDir") StructureType = rsChannel2("StructureType") FileNameType = rsChannel2("FileNameType") FileExtType = rsChannel2("FileExt_Item") iUseCreateHTML = rsChannel2("UseCreateHTML") CacheTemp = rsChannel2("ChannelID") & "|||" & rsChannel2("ChannelDir") & "|||" & rsChannel2("StructureType") & "|||" & rsChannel2("FileNameType") & "|||" & rsChannel2("FileExt_Item") & "|||" & rsChannel2("UseCreateHTML") PE_Cache.SetValue "InfoUrl_" & DataType, CacheTemp Else strTemp = InfoID End If rsChannel2.Close Set rsChannel2 = Nothing End If End If If strTemp <> InfoID Then Select Case OutType Case 1 ChannelUrl = strInstallDir & ChannelDir If Enable_SubDomain = True And rsInfo("ChannelID")>0 Then ChannelUrl = Conn.Execute("select LinkUrl from PE_Channel where ChannelID="&rsInfo("ChannelID"))(0) If IsNull(ChannelUrl) Or Trim(ChannelUrl) = "" Or Left(strInstallDir, 7) <> "http://" Then ChannelUrl = strInstallDir & ChannelDir Else ChannelUrl = ChannelUrl End If End If If iUseCreateHTML > 0 Then If DataType = "Product" Then strTemp = ChannelUrl & GetItemPath(StructureType, rsInfo(7), rsInfo(6), rsInfo(4)) & GetItemFileName(FileNameType, ChannelDir, rsInfo(4), InfoID) & arrFileExt(FileExtType) Else If (rsInfo(8) = 0 And rsInfo(5) = 0) Or (rsInfo(2) = -1 And rsInfo(5) = 0) Then strTemp = ChannelUrl & GetItemPath(StructureType, rsInfo(7), rsInfo(6), rsInfo(4)) & GetItemFileName(FileNameType, ChannelDir, rsInfo(4), InfoID) & arrFileExt(FileExtType) Else strTemp = ChannelUrl & "/Show" & DataType & ".asp?" & DataType & "ID=" & rsInfo(0) End If End If Else strTemp = ChannelUrl & "/Show" & DataType & ".asp?" & DataType & "ID=" & rsInfo(0) End If Case 2 strTemp = rsInfo(3) Case 3 If iUseCreateHTML > 0 Then If DataType = "Product" Then strTemp = "" & rsInfo(3) & "" Else If (rsInfo(8) = 0 And rsInfo(5) = 0) Or (rsInfo(2) = -1 And rsInfo(5) = 0) Then strTemp = "" & rsInfo(3) & "" Else strTemp = "" & rsInfo(3) & "" End If End If Else strTemp = "" & rsInfo(3) & "" End If Case Else strTemp = "标签参数错误" End Select End If End If rsInfo.Close Set rsInfo = Nothing GetInfoUrl = strTemp End Function '================================================== '函数名:GetInfoClass '作 用:获取对象的分类 '参 数:InfoID ------对象ID ' :DataType ------数据库名称 '================================================== Function GetInfoClass(InfoID, OutType) If IsNull(InfoID) = True Or IsNull(OutType) = True Then GetInfoClass = "" Exit Function End If Dim sqlInfo, rsInfo, rsChannel2, strTemp, PriChannelID Dim ChannelDir, ModuleType, StructureType, ListFileType, FileExtList, iUseCreateHTML sqlInfo = "select top 1 ClassID,ChannelID,ClassName,ClassDir,ParentDir,ClassPurview from PE_Class Where ClassID=" & PE_CLng(InfoID) Set rsInfo = Conn.Execute(sqlInfo) If Not (rsInfo.BOF And rsInfo.EOF) Then If rsInfo("ChannelID") <> PriChannelID Then Set rsChannel2 = Conn.Execute("select ChannelID,ChannelDir,ModuleType,StructureType,ListFileType,FileExt_List,UseCreateHTML from PE_Channel Where ChannelID=" & rsInfo("ChannelID") & " and Disabled=" & PE_False) If Not (rsChannel2.BOF And rsChannel2.EOF) Then ChannelDir = rsChannel2("ChannelDir") ModuleType = rsChannel2("ModuleType") StructureType = rsChannel2("StructureType") ListFileType = rsChannel2("ListFileType") FileExtList = rsChannel2("FileExt_List") iUseCreateHTML = rsChannel2("UseCreateHTML") PriChannelID = rsInfo("ChannelID") Else strTemp = "栏目不存在" End If rsChannel2.Close Set rsChannel2 = Nothing End If If strTemp <> "栏目不存在" Then Select Case OutType Case 1 If iUseCreateHTML = 1 Or iUseCreateHTML = 3 Then If ModuleType = 5 Then strTemp = ChannelDir & GetListPath(StructureType, ListFileType, rsInfo("ParentDir"), rsInfo("ClassDir")) & GetListFileName(ListFileType, rsInfo("ClassID"), 1, 1) & arrFileExt(FileExtList) Else If rsInfo("ClassPurview") < 2 Then strTemp = ChannelDir & GetListPath(StructureType, ListFileType, rsInfo("ParentDir"), rsInfo("ClassDir")) & GetListFileName(ListFileType, rsInfo("ClassID"), 1, 1) & arrFileExt(FileExtList) Else strTemp = ChannelDir & "/ShowClass.asp?ClassID=" & rsInfo("ClassID") End If End If Else strTemp = ChannelDir & "/ShowClass.asp?ClassID=" & rsInfo("ClassID") End If Case 2 strTemp = rsInfo("ClassName") Case 3 If iUseCreateHTML = 1 Or iUseCreateHTML = 3 Then If ModuleType = 5 Then strTemp = "" & rsInfo("ClassName") & "" Else If rsInfo("ClassPurview") < 2 Then strTemp = "" & rsInfo("ClassName") & "" Else strTemp = "" & rsInfo("ClassName") & "" End If End If Else strTemp = "" & rsInfo("ClassName") & "" End If Case Else strTemp = "标签参数错" End Select GetInfoClass = strTemp Else GetInfoClass = "" End If End If rsInfo.Close Set rsInfo = Nothing End Function '================================================== '函数名:GetInfoSpecil '作 用:获取对象的专题 '参 数:InfoID ------对象ID ' :DataType ------数据库名称 '================================================== Function GetInfoSpecil(InfoID, OutType) If IsNull(InfoID) = True Or IsNull(OutType) = True Then GetInfoSpecil = "" Exit Function End If Dim sqlInfo, rsInfo, rsChannel2, strTemp, PriChannelID Dim ChannelDir, iUseCreateHTML sqlInfo = "select top 1 A.ChannelID,I.SpecialID,SP.SpecialName,SP.SpecialDir from PE_Article A right join (PE_InfoS I left join PE_Special SP on I.SpecialID=SP.SpecialID) on A.ArticleID=I.ItemID Where A.ArticleID=" & PE_CLng(InfoID) Set rsInfo = Conn.Execute(sqlInfo) If Not (rsInfo.BOF And rsInfo.EOF) Then If rsInfo(0) <> PriChannelID Then Set rsChannel2 = Conn.Execute("select ChannelID,ChannelDir,UseCreateHTML from PE_Channel Where ChannelID=" & rsInfo(0) & " and Disabled=" & PE_False) If Not (rsChannel2.BOF And rsChannel2.EOF) Then ChannelDir = rsChannel2("ChannelDir") iUseCreateHTML = rsChannel2("UseCreateHTML") PriChannelID = rsInfo(0) Else strTemp = "专题不存在" End If rsChannel2.Close Set rsChannel2 = Nothing End If If strTemp <> "专题不存在" Then Select Case OutType Case 1 If iUseCreateHTML = 1 Or iUseCreateHTML = 3 Then strTemp = ChannelDir & "/" & rsInfo(3) & "Index.html" Else strTemp = ChannelDir & "/ShowSpecial.asp?SpecialID=" & rsInfo(1) End If Case 2 strTemp = rsInfo(2) Case 3 If iUseCreateHTML = 1 Or iUseCreateHTML = 3 Then strTemp = "" & rsInfo(2) & "" Else strTemp = "" & rsInfo(2) & "" End If Case Else strTemp = "标签参数错" End Select GetInfoSpecil = strTemp Else GetInfoSpecil = "" End If End If rsInfo.Close Set rsInfo = Nothing End Function Function GetSiteCountAll() Dim sqlCount, rsCount, iCount, strCount If PE_Cache.CacheIsEmpty("SiteCountAll") Then sqlCount = "select ChannelName,ChannelShortName,ItemCount,ChannelItemUnit,ModuleType from PE_Channel where ChannelType<=1 and ChannelID<>4 and ChannelID<>997 and Disabled=" & PE_False & " order by OrderID" Set rsCount = Conn.Execute(sqlCount) Do While Not rsCount.EOF If IsNull(rsCount("ItemCount")) Then iCount = 0 Else iCount = rsCount("ItemCount") End If strCount = strCount & (rsCount("ChannelName") & ":" & iCount & " " & rsCount("ChannelItemUnit") & rsCount("ChannelShortName") & "
") rsCount.MoveNext Loop rsCount.Close sqlCount = "select count(UserID) from PE_User" Set rsCount = Conn.Execute(sqlCount) strCount = strCount & Replace(XmlText("Site", "SiteCountAll", "注册会员:{$Count}位"), "{$Count}", rsCount(0)) & "
" rsCount.Close Set rsCount = Nothing PE_Cache.SetValue "SiteCountAll", strCount Else strCount = PE_Cache.GetValue("SiteCountAll") End If GetSiteCountAll = strCount End Function '================================================== '过程名:GetMenuJS '作 用:生成下拉菜单相关的JS代码 '参 数:无 '================================================== Function GetMenuJS(sChannelDir, ShowClassTreeGuide) Dim strMenu strMenu = "" & vbCrLf If ChannelID > 0 And ChannelID <> 4 Then '无限级下拉菜单的JS代码文件 strMenu = strMenu & "" If ShowClassTreeGuide = True Then strMenu = strMenu & "" & vbCrLf strMenu = strMenu & "" & vbCrLf End If End If GetMenuJS = strMenu End Function Function GetLinkType_Option() Dim strOption strOption = "" GetLinkType_Option = strOption End Function Function GetFsKind_Option(KindType) Dim sqlFsKind, rsFsKind, strOption, FsKindID, strID, strName If KindType = 1 Then FsKindID = KindID strName = "类别" strOption = "" End If strOption = strOption & "" sqlFsKind = "select * from PE_FsKind" If KindType > 0 Then sqlFsKind = sqlFsKind & " where KindType=" & KindType End If sqlFsKind = sqlFsKind & " order by KindID" Set rsFsKind = Conn.Execute(sqlFsKind) Do While Not rsFsKind.EOF If rsFsKind("KindID") = FsKindID Then strOption = strOption & "" Else strOption = strOption & "" End If rsFsKind.MoveNext Loop rsFsKind.Close Set rsFsKind = Nothing strOption = strOption & "" GetFsKind_Option = strOption End Function Function SetSearchString(strField) Dim arrTemp, i Dim strTemp, j If Keyword = "" Then SetSearchString = "" Exit Function End If strTemp = " And (" arrTemp = Split(Keyword, ",") If UBound(arrTemp) > 2 Then j = 2 Else j = UBound(arrTemp) End If For i = 0 To j If i = 0 Then If strField = "Keyword" Then strTemp = strTemp & strField & " like '%|" & arrTemp(i) & "|%' " Else strTemp = strTemp & strField & " like '%" & arrTemp(i) & "%' " End If Else If strField = "Keyword" Then strTemp = strTemp & " and " & strField & " like '%|" & arrTemp(i) & "|%' " Else strTemp = strTemp & " and " & strField & " like '%" & arrTemp(i) & "%' " End If End If Next strTemp = strTemp & ")" SetSearchString = strTemp End Function Function GetResultTitle() Dim strTitle Dim arrTemp, i, sTemp, j If Keyword = "" Then If Trim(Request.ServerVariables("QUERY_STRING")) <> "" Then strTitle = "本次高级搜索结果" Else strTitle = "所有" & ChannelShortName End If Else Keyword = Replace(Replace(Keyword, " ", ","), ",,", ",") sTemp = Replace(Keyword, ",", " 和 ") Select Case strField Case "ProductNum" strTitle = "编号含有 " & sTemp & " 的" & ChannelShortName Case "Title" strTitle = "标题含有 " & sTemp & " 的" & ChannelShortName Case "ArticleID" strTitle = "ID为 " & sTemp & " 的" & ChannelShortName Case "Content" strTitle = "内容含有 " & sTemp & " 的" & ChannelShortName Case "SoftName" strTitle = "名称含有 " & sTemp & " 的" & ChannelShortName Case "SoftIntro" strTitle = "简介含有 " & sTemp & " 的" & ChannelShortName Case "PhotoName" strTitle = "名称含有 " & sTemp & " 的" & ChannelShortName Case "PhotoIntro" strTitle = "简介含有 " & sTemp & " 的" & ChannelShortName Case "Author" strTitle = "作者姓名中含有 " & sTemp & " 的" & ChannelShortName Case "Inputer" strTitle = "" & sTemp & " 录入的" & ChannelShortName Case "ProductName" strTitle = "名称含有 " & sTemp & " 的" & ChannelShortName Case "ProductIntro" strTitle = "简介含有 " & sTemp & " 的" & ChannelShortName Case "ProductExplain" strTitle = "介绍含有 " & sTemp & " 的" & ChannelShortName Case "ProducerName" strTitle = "厂商为 " & sTemp & " 的" & ChannelShortName Case "TrademarkName" strTitle = "品牌/商标为 " & sTemp & " 的" & ChannelShortName Case "Keywords" strTitle = "关键字含有 " & sTemp & " 的" & ChannelShortName Case Else Dim rsField Set rsField = Conn.Execute("select Title from PE_Field where (ChannelID=-1 or ChannelID=" & ChannelID & ") and FieldName='" & ReplaceBadChar(strField) & "'") If rsField.BOF And rsField.EOF Then strTitle = "标题含有 " & sTemp & " 的" & ChannelShortName Else strTitle = rsField(0) & "中含有 " & sTemp & " 的" & ChannelShortName End If rsField.Close Set rsField = Nothing End Select End If GetResultTitle = strTitle End Function Function GetValidConsumeLogID(iUserName, iModuleType, InfoID, iChargeType, PitchTime, ReadTimes) Dim trs Select Case PE_CLng(iChargeType) Case 0 '不重复收费 Set trs = Conn.Execute("select top 1 LogID from PE_ConsumeLog where UserName='" & iUserName & "' and ModuleType=" & iModuleType & " and InfoID=" & InfoID & " and Income_Payout=2 order by LogID desc") Case 1 '距离上次收费时间 N 小时后重新收费 Set trs = Conn.Execute("select top 1 LogID from PE_ConsumeLog where UserName='" & iUserName & "' and ModuleType=" & iModuleType & " and InfoID=" & InfoID & " and Income_Payout=2 and DateDiff(" & PE_DatePart_H & ",LogTime," & PE_Now & ")<" & PitchTime & " order by LogID desc") Case 2 '会员重复查看此文章 N 次后重新收费 Set trs = Conn.Execute("select top 1 LogID from PE_ConsumeLog where UserName='" & iUserName & "' and ModuleType=" & iModuleType & " and InfoID=" & InfoID & " and Income_Payout=2 and Times<" & ReadTimes & " order by LogID desc") Case 3 '上述两者都满足时重新收费 Set trs = Conn.Execute("select top 1 LogID from PE_ConsumeLog where UserName='" & iUserName & "' and ModuleType=" & iModuleType & " and InfoID=" & InfoID & " and Income_Payout=2 and (DateDiff(" & PE_DatePart_H & ",LogTime," & PE_Now & ")<" & PitchTime & " or Times<" & ReadTimes & ") order by LogID desc") Case 4 '上述两者任一个满足时就重新收费 Set trs = Conn.Execute("select top 1 LogID from PE_ConsumeLog where UserName='" & iUserName & "' and ModuleType=" & iModuleType & " and InfoID=" & InfoID & " and Income_Payout=2 and (DateDiff(" & PE_DatePart_H & ",LogTime," & PE_Now & ")<" & PitchTime & " and Times<" & ReadTimes & ") order by LogID desc") Case 5 '每阅读一次就重复收费一次 Set trs = Conn.Execute("select top 1 LogID from PE_ConsumeLog where 1=0 order by LogID desc") End Select If trs.BOF And trs.EOF Then GetValidConsumeLogID = 0 Else GetValidConsumeLogID = trs(0) End If Set trs = Nothing End Function '******************************************************* '函 数 名:GetVoteOfContent() '参 数:无 '作 用:返回投票标签的内容 '********************************************************** Function GetVoteOfContent(iItemID) If IsNull(iItemID) Then GetVote = "" Exit Function End If Dim rsVote, rsVote2, strtmp, i Set rsVote = Conn.Execute("select top 1 VoteID from " & SheetName & " where " & ModuleName & "ID=" & PE_CLng(iItemID)) If IsNull(rsVote("VoteID")) Or rsVote("VoteID") = "" Or rsVote("VoteID") = 0 Then GetVoteOfContent = "" Else Set rsVote2 = Conn.Execute("select top 1 * from PE_Vote where ID=" & rsVote("VoteID")) If rsVote2.BOF And rsVote2.EOF Then GetVoteOfContent = "" Else If Now() > rsVote2("EndTime") Then GetVoteOfContent = "本调查已过期,点击查看结果" Else If rsVote2("VoteType") = "Single" Then For i = 1 To 8 If Trim(rsVote2("Select" & i) & "") = "" Then Exit For strtmp = strtmp & "" & rsVote2("Select" & i) & "
" Next Else For i = 1 To 8 If Trim(rsVote2("Select" & i) & "") = "" Then Exit For strtmp = strtmp & "" & rsVote2("Select" & i) & "
" Next End If GetVoteOfContent = Replace(Replace(Replace(Replace(Replace(XmlText("Article", "ShowVote", "

您对""{$Title}""的看法是

{$VoteBody}
  
"), "{$strInstallDir}", strInstallDir), "{$Title}", rsVote2("Title")), "{$VoteBody}", strtmp), "{$VoteType}", rsVote2("VoteType")), "{$ID}", rsVote2("ID")) End If End If End If Set rsVote = Nothing Set rsVote2 = Nothing End Function '************************************************** '函数名:自设内容 '作 用:创建文件夹 '参 数:foldername ----文件夹名 '返回值:True ----已创建 '************************************************** Function CustomContent(ByVal LabelType, ByVal Custom_Content, ByVal strHtml) Dim arrCustom, i If IsNull(Custom_Content) = True Or Custom_Content = "" Then For i = 1 To 20 strHtml = PE_Replace(strHtml, "{$" & LabelType & "_Custom_Content" & i & "}", "") Next Else arrCustom = Split(Custom_Content, "{#$$$#}") For i = 0 To UBound(arrCustom) strHtml = PE_Replace(strHtml, "{$" & LabelType & "_Custom_Content" & i + 1 & "}", arrCustom(i)) Next For i = UBound(arrCustom) To 20 strHtml = PE_Replace(strHtml, "{$" & LabelType & "_Custom_Content" & i & "}", "") Next End If CustomContent = strHtml End Function Function GetTDWidth_Date(DateType) Select Case DateType Case 0 '不显示 GetTDWidth_Date = 0 Case 1 '2006-09-11 GetTDWidth_Date = 60 Case 2 '9月11日 GetTDWidth_Date = 50 Case 3 '09-11 GetTDWidth_Date = 40 Case 4 '2006年9月11日 GetTDWidth_Date = 80 Case 5 '2006-9-11 10:20:30 GetTDWidth_Date = 120 End Select End Function '************************************************** '函数名:ShowPage_Html '作 用:显示“上一页 下一页”等信息 '参 数:strPath ----HTMl文件的路径 ' iClassID ----栏目ID ' FileExt ----- 扩展名 ' sfilename ---- 文件名 ' TotalNumber ----总数量 ' MaxPerPage ----每页数量 ' ShowTotal ----是否显示总数量 ' ShowAllPages ---是否用下拉列表显示所有页面以供跳转。有某些页面不能使用,否则会出现JS错误。 ' strUnit ----计数单位 '返回值:“上一页 下一页”等信息的HTML代码 '************************************************** Function ShowPage_Html(ByVal strPath, iClassID, FileExt, sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit) Dim NextPage, PrevPage, EndPage Dim TotalPage, strTemp, strUrl, i If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then ShowPage_Html = "" Exit Function End If If totalnumber Mod MaxPerPage = 0 Then TotalPage = totalnumber \ MaxPerPage Else TotalPage = totalnumber \ MaxPerPage + 1 End If If CurrentPage > TotalPage Then CurrentPage = TotalPage PrevPage = TotalPage - CurrentPage + 2 NextPage = TotalPage - CurrentPage EndPage = 1 If sfilename <> "" Then strUrl = JoinChar(sfilename) Else strUrl = "" End If If Right(strPath, 1) = "/" Then strPath = Left(strPath, Len(strPath) - 1) End If strTemp = strTemp & "
" If ShowTotal = True Then strTemp = strTemp & "共 " & totalnumber & " "& strUnit & "  " End If If CurrentPage = 1 Then strTemp = strTemp & "首页 | 上一页 |" Else If iClassID > 0 Then strTemp = strTemp & "首页 |" Else strTemp = strTemp & "首页 |" End If If CurrentPage = 2 Then If iClassID > 0 Then strTemp = strTemp & " 上一页 |" Else strTemp = strTemp & " 上一页 |" End If Else If strUrl <> "" Then strTemp = strTemp & " 上一页 |" Else If iClassID > 0 Then strTemp = strTemp & " 上一页 |" Else strTemp = strTemp & " 上一页 |" End If End If End If End If strTemp = strTemp & " " If ShowAllPages = True Then Dim Jmaxpages If (CurrentPage - 4) <= 0 Or TotalPage < 10 Then Jmaxpages = 1 Do While (Jmaxpages < 10) If Jmaxpages = CurrentPage Then strTemp = strTemp & "" & Jmaxpages & " " ElseIf Jmaxpages = 1 Then If iClassID > 0 Then strTemp = strTemp & "" & Jmaxpages & " " Else strTemp = strTemp & "" & Jmaxpages & " " End If Else If strUrl <> "" Then strTemp = strTemp & "" & Jmaxpages & " " Else If iClassID > 0 Then strTemp = strTemp & "" & Jmaxpages & " " Else strTemp = strTemp & "" & Jmaxpages & " " End If End If End If If Jmaxpages = TotalPage Then Exit Do Jmaxpages = Jmaxpages + 1 Loop ElseIf (CurrentPage + 4) >= TotalPage Then Jmaxpages = TotalPage - 8 Do While (Jmaxpages <= TotalPage) If Jmaxpages = CurrentPage Then strTemp = strTemp & "" & Jmaxpages & " " ElseIf Jmaxpages = 1 Then If iClassID > 0 Then strTemp = strTemp & "" & Jmaxpages & " " Else strTemp = strTemp & "" & Jmaxpages & " " End If Else If strUrl <> "" Then strTemp = strTemp & "" & Jmaxpages & " " Else If iClassID > 0 Then strTemp = strTemp & "" & Jmaxpages & " " Else strTemp = strTemp & "" & Jmaxpages & " " End If End If End If Jmaxpages = Jmaxpages + 1 Loop Else Jmaxpages = CurrentPage - 4 Do While (Jmaxpages < CurrentPage + 5) If Jmaxpages = CurrentPage Then strTemp = strTemp & "" & Jmaxpages & " " ElseIf Jmaxpages = 1 Then If iClassID > 0 Then strTemp = strTemp & "" & Jmaxpages & " " Else strTemp = strTemp & "" & Jmaxpages & " " End If Else If strUrl <> "" Then strTemp = strTemp & "" & Jmaxpages & " " Else If iClassID > 0 Then strTemp = strTemp & "" & Jmaxpages & " " Else strTemp = strTemp & "" & Jmaxpages & " " End If End If End If Jmaxpages = Jmaxpages + 1 Loop End If End If If CurrentPage >= TotalPage Then strTemp = strTemp & "| 下一页 | 尾页 " Else If strUrl <> "" Then strTemp = strTemp & "| 下一页 " strTemp = strTemp & "| 尾页 " Else If iClassID > 0 Then strTemp = strTemp & "| 下一页 " strTemp = strTemp & "| 尾页 " Else strTemp = strTemp & "| 下一页 " strTemp = strTemp & "| 尾页 " End If End If End If strTemp = strTemp & " " & MaxPerPage & "" & strUnit & "/页" If ShowAllPages = True Then strTemp = strTemp & "  转到第页" strTemp = strTemp & "" & vbCrLf End If strTemp = strTemp & "
" & vbCrLf ShowPage_Html = strTemp End Function '************************************************** '函数名:ShowPage_en_Html '作 用:显示英文“上一页 下一页”等信息 '参 数:strPath ----HTMl文件的路径 ' iClassID ----栏目ID ' FileExt ----- 扩展名 ' sfilename ---- 文件名 ' TotalNumber ----总数量 ' MaxPerPage ----每页数量 ' ShowTotal ----是否显示总数量 ' ShowAllPages ---是否用下拉列表显示所有页面以供跳转。有某些页面不能使用,否则会出现JS错误。 ' strUnit ----计数单位 '返回值:“上一页 下一页”等信息的HTML代码 '************************************************** Function ShowPage_en_Html(ByVal strPath, iClassID, FileExt, sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit) Dim NextPage, PrevPage, EndPage Dim TotalPage, strTemp, strUrl, i If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then ShowPage_en_Html = "" Exit Function End If If totalnumber Mod MaxPerPage = 0 Then TotalPage = totalnumber \ MaxPerPage Else TotalPage = totalnumber \ MaxPerPage + 1 End If If CurrentPage > TotalPage Then CurrentPage = TotalPage PrevPage = TotalPage - CurrentPage + 2 NextPage = TotalPage - CurrentPage EndPage = 1 If sfilename <> "" Then strUrl = JoinChar(sfilename) Else strUrl = "" End If If Right(strPath, 1) = "/" Then strPath = Left(strPath, Len(strPath) - 1) End If strTemp = "" strTemp = strTemp & "
" If ShowTotal = True Then strTemp = strTemp & "Total " & totalnumber & " " & strUnit & "  " End If If CurrentPage = 1 Then strTemp = strTemp & "FirstPage PreviousPage " Else If iClassID > 0 Then strTemp = strTemp & "FirstPage " Else strTemp = strTemp & "FirstPage " End If If CurrentPage = 2 Then If iClassID > 0 Then strTemp = strTemp & "PreviousPage " Else strTemp = strTemp & "PreviousPage " End If Else If strUrl <> "" Then strTemp = strTemp & "PreviousPage " Else If iClassID > 0 Then strTemp = strTemp & "PreviousPage " Else strTemp = strTemp & "PreviousPage " End If End If End If End If If CurrentPage >= TotalPage Then strTemp = strTemp & "NextPage LastPage" Else If strUrl <> "" Then strTemp = strTemp & "NextPage " strTemp = strTemp & "LastPage" Else If iClassID > 0 Then strTemp = strTemp & "NextPage " strTemp = strTemp & "LastPage" Else strTemp = strTemp & "NextPage " strTemp = strTemp & "LastPage" End If End If End If strTemp = strTemp & " CurrentPage:" & CurrentPage & "/" & TotalPage & " " strTemp = strTemp & " " & MaxPerPage & "" & strUnit & "/Page" If ShowAllPages = True Then If TotalPage > 20 Then strTemp = strTemp & "  GoTo Page:" Else strTemp = strTemp & " Goto:" End If End If strTemp = strTemp & "
" & vbCrLf If ShowAllPages = True And TotalPage > 20 Then strTemp = strTemp & "" & vbCrLf End If strTemp = strTemp & "" ShowPage_en_Html = strTemp End Function Function ReplaceSpace(ByVal iText) If IsNull(iText) Then ReplaceSpace = "未知" Else ReplaceSpace = iText End If End Function %> <% '************************************************************** ' Software name: PowerEasy SiteWeaver ' Web: http://www.powereasy.net ' Copyright (C) 2005-2009 佛山市动易网络科技有限公司 版权所有 '************************************************************** '定义频道设置相关的变量 Dim ChannelID, ChannelName, ChannelShortName, ChannelItemUnit, ChannelDir, ChannelPicUrl, ChannelUrl, ChannelUrl_ASPFile, UploadDir Dim Meta_Keywords_Channel, Meta_Description_Channel, Custom_Content_Channel, ChannelPurview, ChannelArrGroupID, AuthorInfoLen Dim ShowChannelName, ShowNameOnPath, ShowClassTreeGuide, ShowSuspensionPoints, DaysOfNew, HitsOfHot, Template_Index, DefaultSkinID Dim MaxPerPage_Index, MaxPerPage_New, MaxPerPage_Hot, MaxPerPage_Elite, MaxPerPage_SpecialList Dim UseCreateHTML, AutoCreateType, StructureType, ListFileType, FileNameType, FileExt_Index, FileExt_List, FileExt_Item, UpdatePages Dim ItemCount_Channel, ItemChecked_Channel, CommentCount_Channel, SpecialCount_Channel Dim ModuleType, ModuleName, SheetName Dim arrEnabledTabs, MoneyPerKw Dim TopMenuType, ClassGuideType, CheckLevel Dim EmailOfReject, EmailOfPassed Dim JS_SpecialNum Dim MaxFileSize, Fields_Options Dim FileName_Index Dim MaxPerLine Dim CommandChannelPoint Sub GetChannel(tChannelID) Dim sqlChannel, rsChannel ModuleType = 0 ChannelItemUnit = "" ChannelDir = "" ChannelPicUrl = "" Meta_Keywords_Channel = "" Meta_Description_Channel = "" Custom_Content_Channel = "" ChannelPurview = 0 ChannelArrGroupID = "" AuthorInfoLen = 8 MaxPerPage_Index = 20 MaxPerPage_New = 20 MaxPerPage_Hot = 20 MaxPerPage_Elite = 20 MaxPerPage_SpecialList = 20 ShowClassTreeGuide = False HitsOfHot = SiteHitsOfHot DaysOfNew = 10 DefaultSkinID = 0 ShowSuspensionPoints = False UseCreateHTML = 0 AutoCreateType = 0 StructureType = 0 ListFileType = 0 FileNameType = 0 FileExt_Index = arrFileExt(0) FileExt_List = arrFileExt(0) FileExt_Item = arrFileExt(0) UpdatePages = 3 Template_Index = 0 ItemCount_Channel = 0 ItemChecked_Channel = 0 CommentCount_Channel = 0 SpecialCount_Channel = 0 MaxPerLine = 10 ChannelUrl = "" If tChannelID > 0 Then sqlChannel = "select * from PE_Channel where ChannelID=" & tChannelID Set rsChannel = Conn.Execute(sqlChannel) If rsChannel.BOF And rsChannel.EOF Then FoundErr = True ErrMsg = ErrMsg & "找不到指定的频道" Else If rsChannel("Disabled") = True Then FoundErr = True ErrMsg = ErrMsg & "
  • 此频道已经被管理员禁用!
  • " End If ChannelName = rsChannel("ChannelName") ChannelDir = rsChannel("ChannelDir") ChannelPicUrl = rsChannel("ChannelPicUrl") ChannelShortName = rsChannel("ChannelShortName") ChannelItemUnit = rsChannel("ChannelItemUnit") ShowChannelName = rsChannel("ShowName") ShowNameOnPath = rsChannel("ShowNameOnPath") UploadDir = rsChannel("UploadDir") Meta_Keywords_Channel = rsChannel("Meta_Keywords") Meta_Description_Channel = rsChannel("Meta_Description") Custom_Content_Channel = rsChannel("Custom_Content") ChannelPurview = rsChannel("ChannelPurview") ChannelArrGroupID = rsChannel("arrGroupID") AuthorInfoLen = rsChannel("AuthorInfoLen") MaxPerPage_Index = rsChannel("MaxPerPage_Index") MaxPerPage_SearchResult = rsChannel("MaxPerPage_SearchResult") MaxPerPage_New = rsChannel("MaxPerPage_New") MaxPerPage_Hot = rsChannel("MaxPerPage_Hot") MaxPerPage_Elite = rsChannel("MaxPerPage_Elite") MaxPerPage_SpecialList = rsChannel("MaxPerPage_SpecialList") ShowClassTreeGuide = rsChannel("ShowClassTreeGuide") HitsOfHot = rsChannel("HitsOfHot") DaysOfNew = rsChannel("DaysOfNew") DefaultSkinID = rsChannel("DefaultSkinID") CheckLevel = rsChannel("CheckLevel") ShowSuspensionPoints = rsChannel("ShowSuspensionPoints") UseCreateHTML = rsChannel("UseCreateHTML") AutoCreateType = rsChannel("AutoCreateType") StructureType = rsChannel("StructureType") ListFileType = rsChannel("ListFileType") FileNameType = rsChannel("FileNameType") FileExt_Index = arrFileExt(rsChannel("FileExt_Index")) FileExt_List = arrFileExt(rsChannel("FileExt_List")) FileExt_Item = arrFileExt(rsChannel("FileExt_Item")) UpdatePages = PE_CLng1(rsChannel("UpdatePages")) TopMenuType = rsChannel("TopMenuType") ClassGuideType = rsChannel("ClassGuideType") arrEnabledTabs = rsChannel("arrEnabledTabs") MoneyPerKw = rsChannel("MoneyPerKw") EmailOfReject = Replace(rsChannel("EmailOfReject") & "", vbCrLf, "\n") EmailOfPassed = Replace(rsChannel("EmailOfPassed") & "", vbCrLf, "\n") CommandChannelPoint = PE_Clng(rsChannel("CommandChannelPoint")) ModuleType = rsChannel("ModuleType") MaxPerLine = rsChannel("MaxPerLine") Template_Index = rsChannel("Template_Index") ItemCount_Channel = rsChannel("ItemCount") ItemChecked_Channel = rsChannel("ItemChecked") CommentCount_Channel = rsChannel("CommentCount") SpecialCount_Channel = rsChannel("SpecialCount") If IsNull(ItemCount_Channel) Then ItemCount_Channel = 0 If IsNull(ItemChecked_Channel) Then ItemChecked_Channel = 0 If IsNull(CommentCount_Channel) Then CommentCount_Channel = 0 If IsNull(SpecialCount_Channel) Then SpecialCount_Channel = 0 JS_SpecialNum = rsChannel("JS_SpecialNum") MaxFileSize = rsChannel("MaxFileSize") Fields_Options = rsChannel("Fields_Options") '只使用绝对地址时,才使用频道子域名 If IsNull(rsChannel("LinkUrl")) Or Trim(rsChannel("LinkUrl")) = "" Or Left(strInstallDir, 7) <> "http://" Then ChannelUrl = strInstallDir & ChannelDir Else ChannelUrl = rsChannel("LinkUrl") End If If Right(ChannelUrl, 1) = "/" Then ChannelUrl = Left(ChannelUrl, Len(ChannelUrl) - 1) End If 'If SystemDatabaseType = "SQL" Then ChannelUrl_ASPFile = ChannelUrl 'Else ' ChannelUrl_ASPFile = strInstallDir & ChannelDir 'End If If ChannelPurview > 0 Then UseCreateHTML = 0 Select Case ModuleType Case 1 ModuleName = "Article" SheetName = "PE_Article" Case 2 ModuleName = "Soft" SheetName = "PE_Soft" Case 3 ModuleName = "Photo" SheetName = "PE_Photo" Case 5 ModuleName = "Product" SheetName = "PE_Product" Case 6 ModuleName = "Supply" SheetName = "PE_Supply" End Select End If rsChannel.Close Set rsChannel = Nothing End If End Sub %> <% '************************************************************** ' Software name: PowerEasy SiteWeaver ' Web: http://www.powereasy.net ' Copyright (C) 2005-2008 佛山市动易网络科技有限公司 版权所有 '************************************************************** ChannelID = 0 PageTitle = "版权申明" strHTML = GetTemplate(ChannelID, 7, 0) Call ReplaceCommonLabel strNavPath = strNavPath & strNavLink & " " & PageTitle strHTML = Replace(strHTML, "{$PageTitle}", SiteTitle & " >> " & PageTitle) strHTML = Replace(strHTML, "{$ShowPath}", strNavPath) strHTML = Replace(strHTML, "{$MenuJS}", GetMenuJS("", False)) strHTML = Replace(strHTML, "{$Skin_CSS}", GetSkin_CSS(0)) Response.Write strHTML %>