📄 forumboard_fun.asp
字号:
<%
Dim GBL_AssortID,GBL_AssortName
Dim GBL_BoardID,GBL_BoardAssort,GBL_BoardName,GBL_BoardIntro,GBL_LastWriter,GBL_LastWriteTime,GBL_TopicNum
Dim GBL_AnnounceNum,GBL_BoardManage,GBL_ForumPass,GBL_HiddenFlag,GBL_BoardLimit,GBL_MasterList,GBL_OrderID,GBL_OrderID_Old
Dim GBL_MasterList_Old,GBL_BoardID_Old,GBL_BoardStyle,GBL_StartTime,GBL_EndTime
Dim GBL_BoardImgUrl,GBL_BoardImgWidth,GBL_BoardImgHeight,GBL_BoardHead,GBL_BoardBottom
Dim GBL_ParentBoard,GBL_LowerBoard,GBL_OtherLimit,GBL_OtherLimit_Part1,GBL_OtherLimit_Part2
Dim GBL_BoardAssort_Old,GBL_ParentBoard_Old
Dim GBL_LowerBoardTemp
GBL_OrderID_Old = 0
GBL_ParentBoard = 0
GBL_LowerBoard = ""
Dim GBL_GetData
GBL_BoardID_Old = 0
GBL_BoardImgUrl = ""
GBL_BoardImgWidth = 0
GBL_BoardImgHeight = 0
Dim GBL_LimitHourStart,GBL_LimitHourEnd
GBL_LimitHourStart = 0
GBL_LimitHourEnd = 0
Dim GBL_LimitWeekEnd,GBL_LimitWeekStart
GBL_LimitWeekEnd = 0
GBL_LimitWeekStart = 0
Dim GBL_LimitMonthStart,GBL_LimitMonthEnd
GBL_LimitMonthStart = 0
GBL_LimitMonthEnd = 0
Dim GBL_HiddenFlagData,GBL_HiddenFlagNum
GBL_HiddenFlagData = Array("正常显示","论坛列表中隐藏","关闭论坛")
GBL_HiddenFlagNum = Ubound(GBL_HiddenFlagData,1)
GBL_LastWriteTime = GetTimeValue(DEF_Now)
GBL_TopicNum = 0
GBL_AnnounceNum = 0
Rem 内容验证
Function CheckFormForumBoardData
Dim GBL_MasterListArray,GBL_MasterList_OldD
GBL_MasterListArray = Split(GBL_MasterList,",")
GBL_MasterList_OldD = GBL_MasterList
If isNumeric(GBL_BoardID) = False Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 必须为论坛版面ID指定一个大于0的数字,而不能是其它字符。<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
GBL_BoardID = cCur(GBL_BoardID)
If GBL_BoardID < 1 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 必须为论坛版面ID指定一个大于0的数字。<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If isNumeric(GBL_OrderID) = False Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 必须为论坛版面排列顺序指定一个大于0的数字,而不能是其它字符。<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
GBL_OrderID = cCur(GBL_OrderID)
If GBL_OrderID < 0 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 必须为论坛排列顺序指定一个大于0的数字。<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If isNumeric(GBL_BoardAssort) = 0 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 必须为论坛分类ID指定一个大于0的数字,而不能是其它字符。<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
GBL_BoardAssort = cCur(GBL_BoardAssort)
If GBL_BoardAssort < 1 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 必须为论坛分类ID指定一个大于0的数字。<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If len(GBL_BoardName)<1 or GBL_BoardName = "" Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 论坛版面名称是必填项<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If strLength(GBL_BoardName) > 250 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 论坛版面名称长度不能超过250个字符<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If inStr(LCase(GBL_BoardName),"""") > 0 or inStr(LCase(GBL_BoardName),"<script") > 0 or inStr(LCase(GBL_BoardName),"<\script") > 0 or inStr(LCase(GBL_BoardName),"</script") > 0 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 论坛版面名称不允许插入js等其它编码,不允许使用双引号<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
Dim FobWords,TempN,TempURL,Temp2
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)
Temp2 = Ubound(FobWords,1)
For TempN = 1 to Temp2
If inStr(GBL_BoardName,ChrW(FobWords(TempN))) > 0 Then
'GBL_CHK_TempStr = GBL_CHK_TempStr & "论坛名称中的字符<u>" & ChrW(FobWords(TempN)) & "</u>属于非法字符!<br>"
'GBL_CHK_Flag = 0
'Exit Function
End If
Next
If strLength(GBL_BoardIntro) > 500 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 论坛版面论坛版面简单描述长度不能超过500个字符<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If inStr(GBL_BoardIntro,"<script") > 0 or inStr(GBL_BoardIntro,"<\script") > 0 or inStr(GBL_BoardIntro,"</script") > 0 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 版面简介不允许插入js等其它编码<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If strLength(GBL_BoardIntro) > 500 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 论坛版面论坛版面简单描述长度不能超过500个字符<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If Len(GBL_LastWriter) > 20 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 论坛版面最后发表帖子作者长度不能超过20个字<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If isDate(RestoreTime(GBL_LastWriteTime)) = False and GBL_LastWriteTime <> 0 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 论坛版面最后发表帖子的时间必须符合日期格式。<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If isNumeric(GBL_TopicNum) = 0 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 版面拥有的帖子主题数必须是一个数字,而不能是其它字符。<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
GBL_TopicNum = cCur(GBL_TopicNum)
If isNumeric(GBL_AnnounceNum) = 0 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 版面拥有的帖子数必须是一个数字,而不能是其它字符。<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
GBL_AnnounceNum = cCur(GBL_AnnounceNum)
If Len(GBL_ForumPass) > 20 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 论坛访问密码不能超过20位。<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If StrLength(GBL_BoardImgUrl) > 255 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 论坛图片url太长,不能超过255字节。<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If IsNumeric(GBL_BoardImgWidth) = 0 or isNull(GBL_BoardImgWidth) Then GBL_BoardImgWidth = 0
GBL_BoardImgWidth = Fix(cCur(GBL_BoardImgWidth))
If GBL_BoardImgWidth < 0 Then GBL_BoardImgWidth = 0
If GBL_BoardImgWidth > 200 Then GBL_BoardImgWidth = 200
If IsNumeric(GBL_BoardImgHeight) = 0 or isNull(GBL_BoardImgHeight) Then GBL_BoardImgHeight = 0
GBL_BoardImgHeight = Fix(cCur(GBL_BoardImgHeight))
If GBL_BoardImgHeight < 0 Then GBL_BoardImgHeight = 0
If GBL_BoardImgHeight > 200 Then GBL_BoardImgHeight = 200
Dim Temp1
GBL_BoardLimit = 0
Temp2 = 1
For TempN = 0 to LimitBoardStringDataNum
Temp1 = Request("Limit" & TempN+1)
If Temp1 <> "1" Then Temp1 = "0"
If Temp1 = "1" Then GBL_BoardLimit = GBL_BoardLimit+cCur(Temp2)
Temp2 = Temp2*2
Next
If isNumeric(GBL_HiddenFlag) = 0 or GBL_HiddenFlag = "" or inStr(GBL_HiddenFlag,",") > 0 then GBL_HiddenFlag = 0
GBL_HiddenFlag = cCur(GBL_HiddenFlag)
If GBL_HiddenFlag < 0 or GBL_HiddenFlag > GBL_HiddenFlagNum Then GBL_HiddenFlag = 0
If isNumeric(GBL_BoardStyle) = 0 or GBL_BoardStyle = "" or inStr(GBL_BoardStyle,",") > 0 then GBL_BoardStyle = 0
GBL_BoardStyle = cCur(GBL_BoardStyle)
If GBL_BoardStyle < 0 or GBL_BoardStyle > DEF_BoardStyleStringNum Then GBL_BoardStyle = 0
If isNumeric(GBL_LimitWeekStart) = 0 or GBL_LimitWeekStart = "" or inStr(GBL_LimitWeekStart,",") > 0 then GBL_LimitWeekStart = 0
GBL_LimitWeekStart = cCur(GBL_LimitWeekStart)
If GBL_LimitWeekStart < 0 or GBL_LimitWeekStart > 7 Then GBL_LimitWeekStart = 0
If isNumeric(GBL_LimitWeekEnd) = 0 or GBL_LimitWeekEnd = "" or inStr(GBL_LimitWeekEnd,",") > 0 then GBL_LimitWeekEnd = 0
GBL_LimitWeekEnd = cCur(GBL_LimitWeekEnd)
If GBL_LimitWeekEnd < 0 or GBL_LimitWeekEnd > 7 Then GBL_LimitWeekEnd = 0
'If GBL_LimitWeekEnd < GBL_LimitWeekStart Then
' GBL_LimitWeekEnd = 0
' GBL_LimitWeekStart = 0
'End If
If isNumeric(GBL_LimitMonthStart) = 0 or GBL_LimitMonthStart = "" or inStr(GBL_LimitMonthStart,",") > 0 then GBL_LimitMonthStart = 0
GBL_LimitMonthStart = cCur(GBL_LimitMonthStart)
If GBL_LimitMonthStart < 0 or GBL_LimitMonthStart > 31 Then GBL_LimitMonthStart = 0
If isNumeric(GBL_LimitMonthEnd) = 0 or GBL_LimitMonthEnd = "" or inStr(GBL_LimitMonthEnd,",") > 0 then GBL_LimitMonthEnd = 0
GBL_LimitMonthEnd = cCur(GBL_LimitMonthEnd)
If GBL_LimitMonthEnd < 0 or GBL_LimitMonthEnd > 31 Then GBL_LimitMonthEnd = 0
'If GBL_LimitMonthEnd < GBL_LimitMonthStart Then
' GBL_LimitMonthEnd = 0
' GBL_LimitMonthStart = 0
'End If
If isNumeric(GBL_LimitHourStart) = 0 or GBL_LimitHourStart = "" or inStr(GBL_LimitHourStart,",") > 0 then GBL_LimitHourStart = 0
GBL_LimitHourStart = cCur(GBL_LimitHourStart)
If GBL_LimitHourStart < 0 or GBL_LimitHourStart > 23 Then GBL_LimitHourStart = 0
If isNumeric(GBL_LimitHourEnd) = 0 or GBL_LimitHourEnd = "" or inStr(GBL_LimitHourEnd,",") > 0 then GBL_LimitHourEnd = 0
GBL_LimitHourEnd = cCur(GBL_LimitHourEnd)
If GBL_LimitHourEnd < 0 or GBL_LimitHourEnd > 23 Then GBL_LimitHourEnd = 0
'If GBL_LimitHourEnd < GBL_LimitHourStart Then
' GBL_LimitHourEnd = 0
' GBL_LimitHourStart = 0
'End If
If isNumeric(GBL_ParentBoard) = 0 Then
GBL_CHK_TempStr = "错误,上级版面指定错误,无上级版面请填写数字0"
CheckFormForumBoardData = 0
Exit Function
End If
GBL_ParentBoard = Fix(cCur(GBL_ParentBoard))
Dim TempName
If Ubound(GBL_MasterListArray,1) = 0 and GBL_MasterList = "?LeadBBS?" Then
Else
GBL_MasterList = ""
If Ubound(GBL_MasterListArray,1) > DEF_MaxBoardMastNum - 1 Then
GBL_CHK_TempStr = "错误,版主最多只能设置" & DEF_MaxBoardMastNum & "个"
CheckFormForumBoardData = 0
GBL_MasterList = GBL_MasterList_OldD
Exit Function
End if
For TempN = 0 to Ubound(GBL_MasterListArray,1)
If Trim(GBL_MasterListArray(TempN)) <> "" Then
TempName = CheckUserNameExist(GBL_MasterListArray(TempN))
If TempName = "" Then
GBL_CHK_TempStr = "Error: 论坛版主列表错误,用户" & htmlencode(GBL_MasterListArray(TempN)) & "不存在!<br>" & VbCrLf
CheckFormForumBoardData = 0
GBL_MasterList = GBL_MasterList_OldD
Exit Function
Else
GBL_MasterList = GBL_MasterList & "," & TempName
End If
End If
Next
If Left(GBL_MasterList,1) = "," Then GBL_MasterList = Mid(GBL_MasterList,2)
End If
If isNumeric(GBL_OtherLimit_Part1) = 0 Then GBL_OtherLimit_Part1 = 0
GBL_OtherLimit_Part1 = Fix(cCur(GBL_OtherLimit_Part1))
If isNumeric(GBL_OtherLimit_Part2) = 0 Then GBL_OtherLimit_Part2 = 0
GBL_OtherLimit_Part2 = Fix(cCur(GBL_OtherLimit_Part2))
If GBL_OtherLimit_Part2 < 0 or GBL_OtherLimit_Part2 > 999999999999 Then
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 更多访问限制数值错误,必须大于零!<br>" & VbCrLf
CheckFormForumBoardData = 0
Exit Function
End If
If GBL_OtherLimit_Part1 <= 0 or GBL_OtherLimit_Part1 > 4 Then
GBL_OtherLimit_Part1 = 0
GBL_OtherLimit_Part2 = 0
GBL_OtherLimit = 0
Else
GBL_OtherLimit = cCur(GBL_OtherLimit_Part2 & Right("0" & GBL_OtherLimit_Part1,2))
End If
CheckFormForumBoardData = 1
GBL_StartTime = Right("0" & GBL_LimitHourStart,2) & Right("0" & GBL_LimitWeekStart,2) & Right("0" & GBL_LimitMonthStart,2)
GBL_EndTime = Right("0" & GBL_LimitHourEnd,2) & Right("0" & GBL_LimitWeekEnd,2) & Right("0" & GBL_LimitMonthEnd,2)
End Function
Rem 检测某用户名是否存在
Function CheckUserNameExist(UserName)
Dim Rs
Set Rs = Con.ExeCute("Select top 1 UserName from LeadBBS_User where UserName='" & Replace(UserName,"'","''") & "'")
If Rs.Eof Then
CheckUserNameExist = ""
Else
CheckUserNameExist = Rs(0)
End if
Rs.Close
Set Rs = Nothing
End Function
Rem 检测某分类ID是否存在
Function CheckForumAssortIDExist(AssortID)
Dim Rs
Set Rs = Con.ExeCute("Select top 1 AssortID from LeadBBS_Assort where AssortID=" & AssortID)
If Rs.Eof Then
CheckForumAssortIDExist = 0
Else
CheckForumAssortIDExist = 1
End if
Rs.Close
Set Rs = Nothing
End Function
Rem 检测某版面ID是否存在
Function CheckForumBoardIDExist(BoardID)
Dim Rs
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select top 1 * from LeadBBS_Boards where BoardID=" & BoardID,con,1,1
If Rs.Eof Then
CheckForumBoardIDExist = 0
Else
CheckForumBoardIDExist = 1
End if
Rs.Close
Set Rs = Nothing
End Function
Rem 检测某版面名称是否存在
Function CheckForumBoardNameExist(BoardName)
Dim Rs
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select top 1 BoardID from LeadBBS_Boards where BoardName='" & Replace(BoardName,"'","''") & "'",con,1,1
If Rs.Eof Then
CheckForumBoardNameExist = 0
Else
CheckForumBoardNameExist = cCur(rs(0))
End if
Rs.Close
Set Rs = Nothing
End Function
Rem 删除某版面
Function DeleteForumBoard(BoardID)
Dim Rs,ParentBoard,MasterList
Set Rs = Con.ExeCute("Select top 1 ParentBoard,LowerBoard,MasterList from LeadBBS_Boards where BoardID=" & BoardID)
If Rs.Eof Then
Rs.Close
Set Rs = Nothing
GBL_CHK_TempStr = GBL_CHK_TempStr & "Error: 论坛版面ID号" & BoardID & "不存在!<br>" & VbCrLf
DeleteForumBoard = 0
Exit Function
Else
If Rs(1) & "" <> "" Then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -