<% '************************************************************************************************** ' 程序名称: 七禧舞曲管理系统 ' 程序作者: 花心萝卜 ' 官方网站: http://www.cmsdj.com http://www.7xiwl.com ' 编写日期: 2009年8月27日 ' 版权所有: 本程序由七禧网络开发,未经同意请勿用于商业用途 '************************************************************************************************** Function IsNum(Str) IF Not IsNul(Str) Then:IsNum=IsNumeric(Str):Else:IsNum=False:End IF End Function Function IsNul(Str) IF IsNull(Str) Or Str = "" Then:IsNul = True:Else :IsNul = False:End IF End Function Function ReplaceBadChar(strChar) If strChar="" Then ReplaceBadChar="" Else ReplaceBadChar=replace(replace(replace(replace(replace(replace(replace(strChar,"'",""),"*",""),"?",""),"(",""),")",""),"<",""),".","") End If End Function Function GetMyShop(GetName,l) if l="0" then Set RsMyShop=CmsDjShop.GetRs("SName",0,"ShopID="&GetName) elseif l="1" then Set RsMyShop=CmsDjShop.GetRs("SPic",0,"ShopID="&GetName) elseif l="2" then Set RsMyShop=CmsDjShop.GetRs("SHits",0,"ShopID="&GetName) elseif l="3" then Set RsMyShop=CmsDjShop.GetRs("SMoney",0,"ShopID="&GetName) elseif l="4" then Set RsMyShop=CmsDjShop.GetRs("SDir",0,"ShopID="&GetName) elseif l="5" then Set RsMyShop=CmsDjShop.GetRs("SClass",0,"ShopID="&GetName) end if If Not(RsMyShop.bof And RsMyShop.EOF) Then if l="0" then GetMyShop=RsMyShop("SName") if l="1" then PicUrl=LCase(RsMyShop("SPic")) if left(PicUrl,6)="upload" then GetMyShop=InstallDir&PicUrl else GetMyShop=PicUrl end if end if if l="2" then GetMyShop=RsMyShop("SHits") if l="3" then GetMyShop=RsMyShop("SMoney") if l="4" then PicUrl=LCase(RsMyShop("SDir")) if left(PicUrl,6)="upload" then GetMyShop=InstallDir&PicUrl else GetMyShop=PicUrl end if end if if l="5" then GetMyShop=RsMyShop("SClass") Else GetMyShop="未知" End If RsMyShop.close set RsMyShop=nothing End Function Function valid_ip(guest_ip) valid_ip=true dim ti,tdim,hn,aabb,ccdd hn=guest_ip tdim=split(CD_WebIp,"|") aabb=split(hn,".") for ti=0 to ubound(tdim) ccdd=split(tdim(ti),".") if ccdd(3)="*" then if ccdd(2)="*" and ccdd(3)="*" then if ccdd(1)="*" and ccdd(2)="*" and ccdd(3)="*" then hn=aabb(0)&".*.*.*" if instr(hn,tdim(ti))>0 then valid_ip=false:erase tdim:exit function else hn=aabb(0)&"."&aabb(1)&".*.*" if instr(hn,tdim(ti))>0 then valid_ip=false:erase tdim:exit function end if else hn=aabb(0)&"."&aabb(1)&"."&aabb(2)&".*" if instr(hn,tdim(ti))>0 then valid_ip=false:erase tdim:exit function end if else hn=aabb(0)&"."&aabb(1)&"."&aabb(2)&"."&aabb(3) if instr(hn,tdim(ti))>0 then valid_ip=false:erase tdim:exit function end if next erase tdim End Function Function GetData(GetName,l) Set CmsDjUser = New CmsDj_Com_User if l="0" then Set RsGetData=CmsDjArt.GetRs("Title",0,"ID="&GetName) '日志标题 elseif l="1" then Set RsGetData=CmsDjPic.GetRs("Title",0,"ID="&GetName) '相册标题 elseif l="2" then Set RsGetData=CmsDjMusic.GetRs("CD_Name",0,"CD_ID="&GetName) '歌曲标题 elseif l="3" then Set RsGetData=CmsDjArt.GetRs("Content",0,"ID="&GetName) '日志内容 elseif l="4" then Set RsGetData=CmsDjPic.GetRs("PicUrl",0,"ID="&GetName) '相册文件地址 elseif l="5" then Set RsGetData=CmsDjMusic.GetRs("CD_ClassID",0,"CD_ID="&GetName) '歌曲所属栏目 elseif l="6" then Set RsGetData=CmsDjSupply.GetRs("SupplyA",0,"SupplyID="&GetName) '供求标题 elseif l="7" then Set RsGetData=CmsDjUser.GetRs("UserSign",0,"UserID="&GetName) '会员个性签名 elseif l="8" then Set RsGetData=CmsDjUser.GetRs("NiCheng",0,"UserName='"&GetName&"'") '会员呢称 elseif l="9" then Set RsGetData=CmsDjUser.GetRs("QQ",0,"UserName='"&GetName&"'") '会员QQ elseif l="10" then Set RsGetData=CmsDjUser.GetRs("Whe,Address",0,"UserName='"&GetName&"'") '会员所在地 elseif l="11" then Set RsGetData=CmsDjUser.GetRs("Sex",0,"UserName='"&GetName&"'") '会员QQ end if If Not(RsGetData.bof And RsGetData.EOF) Then if l="0" then GetData=RsGetData("Title") if l="1" then GetData=RsGetData("Title") if l="2" then GetData=RsGetData("CD_Name") if l="3" then GetData=left(RemoveHTML(RsGetData("Content")),50) if l="4" then PicUrl=LCase(RsGetData("PicUrl")) if left(PicUrl,6)="upload" then GetData=InstallDir&PicUrl else GetData=PicUrl end if end if if l="5" then GetData=RsGetData("CD_ClassID") if l="6" then GetData=RsGetData("SupplyA") if l="7" then GetData=RsGetData("UserSign") if l="8" then GetData=RsGetData("NiCheng") if l="9" then GetData=RsGetData("QQ") if l="10" then GetData=RsGetData("Whe")&RsGetData("Address") if l="11" then GetData=RsGetData("Sex") Else GetData="未知" End If RsGetData.close set RsGetData=nothing End Function '===================================================== ' 描述: 读取会员ID ' 作者: 七禧网络 www.7xiwl.com,By:花心萝卜 ' 版权: 本程序由七禧网络开发,未经同意请勿用于商业用途 '===================================================== Function GetUserID(GetName) Set CmsDjUser = New CmsDj_Com_User Set RsUserID=CmsDjUser.GetRs("UserID",0,"UserName='"&GetName&"'") If Not(RsUserID.bof And RsUserID.EOF) Then UserID=RsUserID("UserID") Else UserID=0 End If GetUserID=UserID RsUserID.close set RsUserID=nothing End Function '===================================================== ' 描述: 读取会员名称/呢称/性别 ' 作者: 七禧网络 www.7xiwl.com,By:花心萝卜 ' 版权: 本程序由七禧网络开发,未经同意请勿用于商业用途 '===================================================== Function GetUserName(GetName,l) Set CmsDjUser = New CmsDj_Com_User if l="0" then Set RsUserName=CmsDjUser.GetRs("UserName",0,"UserID="&GetName) elseif l="1" then Set RsUserName=CmsDjUser.GetRs("NiCheng",0,"UserID="&GetName) elseif l="2" then Set RsUserName=CmsDjUser.GetRs("Sex",0,"UserID="&GetName) elseif l="3" then Set RsUserName=CmsDjUser.GetRs("Whe",0,"UserID="&GetName) end if If Not(RsUserName.bof And RsUserName.EOF) Then if l="0" then UserName=RsUserName("UserName") if l="1" then UserName=RsUserName("NiCheng") if l="2" then UserName=RsUserName("Sex") if l="3" then UserName=RsUserName("Whe") Else UserName="未知" End If GetUserName=UserName RsUserName.close set RsUserName=nothing End Function '===================================================== ' 描述: 读取会员头像 ' 作者: 七禧网络 www.7xiwl.com,By:花心萝卜 ' 版权: 本程序由七禧网络开发,未经同意请勿用于商业用途 '===================================================== Function GetUserPic(GetName,l) Set CmsDjUser = New CmsDj_Com_User if l="0" then Set RsUserPic=CmsDjUser.GetRs("UserPhoto",0,"UserID="&GetName) else Set RsUserPic=CmsDjUser.GetRs("UserPhoto",0,"UserName='"&GetName&"'") end if If Not(RsUserPic.bof And RsUserPic.EOF) Then UserPic=RsUserPic("UserPhoto") If UserPic<>"" Then UserPic=InstallDir&RsUserPic("UserPhoto") Else UserPic=InstallDir&"user/image/noavatar_small.gif" End If Else UserPic=InstallDir&"user/image/noavatar_small.gif" End If GetUserPic=UserPic RsUserPic.close set RsUserPic=nothing End Function Function FormatStrHtml(String) on Error resume next String = LCase(String) String = Replace(String, "asp", "html") String = Replace(String, "php", "html") String = Replace(String, "jsp", "html") String = Replace(String, "aspx", "html") String = Replace(String, "js", "html") FormatStrHtml = String End Function Function CmsDj_Com_Rank(rank,l) If (rank >= 0 and rank < 100) Then UserRankA="Lv1" UserRankB=FormatPercent(rank/100,2) UserRankC=100-rank ElseIf (rank >= 100 and rank < 200) Then UserRankA="Lv2" RankA=rank-100 UserRankB=FormatPercent(RankA/100,2) UserRankC=200-rank ElseIf (rank >= 200 and rank < 300) Then UserRankA="Lv3" RankA=rank-200 UserRankB=FormatPercent(RankA/100,2) UserRankC=300-rank ElseIf (rank >= 300 and rank < 400) Then UserRankA="Lv4" RankA=rank-300 UserRankB=FormatPercent(RankA/100,2) UserRankC=400-rank ElseIf (rank >= 400 and rank < 500) Then UserRankA="Lv5" RankA=rank-400 UserRankB=FormatPercent(RankA/100,2) UserRankC=500-rank ElseIf (rank >= 500 and rank < 600) Then UserRankA="Lv6" RankA=rank-500 UserRankB=FormatPercent(RankA/100,2) UserRankC=600-rank ElseIf (rank >= 600 and rank < 700) Then UserRankA="Lv7" RankA=rank-600 UserRankB=FormatPercent(RankA/100,2) UserRankC=700-rank ElseIf (rank >= 700 and rank < 800) Then UserRankA="Lv8" RankA=rank-700 UserRankB=FormatPercent(RankA/100,2) UserRankC=800-rank ElseIf (rank >= 800 and rank < 900) Then UserRankA="Lv9" RankA=rank-800 UserRankB=FormatPercent(RankA/100,2) UserRankC=900-rank ElseIf (rank >= 900 and rank < 1000) Then UserRankA="Lv10" RankA=rank-900 UserRankB=FormatPercent(RankA/100,2) UserRankC=1000-rank ElseIf (rank >= 1000) Then UserRankA="Lv10" RankA=rank-1000 UserRankB="100.00%" UserRankC="0" End If If UserRankB<"0" Then UserRankB=Replace(UserRankB,UserRankB,"0"&UserRankB) End If If l=2 Then CmsDj_Com_Rank=UserRankC ElseIf l=1 Then CmsDj_Com_Rank=UserRankB Else CmsDj_Com_Rank=UserRankA End If End Function Function GetNext(CD_ID,CD_Class,CD_Type) Dim RsNext Set CmsDjMusic = New CmsDj_Com_Dj IF CD_Class="u" Then set RsNext = CmsDjMusic.GetRs("CD_ID,CD_Name,CD_ClassID",1,"CD_ID<"&CD_ID&" and CD_Deleted=0 and CD_Passed=0 order by CD_ID desc") Else set RsNext = CmsDjMusic.GetRs("CD_ID,CD_Name,CD_ClassID",1,"CD_ID>"&CD_ID&" and CD_Deleted=0 and CD_Passed=0 order by CD_ID") End If IF RsNext.eof and RsNext.bof Then IF CD_Type=1 Then GetNext = "#" Else GetNext = "没有了" End If Else IF CD_Type=1 Then GetNext = LinkUrl("cmsdj_dj",RsNext(2),1,RsNext(0)) Else GetNext = RsNext(1) End If End If Set RsNext=Nothing End Function Function IsInteger(para) on error resume next dim str dim l,i if isNUll(para) then isInteger=false exit function end if str=cstr(para) if trim(str)="" then isInteger=false exit function end if l=len(str) for i=1 to l if mid(str,i,1)>"9" or mid(str,i,1)<"0" then isInteger=false exit function end if next isInteger=true if err.number<>0 then err.clear End Function Function ShowErr(Numb,Des) Put "
  出错了
  错误编号:"&Numb&"
  错误描述:"&Des&"

  去百度搜索错误问题
" Response.End End Function '============================== '把数字转换为文件大小显示方式 '============================== Public Function CmsDj_Com_Size(ByVal Size) If Size < 1024 Then CmsDj_Com_Size = Size&" 字节" ElseIf Size >= 1024 And Size < 1048576 Then CmsDj_Com_Size = FormatNumber(Size/1024,2)&" KB" ElseIf Size >= 1048576 Then CmsDj_Com_Size = FormatNumber((Size/1024)/1024,2)&" MB" End If End Function Function CmsDj_Com_Time(TimeTime) limit=DateDiff("s",TimeTime,Now()) if (limit < 5) then show_t = "刚刚" if (limit >= 5 and limit < 60) then show_t = limit &"秒前" if (limit >= 60 and limit < 3600) then show_t = INT(limit/60) &"分钟前" if (limit >= 3600 and limit < 86400) then show_t = INT(limit/3600) &"小时前" if (limit >= 86400 and limit < 2592000) then show_t = INT(limit/86400) &"天前" if (limit >= 2592000 and limit < 31104000) then show_t = INT(limit/2592000) &"个月前" 'if limit >= 31104000 then show_t = "很久前" if limit >= 31104000 then show_t = TimeTime CmsDj_Com_Time=show_t End Function Function StrLength(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 strLength=t else strLength=len(str) end if if err.number<>0 then err.clear End Function Function NullValue(Str) IF IsNul(Str) Then NullValue="未知" Else NullValue=Str End IF End Function Function DBC2SBC(str,flag) Dim i,str1,str2 IF len(str)<=0 Then Put "字符串参数出错" Exit Function End IF For i=1 To len(str) str1 = mid(str,i,1) str2 = asc(str1) IF str2>0 and str2<=125 Then IF not flag Then dbc2sbc=dbc2sbc & chr(str2-23680) Else dbc2sbc=dbc2sbc & chr(str2+23680) End IF Else dbc2sbc=dbc2sbc & str1 End IF Next End Function Function SafeRequest(Key,Modes) Dim ParaValue,strFilter,FilterArr,i Select Case Lcase(Modes) Case "get" ParaValue=LCase(Trim(Request.QueryString(Key))) Case "post" ParaValue=LCase(Trim(Request.Form(Key))) Case "auto" ParaValue=LCase(Trim(Request(Key))) End Select IF IsNum(ParaValue) Then SafeRequest=ParaValue Exit Function Else strFilter="'|and|(|)|exec|insert|select|delete|update|*|chr|mid|master|truncate|declare" FilterArr=Split(strFilter,"|") For i=0 To Ubound(FilterArr) IF Instr(ParaValue,FilterArr(i))>0 Then ParaValue=ReplaceStr(ParaValue,FilterArr(i),DBC2SBC(FilterArr(i),0)) End IF Next SafeRequest=ParaValue End IF SafeRequest = FilterScript(SafeRequest) End Function Function ScriptHtml(Byval ConStr,TagName,FType) Dim Re Set Re=new RegExp Re.IgnoreCase =true Re.Global=True Select Case FType Case 1 Re.Pattern="<" & TagName & "([^>])*>" ConStr=Re.Replace(ConStr,"") Case 2 Re.Pattern="<" & TagName & "([^>])*>.*?])*>" ConStr=Re.Replace(ConStr,"") Case 3 Re.Pattern="<" & TagName & "([^>])*>" ConStr=Re.Replace(ConStr,"") Re.Pattern="])*>" ConStr=Re.Replace(ConStr,"") Re.Pattern="<" & TagName & "([^>])*>" ConStr=Re.Replace(ConStr,"") Re.Pattern="</" & TagName & "([^>])*>" ConStr=Re.Replace(ConStr,"") End Select ScriptHtml=ConStr Set Re=Nothing End Function Function FilterScript(ConStr) ConStr=ScriptHtml(ConStr,"Iframe",1) ConStr=ScriptHtml(ConStr,"Object",2) ConStr=ScriptHtml(ConStr,"Script",2) 'ConStr=ScriptHtml(ConStr,"Font",3) 'ConStr=ScriptHtml(ConStr,"A",3) 'ConStr=ScriptHtml(ConStr,"Table",3) 'ConStr=ScriptHtml(ConStr,"Tr",3) 'ConStr=ScriptHtml(ConStr,"Td",3) 'ConStr=ScriptHtml(ConStr,"Div",3) 'ConStr=ScriptHtml(ConStr,"CLASS",3) 'ConStr=ScriptHtml(ConStr,"Span",3) 'ConStr=ScriptHtml(ConStr,"IMG",3) 'ConStr=ScriptHtml(ConStr,"strong",3) 'ConStr=ScriptHtml(ConStr,"p",3) ConStr=ScriptHtml(ConStr,"%",3) FilterScript=ConStr End Function Function ReplaceStr(Str,FindStr,RepStr) IF IsNull(RepStr) Then RepStr="" ReplaceStr = Replace(Str,FindStr,RepStr) End Function Function Params Dim Param,ParamArr,RegEx,Match,Matches Param=Request.ServerVariables("QUERY_STRING") Set RegEx =New RegExp RegEx.Pattern="([\S]+)\.\S+" RegEx.IgnoreCase=True RegEx.Global=True IF RegEx.Test(Param) Then Set Matches=RegEx.Execute(Param) For Each Match In Matches ParamArr=Match.SubMatches(0) Param=ParamArr Next ParamArr=Split(ParamARR,"_") IF IsArray(ParamArr) Then IF Ubound(ParamArr)=0 Then Param=Param&"_1" End IF End IF End IF Params=Param End Function Function GetStrByLen(ByVal strWord, ByVal NumByte, ByVal NumDot) Dim i Dim lenWordByte GetStrByLen = "" IF IsNull(strWord) or strWord = "" Then Exit Function lenWordByte = 0 For i = 1 to Len(strWord) IF Asc(Mid(strWord, i, 1)) < 0 or Asc(Mid(strWord, i, 1)) > 255 Then lenWordByte = lenWordByte + 2 Else lenWordByte = lenWordByte + 1 End IF IF lenWordByte > NumByte Then Exit For GetStrByLen = GetStrByLen & Mid(strWord, i, 1) Next GetStrByLen = GetStrByLen & String(NumDot, ".") End Function Function CheckArray(arr1,arr2) CheckArray = True IF IsArray(arr1) And IsArray(arr2) Then IF Ubound(arr1)<>Ubound(arr2) Then CheckArray = False End IF Else CheckArray = False End IF End Function Function RemoveHTML(strHTML) Dim objRegExp, Match, Matches Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True objRegExp.Pattern = "<.+?>" Set Matches = objRegExp.Execute(strHTML) For Each Match in Matches strHtml=Replace(strHTML,Match.Value,"") Next 'strHTML = Replace(strHTML,"<","<") 'strHTML = Replace(strHTML,">",">") strHTML = Replace(strHTML,""","""") strHTML = Replace(strHTML," "," ") strHTML = Replace(strHTML,"&","&") strHTML = Replace(strHTML,"‘","“") strHTML = Replace(strHTML,"’","”") RemoveHTML=strHTML Set objRegExp = Nothing End Function Function PermissionDis(HavePermission,Column) Dim HavePermissionArray IF HavePermission<>"" And Isnumeric(Column) Then HavePermissionArray=Split(HavePermission,",") For I=0 To Ubound(HavePermissionArray) IF Trim(HavePermissionArray(I))=Trim(Column) Then Response.Write("checked") Exit For End IF Next End IF End Function Function UrlSelectCom(Byval url,Byval list,Byval ID) Dim ListStr,I,Selected,J ListStr = "" IF Not IsNum(ID) Then ID = 0 IF isArray(List) Then For I = 0 To Ubound(List,2) IF Int(List(0,i)) = int(ID) Then selected = "selected":End IF IF List(4,i)="0" Then ListStr = ListStr & "" For J=0 To Ubound(List,2) IF List(0,i) = List(4,j) Then listStr = listStr & "" End IF Next End IF Selected = "" Next End IF UrlSelectCom = ListStr End Function Function UrlSelectComT(Byval url,Byval list,Byval ID) Dim ListStr,I,Selected,J ListStr = "" IF Not IsNum(ID) Then ID = 0 IF isArray(List) Then For I = 0 To Ubound(List,2) IF Int(List(0,i)) = int(ID) Then selected = "selected":End IF ListStr = ListStr & "" Selected = "" Next End IF UrlSelectComT = ListStr End Function Public Function GetClassName(ct,id) Dim i GetClassName = "暂无分类" IF isArray(ct) Then For i = 0 To ubound(ct,2) IF Int(ct(0,i)) = Int(id) Then GetClassName = ct(1,i):End IF Next End IF End Function Function SpanShow(Table,ClassID,SystemID,ID,Url) IF S_Webmode=1 Then Exit Function SpanShow="" '判断是否已生成 IF Fso.CheckFile(LinkUrl(Table,ClassID,SystemID,ID)) Then SpanShow="" End Function Function SelectFormGet(Byval MRval,Byval List,Byval ID) Dim ListStr,i,selected IF Not IsNum(ID) Then ID=0 ListStr = "" IF isArray(List) Then For i = 0 To ubound(List,2) IF List(0,i) = Cint(ID) Then selected = "selected" listStr = listStr & "" selected = "" Next End IF SelectFormGet = ListStr End Function Function SelectFormGetB(Byval MRval,Byval List,Byval ID) Dim ListStr,i,selected,j IF Not IsNum(ID) Then ID=0 ListStr = "" IF isArray(List) Then For i = 0 To ubound(List,2) IF List(0,i) = Cint(ID) Then selected = "selected" IF List(4,i)=0 Then listStr = listStr & "" For j=0 To Ubound(List,2) IF List(0,i) = List(4,j) Then listStr = listStr & "" End IF Next End IF selected = "" Next End IF SelectFormGetB = ListStr End Function Function IsObjInstalled(strClassString) On Error Resume Next IsObjInstalled = False Err = 0 Dim xTestObj Set xTestObj = Server.CreateObject(strClassString) IF 0 = Err Then IsObjInstalled = True Set xTestObj = Nothing Err = 0 End Function Function NumToAbc(str) str = str str = replace(str,"0","ling") str = replace(str,"1","yi") str = replace(str,"2","er") str = replace(str,"3","san") str = replace(str,"4","si") str = replace(str,"5","wu") str = replace(str,"6","liu") str = replace(str,"7","qi") str = replace(str,"8","ba") str = replace(str,"9","jiu") NumToAbc = str End Function Function CheckHtml(Str,SystemID) IF CD_WebHtml=2 Then Set Fs = Server.CreateObject("Scripting.FileSystemObject") StrDir = Server.MapPath(Str) IF Fs.FileExists(StrDir) Then CheckHtml="未生成" Else CheckHtml="已生成" End IF Else CheckHtml="动态" End IF End Function Function LinkURL(Table,ClassID,SystemID,ID) Dim ZFileName,HName Table=LCase(Table) Select Case CD_WebHtml Case "1" Select Case LCase(Table) Case "cmsdj_dj" LinkURL=InstallDir&"html/index.asp?1,"&ID Case "cmsdj_special" LinkURL=InstallDir&"html/index.asp?2,"&ID Case "cmsdj_news" LinkURL=InstallDir&"html/index.asp?3,"&ID End Select Case "2" Select Case Table Case "cmsdj_dj" CD_PlayPath=replace(CD_Caplayfolder,"[数字编号]",ID) CD_PlayPath=replace(CD_PlayPath,"[字母编号]",NumToAbc(ID)) LinkURL=CD_PlayPath Case "cmsdj_special" CD_SpecialPath=replace(CD_Caspecialfolder,"[数字编号]",ID) CD_SpecialPath=replace(CD_SpecialPath,"[字母编号]",NumToAbc(ID)) LinkURL=CD_SpecialPath Case "cmsdj_news" CD_NewsPath=replace(CD_CaNewsfolder,"[数字编号]",ID) CD_NewsPath=replace(CD_NewsPath,"[字母编号]",NumToAbc(ID)) LinkURL=CD_NewsPath End Select Case "3" Select Case LCase(Table) Case "cmsdj_dj" LinkURL=InstallDir&"html/?1,"&ID&".html" Case "cmsdj_special" LinkURL=InstallDir&"html/?2,"&ID&".html" Case "cmsdj_news" LinkURL=InstallDir&"html/?3,"&ID&".html" End Select End Select End Function Function LinkWebURL(UserID,UserName) WebHtml=0 IF UserID=0 Then LinkWebURL="http:///" Else Select Case WebHtml Case "0" LinkWebURL="http://"&Request.ServerVariables("SERVER_NAME")&InstallDir&"Web/?id="&UserID Case "1" LinkWebURL="http://"&Replace(CD_WebUrl,"www",UserID) Case "2" LinkWebURL="http://"&Replace(CD_WebUrl,"www",UserName) End Select End IF End Function Function LinkClassURL(Table,ID,SystemID,Page) Set CmsDjClass = New CmsDj_Com_DjClass Set Rs = CmsDjClass.GetRs("",0,"CD_ID="&ID) If Not(rs.bof And rs.EOF) Then CD_AliasName=Rs("CD_AliasName") End IF IF SystemID=1 Then Select Case CD_WebHtml Case "1" LinkClassURL=InstallDir&"html/index.asp?0,"&ID&","&Page&"" Case "2" CD_ClassPath=replace(CD_Calistfolder,"[英文别名]",CD_AliasName) CD_ClassPath=replace(CD_ClassPath,"[栏目编号]",ID) CD_ClassPath=replace(CD_ClassPath,"[分页编号]",Page) LinkClassURL=CD_ClassPath Case "3" LinkClassURL=InstallDir&"html/?0,"&ID&","&Page&".html" End Select ElseIF SystemID=0 Then Select Case CD_WebHtml Case "1" LinkClassURL=InstallDir&"html/index.asp?4,"&ID&","&Page&"" Case "2" CD_NewsPath=replace(CD_Canewscfolder,"[栏目编号]",ID) CD_NewsPath=replace(CD_NewsPath,"[分页编号]",Page) LinkClassURL=CD_NewsPath Case "3" LinkClassURL=InstallDir&"html/?4,"&ID&","&Page&".html" End Select Else LinkClassURL=CD_AliasName End IF End Function Function LinkFeedURL(FeedA,Rs) Select Case FeedA Case "0" LinkFeedURL=LinkFeedURL&"将 "&GetUserName(rs("FeedB"),0)&" 添加为好友 "& VbCrLf Case "1" LinkFeedURL=LinkFeedURL&"发表了新日志 "& VbCrLf Case "2" LinkFeedURL=LinkFeedURL&"上传了新图片 "&GetData(rs("FeedB"),1)&" "& VbCrLf Case "3" LinkFeedURL=LinkFeedURL&"开通了个人主页 访问TA的空间 "& VbCrLf Case "4" LinkFeedURL=LinkFeedURL&"收藏了音乐 "& VbCrLf Case "5" LinkFeedURL=LinkFeedURL&"评论了 "&GetUserName(rs("FeedC"),0)&" 的日志 "&GetData(rs("FeedB"),0)&" "& VbCrLf Case "6" LinkFeedURL=LinkFeedURL&"评论了 "&GetUserName(rs("FeedC"),0)&" 的相册 "&GetData(rs("FeedB"),1)&" "& VbCrLf Case "7" LinkFeedURL=LinkFeedURL&"访问了 "&GetUserName(rs("FeedB"),0)&" 的空间 "& VbCrLf Case "8" LinkFeedURL=LinkFeedURL&"下载了音乐 "& VbCrLf Case "9" LinkFeedURL=LinkFeedURL&"购买了 "&rs("FeedB")&" 点数 "& VbCrLf Case "10" LinkFeedURL=LinkFeedURL&"升级为VIP会员 "& VbCrLf Case "11" LinkFeedURL=LinkFeedURL&"发布了新的"&rs("FeedD")&"信息 "& VbCrLf Case "13" LinkFeedURL=LinkFeedURL&"上传了新音乐 "& VbCrLf End Select LinkFeedURL=LinkFeedURL&""&CmsDj_Com_Time(rs("FeedE"))&""& VbCrLf LinkFeedURL=LinkFeedURL&"
"& VbCrLf Select Case FeedA Case "1" LinkFeedURL=LinkFeedURL&"
"&GetData(rs("FeedB"),0)&"
"&GetData(rs("FeedB"),3)&"
"& VbCrLf Case "2" LinkFeedURL=LinkFeedURL&""& VbCrLf Case "4" LinkFeedURL=LinkFeedURL&"
"&GetData(rs("FeedB"),2)&"
"& VbCrLf Case "8" LinkFeedURL=LinkFeedURL&"
"&GetData(rs("FeedB"),2)&"
"& VbCrLf Case "11" LinkFeedURL=LinkFeedURL&"
"&GetData(rs("FeedB"),6)&"
"& VbCrLf Case "13" LinkFeedURL=LinkFeedURL&"
"&GetData(rs("FeedB"),2)&"
"& VbCrLf End Select End Function Function GetAttr(Byval Arr,Byval ID,Byval Seat) Dim K GetAttr="" IF IsArray(Arr) Then For K=0 To Ubound(Arr,2) IF Cint(ID)=Cint(Arr(0,K)) Then GetAttr=Arr(Seat,K):Exit Function End IF Next End IF IF IsNul(GetAttr) Then GetAttr=Arr(Seat,0) End Function Sub Echo(Str) Response.Write(Str):Response.Flush() End Sub Sub Put(Str) Echo Str:Response.End() End Sub Sub Fetch() WebAll=SafeRequest("WebAll","auto") ClassAll=SafeRequest("ClassAll","auto") Sel=SafeRequest("Sel","auto") Page=SafeRequest("Page","auto") ClassID=SafeRequest("ClassID","auto") IF IsNul(WebAll) Then WebAll=False IF IsNul(ClassAll) Then ClassAll=False IF IsNul(Sel) Then Sel=False IF Not IsNum(Page) Then Page=1 IF Not IsNum(ClassID) Then:ClassID=0:End IF End Sub Sub SpanGo() Echo "
暂停"&CD_StopTime&"秒后继续生成" End Sub Sub setStartTime() Dim StartTime StartTime=timer() Session("StartTime")=StartTime End Sub Sub GetRunTime() Dim EndTime,StartTime StartTime=Session("StartTime") EndTime=timer() Echo FormatNumber((EndTime-StartTime),3) End Sub Function GetHttpPage(HttpUrl,bm) If IsNull(HttpUrl)=True Or HttpUrl="$False$" Then GetHttpPage="$False$" Exit Function End If Dim Http Set Http=server.createobject("MSXML2.XMLHTTP") Http.open "GET",HttpUrl,False Http.Send() If Http.Readystate<>4 then Set Http=Nothing GetHttpPage="$False$" Exit function End if GetHTTPPage=bytesToBSTR(Http.responseBody,bm) 'GetHTTPPage=bytesToBSTR(Http.responseBody,"gb2312") Set Http=Nothing If Err.number<>0 then Err.Clear End If End Function Function BytesToBstr(Body,Cset) Dim Objstream Set Objstream = Server.CreateObject("adodb.stream") objstream.Type = 1 objstream.Mode =3 objstream.Open objstream.Write body objstream.Position = 0 objstream.Type = 2 objstream.Charset = Cset BytesToBstr = objstream.ReadText objstream.Close set objstream = nothing End Function Function GetBody(ConStr,StartStr,OverStr,IncluL,IncluR) If ConStr="$False$" or ConStr="" or IsNull(ConStr)=True Or StartStr="" or IsNull(StartStr)=True Or OverStr="" or IsNull(OverStr)=True Then GetBody="$False$" Exit Function End If Dim ConStrTemp Dim Start,Over ConStrTemp=Lcase(ConStr) StartStr=Lcase(StartStr) OverStr=Lcase(OverStr) Start = InStrB(1, ConStrTemp, StartStr, vbBinaryCompare) If Start<=0 then GetBody="$False$" Exit Function Else If IncluL=False Then Start=Start+LenB(StartStr) End If End If Over=InStrB(Start,ConStrTemp,OverStr,vbBinaryCompare) If Over<=0 Or Over<=Start then GetBody="$False$" Exit Function Else If IncluR=True Then Over=Over+LenB(OverStr) End If End If GetBody=MidB(ConStr,Start,Over-Start) End Function Class CmsDj_Com_Cache Public ReloadTime,CD_CacheMark Private CacheValue Private Sub Class_Initialize() ReloadTime = CD_Cachetime CD_CacheMark = CD_CacheMark End Sub Public Function GetCache(MyCacheName) IF IsNull(MyCacheName) OR MyCacheName = "" Then GetCache = "" Else IF CheckCache(MyCacheName) = True Then GetCache = "" Else CacheValue = Application(CD_CacheMark & MyCacheName) IF Not IsArray(CacheValue) Then GetCache = "" Else GetCache = CacheValue(0) End IF End IF End IF End Function Public Sub SetCache(MyCacheName, CacheValue) Dim CacheData IF IsNull(MyCacheName) OR MyCacheName = "" Then Err.Raise vbObjectErrOR + 1, "缓存错误", "请检查缓存名是否正确!!!" Else CacheData = Application(CD_CacheMark & MyCacheName) IF Not IsArray(CacheData) Then ReDim CacheData(2) CacheData(0) = CacheValue CacheData(1) = Now() Application.Lock Application(CD_CacheMark & MyCacheName) = CacheData Application.UnLock End IF End Sub Public Function CheckCache(MyCacheName) CheckCache = True CacheValue = Application(CD_CacheMark & MyCacheName) IF Not IsArray(CacheValue) Then Exit Function IF Not IsDate(CacheValue(1)) Then Exit Function IF DateDiff("s", CDate(CacheValue(1)), Now()) < 60 * Reloadtime Then CheckCache = False End IF End Function Public Sub DelCache(MyCacheName) Application.Lock Application(CD_CacheMark & MyCacheName) = Empty Application.unLock End Sub Public Sub ReMoveAll() Application.Lock() Application.Contents.ReMoveAll() Application.UnLock() End Sub Public Sub ShowCache() Dim I Echo "缓存对象列表:
" For Each I In Application.Contents Echo I&"
" Next End Sub End Class Dim Cache Set Cache=New CmsDj_Com_Cache Class CmsDj_Com_Fso Private objFSO,fileFSO Private bInit Public bMapPath Public FSO_str Private Sub Class_Initialize bInit=False bMapPath=True FSO_str="Scripting.FileSystemObject" End Sub Private Sub Class_terminate() IF(bInit) Then Set objFSO=Nothing bInit=False End IF End Sub Public Function CreateObj() IF bInit=True Then exit function:End IF IF Err Then err.clear:End IF Set objFSO = Server.CreateObject(FSO_str) IF err Then err.clear bInit=False Set objFSO=Nothing Else bInit=True End IF CreateObj = bInit End Function Public Function CreateFolder(fldr) on error resume next Dim fsoa, f Set fsoa = CreateObject("Scripting.FileSystemObject") Set f = fsoa.CreateFolder(Server.MapPath(fldr)) CreateFolder = f.Path Set f=nothing Set fsoa=nothing End Function Public Function CheckDir(dir_str) IF bInit=False Then CreateObj():End IF IF Err Then err.clear:End IF IF bMapPath Then dir_str = Server.MapPath(dir_str):End IF IF objFSO.FolderExists(dir_str) Then CheckDir=True Else CheckDir=False End IF End Function Public Function DeleteDir(dir_str) IF bInit=False Then CreateObj():End IF IF Err Then err.clear:End IF On Error Resume Next IF bMapPath Then dir_str=Server.MapPath(dir_str):End IF IF objFSO.FolderExists(dir_str) Then objFSO.DeleteFolder(dir_str) End IF IF err Then DeleteDir=False Else DeleteDir=True End IF End Function Public Function CreateDir(dir_str) Dim dirArr,dir,dirOld,i,dirweb,ReadGo ReadGo=0 IF bInit=False Then CreateObj():End IF IF Err Then err.clear:End IF IF bMapPath Then dir_str = Server.MapPath(dir_str):End IF dirArr = split(dir_str,"\") dirOld="" dirweb=Server.MapPath(InstallDir)&"\" For i=lBound(dirArr) To uBound(dirArr) dir = dirArr(i) dirOld=dirOld&dir IF right(dirOld,1) <>"\" Then dirOld=dirOld&"\" IF dirweb=dirOld Then ReadGo=1 End IF IF ReadGo=1 Then IF objFSO.FolderExists(dirOld)<>True Then:objFSO.CreateFolder(dirOld):End IF End IF Next IF Err Then CreateDir=False Else CreateDir=True End IF End Function Public Function MoveDir(dir_old,dir_new) Dim f,i,pos,b IF bInit=False Then CreateObj():End IF IF Err Then err.clear:End IF f=dir_old IF bMapPath Then dir_old=server.MapPath(dir_old):End IF IF bMapPath Then dir_new=server.MapPath(dir_new):End IF i=1 Do While instr(i,dir_new,"\") pos=instr(i,dir_new,"\") i=i+1 Loop b = bMapPath bMapPath=False CreateDir(left(dir_new,pos)) bMapPath=b IF CheckDir(f) Then objFSO.MoveFolder dir_old, dir_new IF Err Then MoveDir=False Else MoveDir=True End IF Else MoveDir=False End IF End Function Public Function CheckFile(file_str) IF bInit=false Then:CreateObj():End IF IF Err Then err.clear:End IF IF bMapPath Then file_str=Server.MapPath(file_str):End IF IF objFSO.FileExists(file_str) Then CheckFile=true else CheckFile=false End IF End Function Public Function DeleteFile(file_str) IF bInit=False Then CreateObj():End IF IF Err Then err.clear:End IF On Error Resume Next IF bMapPath Then file_str=Server.MapPath(file_str):End IF IF objFSO.FileExists(file_str) Then objFSO.DeleteFile(file_str) End IF IF Err Then DeleteFile=False ShowErr Err.Number,Err.Description Else DeleteFile=True End IF End Function Public Function CreateFile(file_str,bCover,html_str) Dim dir,i,b,pos IF bInit=False Then CreateObj():End IF IF Err Then err.clear:End IF bMapPath=True IF bMapPath Then file_str=Server.MapPath(file_str):End IF IF bMapPath=False Then file_str=replace(file_str,"/","\"):End IF i=1 Do While instr(i,file_str,"\") pos=instr(i,file_str,"\") i=i+1 Loop b = bMapPath bMapPath=False CreateDir(left(file_str,pos)) bMapPath=b IF objFSO.FileExists(file_str) And bCover=False Then exit Function End IF Set fileFSO=objFSO.CreateTextFile(file_str,True) fileFSO.WriteLine(html_str) fileFSO.close Set fileFSO=Nothing IF Err Then CreateFile=False Else CreateFile=True End IF End Function Public Function ReadFile(file_str) Dim b IF bInit=False Then CreateObj():End IF IF Err Then err.clear:End IF bMapPath=True IF bMapPath Then file_str=Server.MapPath(file_str):End IF b=bMapPath bMapPath=False IF CheckFile(file_str) Then On Error Resume Next Set fileFSO=objFSO.OpenTextFile(file_str,1) ReadFile = fileFSO.ReadAll Set fileFSO=Nothing IF Err Then ReadFile="" End IF Else ReadFile="



错误:模板不存在,请检查!
" End IF End Function Public Function CopyFile(file_old,file_new) Dim f,i,pos,b IF bInit=False Then CreateObj():End IF IF Err Then err.clear:End IF f=file_old IF bMapPath Then file_old=server.MapPath(file_old):End IF IF bMapPath Then file_new=server.MapPath(file_new):End IF i=1 Do While instr(i,file_new,"\") pos=instr(i,file_new,"\") i=i+1 Loop b = bMapPath bMapPath=False CreateDir(left(file_new,pos)) bMapPath=b IF CheckFile(f) Then objFSO.CopyFile file_old, file_new IF Err Then CopyFile=False Else CopyFile=True End IF Else CopyFile=False End IF End Function Function GetFolderList(Byval cDir) Dim i,objFolder,objSubFolders,filePath,objSubFolder IF bInit=False Then CreateObj():End IF IF Err Then err.clear:End IF i = 0 ReDim folderList(0) filePath = server.mapPath(cDir) Set objFolder=objFSO.GetFolder(filePath) Set objSubFolders=objFolder.Subfolders For each objSubFolder in objSubFolders ReDim Preserve folderList(i) With objSubFolder folderList(i) = .name & ",文件夹," & .size/1000 & " KB," & .DateLastModified & "," & cDir & "/" & .name End With i = i + 1 Next Set objFolder=Nothing Set objSubFolders=Nothing getFolderList = folderList End Function Function GetFileList(Byval cDir) Dim filePath,objFolder,objFile,objFiles,i i = 0 Redim fileList(0) filePath = server.mapPath(cDir) Set objFolder=objFSO.GetFolder(filePath) Set objFiles=objFolder.Files For each objFile in objFiles ReDim Preserve fileList(i) With objFile fileList(i) = .name & "," & Lcase(Mid(.name, InStrRev(.name, ".") + 1)) & "," & .size/1000 & " KB," & .DateLastModified & "," & cDir & "/" & .name End With i = i + 1 Next Set objFiles=Nothing Set objFolder=Nothing getFileList = fileList End Function End Class Dim Fso Set Fso= New CmsDj_Com_Fso %>