|
发表于 2006-10-3 00:03:55
|
显示全部楼层
") HtmlContent = tmpstr(1, 0) If CInt(Html_Setting(0)) <> 0 Then HtmlContent = HtmlTop & HtmlContent & HtmlFoot End If HtmlContent = Replace(HtmlContent, "{$Style_CSS}", HtmlCss) HtmlContent = Replace(HtmlContent, "{$SkinPath}", SkinPath) HtmlContent = Replace(HtmlContent, "{$Width}", Main_Setting(0)) HtmlContent = Replace(HtmlContent, "{$ChannelMenu}", ChannelMenu) HtmlContent = Replace(HtmlContent, "{$WebSiteName}", SiteName) HtmlContent = Replace(HtmlContent, "{$WebSiteUrl}", SiteUrl) HtmlContent = Replace(HtmlContent, "{$MasterMail}", MasterMail) HtmlContent = Replace(HtmlContent, "{$Keyword}", keywords) HtmlContent = Replace(HtmlContent, "{$Copyright}", Copyright) HtmlContent = Replace(HtmlContent, "{$IndexName}", IndexName) HtmlContent = Replace(HtmlContent, "{$Version}", "") HtmlContent = HtmlContent End Property Public Property Get ByValue() ByValue = HtmlContent End Property Public Property Let HTMLValue(ByVal vNewValue) Dim TempStr TempStr = vNewValue TempStr = Replace(TempStr, "{$Style_CSS}", HtmlCss) TempStr = Replace(TempStr, "{$SkinPath}", SkinPath) TempStr = Replace(TempStr, "{$Width}", Main_Setting(0)) TempStr = Replace(TempStr, "{$ChannelMenu}", ChannelMenu) TempStr = Replace(TempStr, "{$WebSiteName}", SiteName) TempStr = Replace(TempStr, "{$WebSiteUrl}", SiteUrl) TempStr = Replace(TempStr, "{$MasterMail}", MasterMail) TempStr = Replace(TempStr, "{$Keyword}", keywords) TempStr = Replace(TempStr, "{$Copyright}", Copyright) TempStr = Replace(TempStr, "{$IndexName}", IndexName) TempStr = Replace(TempStr, "{$Version}", "") sHtmlContent = TempStr End Property Public Property Get HTMLValue() HTMLValue = sHtmlContent End Property Public Property Get HtmlSetting(n) HtmlSetting = Html_Setting(n) End Property Public Property Get MainSetting(n) MainSetting = Main_Setting(n) End Property '================================================ '过程名:GetSiteUrl '作 用:取得带端口的URL '================================================ Public Property Get GetSiteUrl() If Request.ServerVariables("SERVER_PORT") = "80" Then GetSiteUrl = "http://" & Request.ServerVariables("server_name") Else GetSiteUrl = "http://" & Request.ServerVariables("server_name") & ":" & Request.ServerVariables("SERVER_PORT") End If End Property '================================================ '函数名:FormEncode '作 用:过虑提交的表单数据 '参 数:str ----原字符串 n ----字符长度 '================================================ Public Function FormEncode(ByVal str, ByVal n) If Not IsNull(str) And Trim(str) <> "" Then str = Left(str, n) str = Replace(str, ">", ">") str = Replace(str, "<", "<") str = Replace(str, ">", ">") str = Replace(str, "<", "<") str = Replace(str, "'", "'") str = Replace(str, Chr(34), """) str = Replace(str, "%", "%") str = Replace(str, vbNewLine, "") FormEncode = Trim(str) Else FormEncode = "" End If End Function '================================================ '函数名:ChkKeyWord '作 用:过滤关键字 '参 数:keyword ----关键字 '================================================ Public Function ChkKeyWord(ByVal keyword) Dim FobWords, i On Error Resume Next FobWords = Array(91, 92, 304, 305, 430, 431, 437, 438, 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472, 12473, 12474, 12475, 12476, 12477, 12478, 12479, 12480, 12481, 12482, 12483, 12485, 12486, 12487, 12488, 12489, 12490, 12496, 12497, 12498, 12499, 12500, 12501, 12502, 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12521, 12532, 12533, 65339, 65340) For i = 1 To UBound(FobWords, 1) If InStr(keyword, ChrW(FobWords(i))) > 0 Then keyword = Replace(keyword, ChrW(FobWords(i)), "") End If Next keyword = Left(keyword, 100) FobWords = Array("~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "=", "`", "[", "]", "{", "}", ";", ":", """", "'", ",", "<", ">", ".", "/", "\", "?", "_") For i = 0 To UBound(FobWords, 1) If InStr(keyword, FobWords(i)) > 0 Then keyword = Replace(keyword, FobWords(i), "") End If Next ChkKeyWord = keyword End Function '================================================ '函数名:JAPEncode '作 用:日文片假名编码 '参 数:str ----原字符 '================================================ Public Function JAPEncode(ByVal str) Dim FobWords, i On Error Resume Next If IsNull(str) Or Trim(str) = "" Then JAPEncode = "" Exit Function End If FobWords = Array(92, 304, 305, 430, 431, 437, 438, 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472, 12473, 12474, 12475, 12476, 12477, 12478, 12479, 12480, 12481, 12482, 12483, 12485, 12486, 12487, 12488, 12489, 12490, 12496, 12497, 12498, 12499, 12500, 12501, 12502, 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12521, 12532, 12533, 65340) For i = 1 To UBound(FobWords, 1) If InStr(str, ChrW(FobWords(i))) > 0 Then str = Replace(str, ChrW(FobWords(i)), "" & FobWords(i) & ";") End If Next JAPEncode = str End Function '================================================ '函数名:JAPUncode '作 用:日文片假名解码 '参 数:str ----原字符 '================================================ Public Function JAPUncode(ByVal str) Dim FobWords, i On Error Resume Next If IsNull(str) Or Trim(str) = "" Then JAPUncode = "" Exit Function End If FobWords = Array(92, 304, 305, 430, 431, 437, 438, 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472, 12473, 12474, 12475, 12476, 12477, 12478, 12479, 12480, 12481, 12482, 12483, 12485, 12486, 12487, 12488, 12489, 12490, 12496, 12497, 12498, 12499, 12500, 12501, 12502, 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12521, 12532, 12533, 65340) For i = 1 To UBound(FobWords, 1) If InStr(str, "" & FobWords(i) & ";") > 0 Then str = Replace(str, "" & FobWords(i) & ";", ChrW(FobWords(i))) End If Next str = Replace(str, Chr(0), "") str = Replace(str, "'", "''") JAPUncode = str End Function '============================================================= '函数作用:带脏话过滤 '============================================================= Public Function ChkBadWords(ByVal str) If IsNull(str) Then Exit Function Dim i, Bwords, Bwordr Bwords = Split(Badwords, "|") Bwordr = Split(Badwordr, "|") For i = 0 To UBound(Bwords) If i > UBound(Bwordr) Then str = Replace(str, Bwords(i), "*") Else str = Replace(str, Bwords(i), Bwordr(i)) End If Next ChkBadWords = str End Function '============================================================= '函数作用:过滤HTML代码,带脏话过滤 '============================================================= Public Function HTMLEncode(ByVal fString) If Not IsNull(fString) Then 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, " ", " ") fString = Replace(fString, Chr(10), "<br /> ") fString = ChkBadWords(fString) HTMLEncode = fString End If End Function '============================================================= '函数作用:过滤HTML代码,不带脏话过滤 '============================================================= Public Function HTMLEncodes(ByVal fString) If Not IsNull(fString) Then fString = Replace(fString, "'", "'") 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), "<br /> ") fString = Replace(fString, " ", " ") HTMLEncodes = fString End If End Function '============================================================= '函数作用:判断发言是否来自外部 '============================================================= Public Function CheckPost() On Error Resume Next Dim server_v1, server_v2 CheckPost = False server_v1 = CStr(Request.ServerVariables("HTTP_REFERER")) server_v2 = CStr(Request.ServerVariables("SERVER_NAME")) If Mid(server_v1, 8, Len(server_v2)) = server_v2 Then CheckPost = True End If End Function '============================================================= '函数作用:判断来源URL是否来自外部 '============================================================= Public Function CheckOuterUrl() On Error Resume Next Dim server_v1, server_v2 server_v1 = Replace(LCase(Trim(Request.ServerVariables("HTTP_REFERER"))), "http://", "") server_v2 = LCase(Trim(Request.ServerVariables("SERVER_NAME"))) If server_v1 <> "" And Left(server_v1, Len(server_v2)) <> server_v2 Then CheckOuterUrl = False Else CheckOuterUrl = True End If End Function '================================================ '函数名:GotTopic '作 用:显示字符串长度 '参 数:str ----原字符串 ' strlen ----显示字符长度 '================================================ Public Function GotTopic(ByVal str, ByVal strLen) Dim l, t, c, i Dim strTemp On Error Resume Next str = Trim(str) str = Replace(str, " ", " ") str = Replace(str, ">", ">") str = Replace(str, "<", "<") str = Replace(str, ">", ">") str = Replace(str, "<", "<") str = Replace(str, "'", "'") str = Replace(str, """, Chr(34)) str = Replace(str, vbNewLine, "") l = Len(str) t = 0 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 Else strTemp = str & " " End If Next GotTopic = CheckTopic(strTemp) End Function Public Function CheckTopic(ByVal strContent) Dim re On Error Resume Next Set re = New RegExp re.IgnoreCase = True re.Global = True re.Pattern = "(<s+cript(.+?)<\/s+cript>)" strContent = re.Replace(strContent, "") re.Pattern = "(<iframe(.+?)<\/iframe>)" strContent = re.Replace(strContent, "") re.Pattern = "(>)" strContent = re.Replace(strContent, ">") re.Pattern = "(<)" strContent = re.Replace(strContent, "<") Set re = Nothing strContent = Replace(strContent, ">", ">") strContent = Replace(strContent, "<", "<") strContent = Replace(strContent, "'", "'") strContent = Replace(strContent, Chr(34), """) strContent = Replace(strContent, "%", "%") strContent = Replace(strContent, vbNewLine, "") CheckTopic = Trim(strContent) End Function '================================================ '函数名:ReadTopic '作 用:显示字符串长度 '参 数:str ----原字符串 ' strlen ----显示字符长度 '================================================ Public Function ReadTopic(ByVal str, ByVal strLen) Dim l, t, c, i On Error Resume Next str = Replace(str, " ", " ") If Len(str) < strLen Then str = str & String(strLen - Len(str), ".") Else str = str End If l = Len(str) t = 0 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 ReadTopic = Left(str, i) & "..." Exit For Else ReadTopic = str & "..." End If Next End Function '================================================ '函数名:strLength '作 用:计字符串长度 '参 数:str ----字符串 '================================================ Public Function strLength(ByVal str) On Error Resume Next If IsNull(str) Or str = "" Then strLength = 0 Exit Function End If Dim WINNT_CHINESE WINNT_CHINESE = (Len("例子") = 2) If WINNT_CHINESE Then Dim l, t Dim i, c l = Len(str) t = l For i = 1 To l c = Asc(Mid(str, i, 1)) If c < 0 Then c = c + 65536 If c > 255 Then t = t + 1 Next strLength = t Else strLength = Len(str) End If End Function '================================================= '函数名:isInteger '作 用:判断数字是否整型 '参 数:para ----参数 '================================================= Public Function isInteger(ByVal 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 Public Function CutString(ByVal str, ByVal strLen) On Error Resume Next
Dim HtmlStr, l, re, strContent
HtmlStr = str HtmlStr = Replace(HtmlStr, " ", " ") HtmlStr = Replace(HtmlStr, """, Chr(34)) HtmlStr = Replace(HtmlStr, "'", Chr(39)) HtmlStr = Replace(HtmlStr, "{", Chr(123)) HtmlStr = Replace(HtmlStr, "}", Chr(125)) HtmlStr = Replace(HtmlStr, "$", Chr(36)) HtmlStr = Replace(HtmlStr, vbCrLf, "") HtmlStr = Replace(HtmlStr, "====", "") HtmlStr = Replace(HtmlStr, "----", "") HtmlStr = Replace(HtmlStr, "////", "") HtmlStr = Replace(HtmlStr, "\\\\", "") HtmlStr = Replace(HtmlStr, "####", "") HtmlStr = Replace(HtmlStr, "@@@@", "") HtmlStr = Replace(HtmlStr, "****", "") HtmlStr = Replace(HtmlStr, "~~~~", "") Set re = New RegExp re.IgnoreCase = True re.Global = True re.Pattern = "\[br\]" HtmlStr = re.Replace(HtmlStr, "") re.Pattern = "\[align=right\](.*)\[\/align\]" HtmlStr = re.Replace(HtmlStr, "") re.Pattern = "<(.[^>]*)>" HtmlStr = re.Replace(HtmlStr, "") Set re = Nothing HtmlStr = Replace(HtmlStr, ">", ">") HtmlStr = Replace(HtmlStr, "<", "<") l = Len(HtmlStr) If l >= strLen Then strContent = Left(HtmlStr, strLen) & "..." Else strContent = HtmlStr & " " End If strContent = Replace(strContent, Chr(34), """) strContent = Replace(strContent, Chr(39), "'") strContent = Replace(strContent, Chr(36), "$") strContent = Replace(strContent, Chr(123), "{") strContent = Replace(strContent, Chr(125), "}") strContent = Replace(strContent, ">", ">") strContent = Replace(strContent, "<", "<") CutString = strContent End Function '================================================ '函数名:CheckInfuse '作 用:防止SQL注入 '参 数:str ----原字符串 ' strLen ----提交字符串长度 '================================================ Public Function CheckInfuse(ByVal str, ByVal strLen) Dim strUnsafe, arrUnsafe Dim i
If Trim(str) = "" Then CheckInfuse = "" Exit Function End If str = Left(str, strLen)
On Error Resume Next strUnsafe = "'|^|;|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare" If Trim(str) <> "" Then If Len(str) > strLen Then Response.Write "<Script Language=JavaScript>alert('安全系统提示↓\n\n您提交的字符数超过了限制!');history.back(-1)</Script>" CheckInfuse = "" Response.End End If arrUnsafe = Split(strUnsafe, "|") For i = 0 To UBound(arrUnsafe) If InStr(1, str, arrUnsafe(i), 1) > 0 Then Response.Write "<Script Language=JavaScript>alert('安全系统提示↓\n\n请不要在参数中包含非法字符!');history.back(-1)</Script>" CheckInfuse = "" Response.End End If Next End If CheckInfuse = Trim(str) Exit Function If Err.Number <> 0 Then Err.Clear Response.Write "<Script Language=JavaScript>alert('安全系统提示↓\n\n请不要在参数中包含非法字符!');history.back(-1)</Script>" CheckInfuse = "" Response.End End If End Function Public Sub PreventInfuse() On Error Resume Next Dim SQL_Nonlicet, arrNonlicet Dim PostRefer, GetRefer, Sql_DATA
SQL_Nonlicet = "'|;|^|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare" arrNonlicet = Split(SQL_Nonlicet, "|") If Request.Form <> "" Then For Each PostRefer In Request.Form For Sql_DATA = 0 To UBound(arrNonlicet) If InStr(1, Request.Form(PostRefer), arrNonlicet(Sql_DATA), 1) > 0 Then Response.Write "<Script Language=JavaScript>alert('安全系统提示↓\n\n请不要在参数中包含非法字符!');history.back(-1)</Script>" Response.End End If Next Next End If
If Request.QueryString <> "" Then For Each GetRefer In Request.QueryString For Sql_DATA = 0 To UBound(arrNonlicet) If InStr(1, Request.QueryString(GetRefer), arrNonlicet(Sql_DATA), 1) > 0 Then Response.Write "<Script Language=JavaScript>alert('安全系统提示↓\n\n请不要在参数中包含非法字符!');history.back(-1)</Script>" Response.End End If Next Next End If End Sub '================================================ '函数名:ChkQueryStr '作 用:过虑查询的非法字符 '参 数:str ----原字符串 '返回值:过滤后的字符 '================================================ Public Function ChkQueryStr(ByVal str) On Error Resume Next If IsNull(str) Then ChkQueryStr = "" Exit Function End If str = Replace(str, "!", "") str = Replace(str, "]", "") str = Replace(str, "[", "") str = Replace(str, ")", "") str = Replace(str, "(", "") str = Replace(str, "|", "") str = Replace(str, "+", "") str = Replace(str, "=", "") str = Replace(str, "'", "''") str = Replace(str, "%", "") str = Replace(str, "&", "") str = Replace(str, "#", "") str = Replace(str, "^", "") str = Replace(str, " ", " ") str = Replace(str, Chr(37), "") str = Replace(str, Chr(0), "") ChkQueryStr = str End Function '================================================ '过程名:CheckQuery '作 用:限制搜索的关键字 '参 数:str ----搜索的字符串 '返回值:True; False '================================================ Public Function CheckQuery(ByVal str) Dim FobWords, i, keyword keyword = str On Error Resume Next FobWords = Array(91, 92, 304, 305, 430, 431, 437, 438, 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472, 12473, 12474, 12475, 12476, 12477, 12478, 12479, 12480, 12481, 12482, 12483, 12485, 12486, 12487, 12488, 12489, 12490, 12496, 12497, 12498, 12499, 12500, 12501, 12502, 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12532, 12533, 65339, 65340) For i = 1 To UBound(FobWords, 1) If InStr(keyword, ChrW(FobWords(i))) > 0 Then CheckQuery = False Exit Function End If Next FobWords = Array("~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "=", "`", "[", "]", "{", "}", ";", ":", """", "'", "<", ">", ".", "/", "\", "|", "?", "about", "after", "all", "also", "an", "and", "another", "any", "are", "as", "at", "be", "because", "been", "before", "being", "between", "both", "but", "by", "came", "can", "come", "could", "did", "do", "each", "for", "from", "get", "got", "had", "has", "have", "he", "her", "here", "him", "himself", "his", "how", "if", "in", "into", "is", "it", "like", "make", "many", "me", "might", "more", "most", "much", "must", "my", "never", "now", "of", "on", "only", "or", "other", "our", "out", "over", "said", "same", "see", "should", "since", "some", "still", "such", "take", "than", "that", "the", "their", "them", "then", "there", "these", "they", "this") keyword = Left(keyword, 100) keyword = Replace(keyword, "!", " ") keyword = Replace(keyword, "]", " ") keyword = Replace(keyword, "[", " ") keyword = Replace(keyword, ")", " ") keyword = Replace(keyword, "(", " ") keyword = Replace(keyword, " ", " ") keyword = Replace(keyword, "-", " ") keyword = Replace(keyword, "/", " ") keyword = Replace(keyword, "+", " ") keyword = Replace(keyword, "=", " ") keyword = Replace(keyword, ",", " ") keyword = Replace(keyword, "'", " ") For i = 0 To UBound(FobWords, 1) If keyword = FobWords(i) Then CheckQuery = False Exit Function End If Next CheckQuery = True End Function '================================================ '函数名:IsValidStr '作 用:判断字符串中是否含有非法字符 '参 数:str ----原字符串 '返回值:False,True -----布尔值 '================================================ Public Function IsValidStr(ByVal str) IsValidStr = False On Error Resume Next If IsNull(str) Then Exit Function If Trim(str) = Empty Then Exit Function Dim ForbidStr, i ForbidStr = "and|chr|:|=|%|&|$|#|@|+|-|*|/|\|<|>|;|,|^|" & Chr(32) & "|" & Chr(34) & "|" & Chr(39) & "|" & Chr(9) ForbidStr = Split(ForbidStr, "|") For i = 0 To UBound(ForbidStr) If InStr(1,str, ForbidStr(i),1) > 0 Then IsValidStr = False Exit Function End If Next IsValidStr = True End Function '================================================ '函数名:IsValidPassword '作 用:判断密码中是否含有非法字符 '参 数:str ----原字符串 '返回值:False,True -----布尔值 '================================================ Public Function IsValidPassword(ByVal str) IsValidPassword = False On Error Resume Next If IsNull(str) Then Exit Function If Trim(str) = Empty Then Exit Function Dim ForbidStr, i ForbidStr = "=and|chr|*|^|%|&|;|,|" & Chr(32) & "|" & Chr(34) & "|" & Chr(39) & "|" & Chr(9) ForbidStr = Split(ForbidStr, "|") For i = 0 To UBound(ForbidStr) If InStr(1, str, ForbidStr(i), 1) > 0 Then IsValidPassword = False Exit Function End If Next IsValidPassword = True End Function '================================================ '函数名:IsValidChar '作 用:判断字符串中是否含有非法字符和中文 '参 数:str ----原字符串 '返回值:False,True -----布尔值 '================================================ Public Function IsValidChar(ByVal str) IsValidChar = False On Error Resume Next
If IsNull(str) Then Exit Function If Trim(str) = Empty Then Exit Function Dim ValidStr Dim i, l, s, c
ValidStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.-_:~\/0123456789" l = Len(str) s = UCase(str) For i = 1 To l c = Mid(s, i, 1) If InStr(ValidStr, c) = 0 Then IsValidChar = False Exit Function End If Next IsValidChar = True End Function '================================================ '函数名:FormatDate '作 用:格式化日期 '参 数:DateAndTime ----原日期和时间 ' para ----日期格式 '返回值:格式化后的日期 '================================================ Public Function FormatDate(DateAndTime, para) On Error Resume Next Dim y, m, d, h, mi, s, strDateTime FormatDate = DateAndTime If Not IsNumeric(para) Then Exit Function If Not IsDate(DateAndTime) Then Exit Function y = CStr(Year(DateAndTime)) m = CStr(Month(DateAndTime)) If Len(m) = 1 Then m = "0" & m d = CStr(Day(DateAndTime)) If Len(d) = 1 Then d = "0" & d h = CStr(Hour(DateAndTime)) If Len(h) = 1 Then h = "0" & h mi = CStr(Minute(DateAndTime)) If Len(mi) = 1 Then mi = "0" & mi s = CStr(Second(DateAndTime)) If Len(s) = 1 Then s = "0" & s Select Case para Case "1" strDateTime = y & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s Case "2" strDateTime = y & "-" & m & "-" & d Case "3" strDateTime = y & "/" & m & "/" & d Case "4" strDateTime = y & "年" & m & "月" & d & "日" Case "5" strDateTime = m & "-" & d Case "6" strDateTime = m & "/" & d Case "7" strDateTime = m & "月" & d & "日" Case "8" strDateTime = y & "年" & m & "月" Case "9" strDateTime = y & "-" & m Case "10" strDateTime = y & "/" & m Case Else strDateTime = DateAndTime End Select FormatDate = strDateTime End Function '================================================ '函数名:ReadFontMode '作 用:读取字体模式 '参 数:str ----原字符串 ' vColor -----颜色的值 ' vFont -----字体的值 '返回值:新字符串 '================================================ Public Function ReadFontMode(str, vColor, vFont) Dim FontStr, tColor Dim ColorStr, arrColor
If IsNull(str) Then ReadFontMode = "" Exit Function End If ReadFontMode = str On Error Resume Next If Not IsNumeric(vColor) Then Exit Function If Not IsNumeric(vFont) Then Exit Function
Select Case CInt(vFont) Case 1 FontStr = "<b>" & str & "</b>" Case 2 FontStr = "<em>" & str & "</em>" Case 3 FontStr = "<u>" & str & "</u>" Case 4 FontStr = "<b><em>" & str & "</em></b>" Case 5 FontStr = "<b><u>" & str & "</u></b>" Case 6 FontStr = "<em><u>" & str & "</u></em>" Case 7 FontStr = "<b><em><u>" & str & "</u></em></b>" Case Else FontStr = str End Select ReadFontMode = FontStr
If vColor = "" Or vColor = 0 Then Exit Function ColorStr = "," & InitTitleColor arrColor = Split(ColorStr, ",") If vColor > UBound(arrColor) Then Exit Function tColor = Trim(arrColor(vColor)) ReadFontMode = "<font color=" & tColor & ">" & FontStr & "</font>" End Function '============================================================= '函数名:ShowDateTime '作 用:读取日期格式 '参 数:DateAndTime ---- 当前时间 ' para ---- 时间格式 '============================================================= Public Function ShowDateTime(DateAndTime, para) ShowDateTime = "" Dim strDate If Not IsDate(DateAndTime) Then Exit Function If DateAndTime >= Date Then strDate = "<font color='" & Main_Setting(1) & "'>" strDate = strDate & FormatDate(DateAndTime, para) strDate = strDate & "</font>" Else strDate = "<font color='" & Main_Setting(2) & "'>" strDate = strDate & FormatDate(DateAndTime, para) strDate = strDate & "</font>" End If ShowDateTime = strDate End Function Public Function ShowDatePath(strval, n) ShowDatePath = "" If Trim(strval) = "" Then Exit Function Dim strTempPath, strTime Dim y, m, d
strTime = Left(strval, 8) y = Left(strTime, 4) m = Mid(strTime, 5, 2) d = Right(strTime, 2) Select Case CInt(n) Case 1 strTempPath = y & "/" & m & "/" & d & "/" Case 2 strTempPath = y & "/" & m & "/" Case 3 strTempPath = y & m & "/" Case 4 strTempPath = y & "/" Case 5 strTempPath = y & "-" & m & "-" & d & "/" Case 6 strTempPath = y & "-" & m & "/" Case 7 strTempPath = "html/" Case 8 strTempPath = "show/" Case Else strTempPath = "" End Select strTempPath = Replace(strTempPath, " ", "") ShowDatePath = CStr(strTempPath) End Function '============================================================= '函数名:ReadBriefTopicffd '作 用:读取简短标题 '参 数:para '返回值:简短标题 '============================================================= Public Function ReadBriefTopic(ByVal para) Dim sBriefTopic
ReadBriefTopic = "" If Not IsNumeric(para) Then Exit Function If para = 0 Then Exit Function Select Case para Case "1" sBriefTopic = "<font color='blue'>[图文]</font>" Case "2" sBriefTopic = "<font color='red'>[组图]</font>" Case "3" sBriefTopic = "<font color='green'>[新闻]</font>" Case "4" sBriefTopic = "<font color='blue'>[推荐]</font>" Case "5" sBriefTopic = "<font color='red'>[注意]</font>" Case "6" sBriefTopic = "<font color='green'>[转载]</font>" Case Else sBriefTopic = "" End Select ReadBriefTopic = sBriefTopic End Function '============================================================= '函数名:ReadPicTopic '作 用:读取简短标题 '参 数:para '返回值:简短标题 '============================================================= Public Function ReadPicTopic(ByVal para) Dim sBriefTopic ReadPicTopic = "" If Not IsNumeric(para) Then Exit Function If para = 0 Then Exit Function Select Case para Case "1" sBriefTopic = "<font color='" & Main_Setting(4) & "'>[图文]</font>" Case "2" sBriefTopic = "<font color='" & Main_Setting(5) & "'>[组图]</font>" Case "3" sBriefTopic = "<font color='" & Main_Setting(6) & "'>[新闻]</font>" Case "4" sBriefTopic = "<font color='" & Main_Setting(4) & "'>[推荐]</font>" Case "5" sBriefTopic = "<font color='" & Main_Setting(5) & "'>[注意]</font>" Case "6" sBriefTopic = "<font color='" & Main_Setting(6) & "'>[转载]</font>" Case Else sBriefTopic = "" End Select ReadPicTopic = sBriefTopic End Function '============================================================= '函数名:ReadPayMoney '作 用:读取要支付的金钱 '参 数:money ----实际金钱 '返回值:加上手续费后的金钱 '============================================================= Public Function ReadPayMoney(ByVal money, ByVal Reduce) On Error Resume Next If money = 0 Then ReadPayMoney = 0 Exit Function End If Dim arrChinaeBank, valPercent, Percents
arrChinaeBank = Split(ChinaeBank, " |
|