📄 modifytheme.asp
字号:
<%@ Language=VBScript %>
<% option explicit %>
<!-- #include file="conn_forum.asp" -->
<!-- #include file="inc_session.asp" -->
<%
dim uid
uid=GetSession
dim iArea
dim tId
dim sAction
dim iNewArea
iarea=clng(Request("areaid"))
tid=clng(Request("tid"))
sAction=lcase(Request("action"))
iNewArea=clng(Request("newarea"))
'//Get the master name
dim rs
dim adminName 'Adminstrator's name
set rs=Server.CreateObject ("ADODB.Recordset")
rs.Open "SELECT master FROM tindex WHERE areaID=" & iarea ,connf,3 ,3
adminName=rs("master")
if IsEmpty(adminName) then adminName=""
rs.close
dim sAuthor
'List The Theme
rs.Open "SELECT * FROM tcontent WHERE ThemeID=" & tid ,connf,3 ,3
if rs.BOF and rs.EOF then
Response.Write "This theme did not exist!"
Response.End
end if
sAuthor=rs("Author")
if uid<>"" and (InStr(1,adminName,uid)>0 or uid="admin" or uid=sAuthor ) then
'Allow to access
else
Response.Write "Forbbiden to access!"
Response.End
end if
'//DELETE -----------------------------------------------------------------------
if sAction="delete" then
dim iDelCount '//record how many replies has been deleted
dim pid
pid=rs("parentid")
if pid=-1 then
Response.Write "<br>Deleting theme (" & tid & ") ..."
else
Response.Write "<br>Deleting reply (" & tid & ") ..."
iDelCount=1
end if
rs.Delete
Response.Write "OK."
rs.Close
if pid=-1 then
'//delete all reply........
rs.Open "SELECT * FROM tcontent WHERE ParentID=" & tid ,connf,3 ,3
if not(rs.BOF and rs.EOF) then
rs.MoveLast
rs.MoveFirst
do while not(rs.EOF)
Response.Write "<br>Deleting reply (" & rs("themeid") & ") ..."
rs.Delete
Response.Write "OK."
iDelCount=iDelCount+1
rs.MoveNext
loop
end if
rs.Close
'//recent
rs.Open "SELECT * FROM trecent WHERE themeID=" & tid ,connf,3 ,3
if not(rs.BOF and rs.EOF) then
Response.Write "<br>Deleting recent theme (" & rs("themeid") & ") ..."
rs.Delete
Response.Write "OK."
end if
rs.Close
else
Response.Write "<br>Calculating the number of reply..."
'//ori theme
rs.Open "SELECT * FROM tcontent WHERE ThemeID=" & pid ,connf,3 ,3
if not(rs.BOF and rs.EOF) then
rs("replycount")=clng(rs("replycount"))-1
rs.Update
end if
rs.Close
'//recent
rs.Open "SELECT * FROM trecent WHERE themeID=" & pid ,connf,3 ,3
if not(rs.BOF and rs.EOF) then
rs("replycount")=clng(rs("replycount"))-1
rs.Update
end if
rs.Close
Response.Write "ok."
end if
Response.Write "<br>Calculating the number of theme and replies..."
dim iThemeCount
dim iReplyCount
'//INDEX
rs.Open "SELECT * FROM tIndex WHERE areaID=" & iArea,connf,3 ,3
if rs.BOF and rs.EOF then
'no
else
iThemeCount=rs("themecount")
iReplyCount=rs("replycount")
if pid=-1 then
iThemeCount=iThemeCount-1
iReplyCount=iReplyCount-iDelCount
else
iReplyCount=iReplyCount-1
end if
if iThemeCount<0 then iThemeCount=0
if iReplyCount<0 then iReplyCount=0
rs("themecount")=iThemeCount
rs("replycount")=iReplyCount
if rs("lastThemeId")=tid and pid=-1 then
rs("lastAuthor")=""
rs("lastTheme")=""
rs("lastThemeId")=0
end if
rs.Update
end if
rs.Close
'//config
rs.Open "tConfig",connf,3,3
if rs.BOF and rs.EOF then
'no
else
iThemeCount=rs("themecount")
iReplyCount=rs("replycount")
if pid=-1 then
iThemeCount=iThemeCount-1
iReplyCount=iReplyCount-iDelCount
else
iReplyCount=iReplyCount-1
end if
if iThemeCount<0 then iThemeCount=0
if iReplyCount<0 then iReplyCount=0
rs("themecount")=iThemeCount
rs("replycount")=iReplyCount
rs.Update
end if
rs.Close
Response.Write "ok."
response.write "<p>ALL OK!</p>"
'//LOCK & SELECT -----------------------------------------------------------------------
elseif sAction="lock" then
Response.Write "<br>Lock theme (" & tid & ")"
rs("lock")=1
rs.Update
rs.Close
elseif sAction="unlock" then
Response.Write "<br>Unlock theme (" & tid & ")"
rs("lock")=0
rs.Update
rs.Close
elseif sAction="selected" then
Response.Write "<br>Set theme to selected (" & tid & ")..."
rs("selected")=1
rs.Update
rs.Close
Response.Write "ok"
'//recent
rs.Open "SELECT * FROM trecent WHERE themeID=" & tid ,connf,3 ,3
if not(rs.BOF and rs.EOF) then
Response.Write "<br>update recent theme (" & rs("themeid") & ")..."
rs("selected")=1
rs.Update
end if
rs.Close
Response.Write "ok"
elseif sAction="unselected" then
Response.Write "<br>Set theme to unselected (" & tid & ")..."
rs("selected")=0
rs.Update
rs.Close
Response.Write "ok"
'//recent
rs.Open "SELECT * FROM trecent WHERE themeID=" & tid ,connf,3 ,3
if not(rs.BOF and rs.EOF) then
Response.Write "<br>update recent theme (" & rs("themeid") & ")..."
rs("selected")=0
rs.Update
end if
rs.Close
Response.Write "ok"
elseif sAction="move" then
dim iMoveCount
iMoveCount=0
'Move theme
Response.Write "<br>Moving theme (" & tid & ")..."
rs("areaID")=iNewArea
rs.Update
rs.Close
'//move all reply........
rs.Open "SELECT * FROM tcontent WHERE ParentID=" & tid ,connf,3 ,3
if not(rs.BOF and rs.EOF) then
rs.MoveLast
rs.MoveFirst
do while not(rs.EOF)
Response.Write "<br>moving reply (" & rs("themeid") & ") ..."
rs("areaID")=iNewArea
Response.Write "OK."
iMoveCount=iMoveCount+1
rs.MoveNext
loop
end if
rs.Close
'//recent
rs.Open "SELECT * FROM trecent WHERE themeID=" & tid ,connf,3 ,3
if not(rs.BOF and rs.EOF) then
Response.Write "<br>move recent theme (" & rs("themeid") & ")..."
rs("areaID")=iNewArea
rs.Update
end if
rs.Close
Response.Write "ok"
'//
Response.Write "<br>Moved! and move replies:" & iMoveCount
Response.Write "<br>OK"
Response.Write "<br>Calculating the number of theme and replies..."
'//INDEX COUNT
rs.Open "SELECT * FROM tIndex WHERE areaID=" & iArea,connf,3 ,3
if not(rs.BOF and rs.EOF) then
iThemeCount=rs("themecount")
iReplyCount=rs("replycount")
iThemeCount=iThemeCount-1
iReplyCount=iReplyCount-iMoveCount
if iThemeCount<0 then iThemeCount=0
if iReplyCount<0 then iReplyCount=0
rs("themecount")=iThemeCount
rs("replycount")=iReplyCount
rs.Update
end if
rs.Close
rs.Open "SELECT * FROM tIndex WHERE areaID=" & iNewArea,connf,3 ,3
if not(rs.BOF and rs.EOF) then
iThemeCount=rs("themecount")
iReplyCount=rs("replycount")
iThemeCount=iThemeCount+1
iReplyCount=iReplyCount+iMoveCount
rs("themecount")=iThemeCount
rs("replycount")=iReplyCount
rs.Update
end if
rs.Close
Response.Write "OK"
end if
'//////////////////////////////////////////////////////////////////////////
set rs=nothing
call closeconnf()
if sAction="delete" then
if pid=-1 then
response.write "<p><a href='listtheme.asp?area=" & iArea & "'>BACK</a>"
else
response.write "<p><a href='viewtheme.asp?area=" & iArea & "&id=" & pid & "'>BACK</a>"
end if
elseif sAction="move" then
response.write "<p><a href='listtheme.asp?area=" & iArea & "'>BACK</a>"
else
response.write "<p><a href='viewtheme.asp?area=" & iArea & "&id=" & tid & "'>BACK</a>"
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -