📄 httpapi.asp
字号:
"WHERE " & strDbTable & "Author.Username = '" & strMemberName & "'; "
'Write to the database
adoCon.Execute(strSQL)
sarryRecords(0) = ("" & _
vbCrLf & " <Username>" & Server.HTMLEncode(rsCommon("Username")) & "</Username>" & _
vbCrLf & " <UserID>" & rsCommon("Author_ID") & "</UserID>" & _
vbCrLf & " <Active>True</Active>")
End If
'Reset Server Objects
rsCommon.Close
'****** SuspendMember OR UnsubspendMember ******
Case "SuspendMember", "UnsubspendMember"
'Read in username
strMemberName = Trim(Mid(Request("MemberName"), 1, 20))
strMemberName = formatSQLInput(strMemberName)
'SQL
strSQL = "SELECT " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Username, " & strDbTable & "Author.Banned " & _
"FROM " & strDbTable & "Author" & strDBNoLock & " " & _
"WHERE " & strDbTable & "Author.Username = '" & strMemberName & "'; "
'Query the database
rsCommon.Open strSQL, adoCon
'If nothing returned then an error
If rsCommon.EOF Then
intErrorCode = -150
strErrorDescription = "Member not found"
'Else member is found so write XML
Else
ReDim Preserve sarryRecords(0)
If strApiAction = "UnsubspendMember" Then
'Update db
strSQL = "UPDATE " & strDbTable & "Author" & strRowLock & " " & _
"SET " & strDbTable & "Author.Banned = " & strDBFalse & " " & _
"WHERE " & strDbTable & "Author.Username = '" & strMemberName & "'; "
'Write to the database
adoCon.Execute(strSQL)
sarryRecords(0) = ("" & _
vbCrLf & " <Username>" & Server.HTMLEncode(rsCommon("Username")) & "</Username>" & _
vbCrLf & " <UserID>" & rsCommon("Author_ID") & "</UserID>" & _
vbCrLf & " <Suspened>False</Suspened>")
Else
'Update db
strSQL = "UPDATE " & strDbTable & "Author" & strRowLock & " " & _
"SET " & strDbTable & "Author.Banned = " & strDBTrue & " " & _
"WHERE " & strDbTable & "Author.Username = '" & strMemberName & "'; "
'Write to the database
adoCon.Execute(strSQL)
sarryRecords(0) = ("" & _
vbCrLf & " <Username>" & Server.HTMLEncode(rsCommon("Username")) & "</Username>" & _
vbCrLf & " <UserID>" & rsCommon("Author_ID") & "</UserID>" & _
vbCrLf & " <Suspened>True</Suspened>")
End If
End If
'Reset Server Objects
rsCommon.Close
'****** GetForums ******
Case "GetForums"
'SQL
strSQL = "SELECT " & strDbTable & "Category.*, " & strDbTable & "Forum.* " & _
"FROM " & strDbTable & "Category" & strDBNoLock & ", " & strDbTable & "Forum" & strDBNoLock & " " & _
"WHERE " & strDbTable & "Category.Cat_ID = " & strDbTable & "Forum.Cat_ID " & _
"ORDER BY " & strDbTable & "Category.Cat_order, " & strDbTable & "Forum.Forum_Order;"
'Query the database
rsCommon.Open strSQL, adoCon
'If nothing returned then an error
If rsCommon.EOF Then
intErrorCode = -150
strErrorDescription = "No Forums Found"
'Else forums are found so write XML
Else
'Loop through records
DO WHILE NOT rsCommon.EOF
ReDim Preserve sarryRecords(intRecordLoop)
sarryRecords(intRecordLoop) = ("" & _
vbCrLf & " <ForumName>" & Server.HTMLEncode(rsCommon("Forum_name")) & "</ForumName>" & _
vbCrLf & " <ForumID>" & rsCommon("Forum_ID") & "</ForumID>" & _
vbCrLf & " <SubForumID>" & rsCommon("Sub_ID") & "</SubForumID>" & _
vbCrLf & " <CatName>" & rsCommon("Cat_Name") & "</CatName>" & _
vbCrLf & " <CatID>" & rsCommon("Cat_ID") & "</CatID>" & _
vbCrLf & " <ForumDescription><![CDATA[" & rsCommon("Forum_description") & "]]></ForumDescription>")
If rsCommon("Password") <> "" Then sarryRecords(intRecordLoop) = sarryRecords(intRecordLoop) & vbCrLf & " <Password>True</Password>" Else sarryRecords(intRecordLoop) = sarryRecords(intRecordLoop) & vbCrLf & " <Password>False</Password>"
sarryRecords(intRecordLoop) = sarryRecords(intRecordLoop) & ("" & _
vbCrLf & " <Locked>" & CBool(rsCommon("Locked")) & "</Locked>" & _
vbCrLf & " <Hidden>" & CBool(rsCommon("Hide")) & "</Hidden>" & _
vbCrLf & " <TopicCount>" & rsCommon("No_of_topics") & "</TopicCount>" & _
vbCrLf & " <PostCount>" & rsCommon("No_of_posts") & "</PostCount>" & _
vbCrLf & " <LastPostMemberID>" & rsCommon("Last_post_author_ID") & "</LastPostMemberID>")
If isDate(rsCommon("Last_post_date")) Then sarryRecords(intRecordLoop) = sarryRecords(intRecordLoop) & vbCrLf & " <LastPostDate>" & internationalDateTime(CDate(rsCommon("Last_post_date"))) & "</LastPostDate>" Else sarryRecords(intRecordLoop) = sarryRecords(intRecordLoop) & vbCrLf & " <LastPostDate/>"
sarryRecords(intRecordLoop) = sarryRecords(intRecordLoop) & ("" & _
vbCrLf & " <LastPostTopicID>" & rsCommon("Last_topic_ID") & "</LastPostTopicID>")
intRecordLoop = intRecordLoop + 1
'Move to next record
rsCommon.MoveNext
Loop
End If
'Reset Server Objects
rsCommon.Close
'****** LockForumByID OR UnLockForumByID ******
Case "LockForumByID", "UnLockForumByID"
'Read in forum ID
intForumID = IntC(Request("ForumID"))
'SQL
strSQL = "SELECT " & strDbTable & "Forum.Forum_ID, " & strDbTable & "Forum.Forum_name, " & strDbTable & "Forum.Locked " & _
"FROM " & strDbTable & "Forum" & strDBNoLock & " " & _
"WHERE " & strDbTable & "Forum.Forum_ID = " & intForumID & "; "
'Query the database
rsCommon.Open strSQL, adoCon
'If nothing returned then an error
If rsCommon.EOF Then
intErrorCode = -150
strErrorDescription = "Forum not found"
'Else forum is found so write XML
Else
ReDim Preserve sarryRecords(0)
'Update db
If strApiAction = "UnLockForumByID" Then
'Update user status to active
strSQL = "UPDATE " & strDbTable & "Forum" & strRowLock & " " & _
"SET " & strDbTable & "Forum.Locked = " & strDBFalse & " " & _
"WHERE " & strDbTable & "Forum.Forum_ID = " & intForumID & "; "
'Write to the database
adoCon.Execute(strSQL)
sarryRecords(0) = ("" & _
vbCrLf & " <ForumID>" & Server.HTMLEncode(rsCommon("Forum_ID")) & "</ForumID>" & _
vbCrLf & " <ForumDescription>" & Server.HTMLEncode(rsCommon("Forum_name")) & "</ForumDescription>" & _
vbCrLf & " <Locked>False</Locked>")
Else
strSQL = "UPDATE " & strDbTable & "Forum" & strRowLock & " " & _
"SET " & strDbTable & "Forum.Locked = " & strDBTrue & " " & _
"WHERE " & strDbTable & "Forum.Forum_ID = " & intForumID & "; "
'Write to the database
adoCon.Execute(strSQL)
sarryRecords(0) = ("" & _
vbCrLf & " <ForumID>" & Server.HTMLEncode(rsCommon("Forum_ID")) & "</ForumID>" & _
vbCrLf & " <ForumDescription>" & Server.HTMLEncode(rsCommon("Forum_name")) & "</ForumDescription>" & _
vbCrLf & " <Locked>True</Locked>")
End If
End If
'Reset Server Objects
rsCommon.Close
'****** GetTopicNameByID OR CloseTopicByID OR OpenTopicByID ******
Case "GetTopicNameByID", "CloseTopicByID", "OpenTopicByID"
'Read in the TopicID
lngTopicID = LngC(Request("TopicID"))
'SQL
strSQL = "SELECT " & strDbTable & "Topic.* " & _
"FROM " & strDbTable & "Topic" & strDBNoLock & " " & _
"WHERE " & strDbTable & "Topic.Topic_ID = " & lngTopicID & ";"
'Query the database
rsCommon.Open strSQL, adoCon
'If nothing returned then an error
If rsCommon.EOF Then
intErrorCode = -150
strErrorDescription = "Topic not found"
'Else forums are found so write XML
Else
ReDim Preserve sarryRecords(0)
'Update db
If strApiAction = "CloseTopicByID" Then
'Update db
strSQL = "UPDATE " & strDbTable & "Topic" & strRowLock & " " & _
"SET " & strDbTable & "Topic.Locked = " & strDBTrue & " " & _
"WHERE " & strDbTable & "Topic.Topic_ID = " & lngTopicID & "; "
'Write to the database
adoCon.Execute(strSQL)
'Rerun recordset query
rsCommon.ReQuery
ElseIf strApiAction = "OpenTopicByID" Then
'Update db
strSQL = "UPDATE " & strDbTable & "Topic" & strRowLock & " " & _
"SET " & strDbTable & "Topic.Locked = " & strDBFalse & " " & _
"WHERE " & strDbTable & "Topic.Topic_ID = " & lngTopicID & "; "
'Write to the database
adoCon.Execute(strSQL)
'Rerun recordset query
rsCommon.ReQuery
End If
sarryRecords(intRecordLoop) = ("" & _
vbCrLf & " <TopicName><![CDATA[" & rsCommon("Subject") & "]]></TopicName>" & _
vbCrLf & " <TopicID>" & rsCommon("Topic_ID") & "</TopicID>" & _
vbCrLf & " <ForumID>" & rsCommon("Forum_ID") & "</ForumID>" & _
vbCrLf & " <TopicLocked>" & CBool(rsCommon("Locked")) & "</TopicLocked>" & _
vbCrLf & " <Hidden>" & CBool(rsCommon("Hide")) & "</Hidden>" & _
vbCrLf & " <ReplyCount>" & rsCommon("No_of_replies") & "</ReplyCount>")
If isDate(rsCommon("Event_date")) Then sarryRecords(0) = sarryRecords(0) & vbCrLf & " <EventDateStart>" & internationalDateTime(CDate(rsCommon("Event_date"))) & "</EventDateStart>" Else sarryRecords(0) = sarryRecords(0) & vbCrLf & " <EventDateStart/>"
If isDate(rsCommon("Event_date_end")) Then sarryRecords(0) = sarryRecords(0) & vbCrLf & " <EventDateEnd>" & internationalDateTime(CDate(rsCommon("Event_date_end"))) & "</EventDateEnd>" Else sarryRecords(0) = sarryRecords(0) & vbCrLf & " <EventDateEnd/>"
sarryRecords(intRecordLoop) = sarryRecords(intRecordLoop) & ("" & _
vbCrLf & " <ViewCount>" & rsCommon("No_of_views") & "</ViewCount>")
End If
'Reset Server Objects
rsCommon.Close
'****** GetLastTopics OR GetLastTopicsByForumID ******
Case "GetLastTopics", "GetLastTopicsByForumID"
'Read in the max results
If isNumeric(Request("MaxResults")) Then
'Get the max results to show, trim this to a 3 figure number, as only 50 allowed, and prevent errors
intMaxResults = Trim(Mid(Request("MaxResults"), 1, 3))
'Convert into integer
intMaxResults = IntC(intMaxResults)
'Set some defaults if out of range
If intMaxResults > 50 Then intMaxResults = 50
If intMaxResults < 1 Then intMaxResults = 1
End If
'If GetLastPostsByForumID then read in the forum ID
If strApiAction = "GetLastTopicsByForumID" Then
If isNumeric(Request("ForumID")) Then
intForumID = LngC(Request("ForumID"))
Else
intForumID = -1
End If
End If
'SQL
strSQL = "" & _
"SELECT "
If strDatabaseType = "SQLServer" OR strDatabaseType = "Access" Then
strSQL = strSQL & " TOP " & intMaxResults & " "
End If
strSQL = strSQL & _
"" & strDbTable & "Forum.Forum_name, " & strDbTable & "Topic.* " & _
"FROM " & strDbTable & "Forum, " & strDbTable & "Topic " & _
"WHERE " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Topic.Forum_ID "
'If looking at a forum only, only get posts from that forum
If intForumID <> 0 Then strSQL = strSQL & "AND " & strDbTable & "Topic.Forum_ID = " & intForumID & " "
strSQL = strSQL & "AND (" & strDbTable & "Topic.Hide = " & strDBFalse & ") " & _
"ORDER BY " & strDbTable & "Topic.Last_Thread_ID DESC"
'mySQL limit operator
If strDatabaseType = "mySQL" Then
strSQL = strSQL & " LIMIT " & intMaxResults
End If
'Query the database
rsCommon.Open strSQL, adoCon
'If nothing returned then an error
If rsCommon.EOF Then
intErrorCode = -150
If strApiAction = "GetLastTopicsByForumID" Then
strErrorDescription = "Forum not found or no topics in forum"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -