i've worked a little over this problem again, and i've tried to solve the problem of the page u were redirected. In fact, with previous patch u r redirected to the first page of a thread (even if it's a multi-page one). To solve this, u can pass the whichpage in the reply link.. but it's not so nice, imho.
So i've assembled this code, that can be used from all the snitz users. Pls check and tell me if it's all ok or if there's something that can be cut off.
if Request.ServerVariables("HTTP_REFERER") = "" OR Request.ServerVariables("HTTP_REFERER") = " " Then
if strRqMethod = "Edit" or _
strRqMethod = "EditTopic" or _
strRqMethod = "Reply" or _
strRqMethod = "ReplyQuote" then
'## Forum_SQL
strSql = "SELECT " & strActivePrefix & "REPLY.REPLY_ID, " & _
strActivePrefix & "REPLY.FORUM_ID, " & _
strActivePrefix & "REPLY.TOPIC_ID, " & _
strActivePrefix & "REPLY.R_DATE " & _
" FROM " & strActivePrefix & "REPLY " & _
" WHERE TOPIC_ID = " & strRqTopicID & " "
strSql = strSql & " ORDER BY " & strActivePrefix & "REPLY.R_DATE ASC"
if strDBType = "mysql" then 'MySql specific code
'## Forum_SQL - Get the total pagecount
strSql2 = "SELECT COUNT(" & strActivePrefix & "REPLY.TOPIC_ID) AS REPLYCOUNT "
strSql2 = strSql2 & " FROM " & strMemberTablePrefix & "MEMBERS, " & strActivePrefix & "REPLY "
strSql2 = strSql2 & " WHERE TOPIC_ID = " & strRqTopicID & " "
set rsCount = my_Conn.Execute(strSql2)
if not rsCount.eof then
maxpages = (rsCount("REPLYCOUNT") \ strPageSize )
if rsCount("REPLYCOUNT") mod strPageSize <> 0 then
maxpages = maxpages + 1
end if
else
maxpages = 1
end if
rsCount.close
set rsCount = nothing
else 'end MySql specific code
set rsReplies = Server.CreateObject("ADODB.Recordset")
rsReplies.cachesize = strPageSize
rsReplies.open strSql, my_Conn, 3
If not (rsReplies.EOF or rsReplies.BOF) then '## No replies found in DB
rsReplies.movefirst
rsReplies.pagesize = strPageSize
rsReplies.absolutepage = cint(rsReplies.pagecount)
maxpages = cint(rsReplies.pagecount)
end if
end if
Response.write "topic.asp?TOPIC_ID=" & strRqTopicID & "&wichpage=" & maxpages
Elseif strRqMethod = "Topic" or _
strRqMethod = "TopicQuote" then
Response.write "forum.asp?FORUM_ID=" & strRqForumId
Else
Response.write "default.asp"
End If
Else
response.write Request.ServerVariables("HTTP_REFERER")
end If
Bye
fenix
P.S.: my forum works with access DB, i don't know if this fix works fine for mysql users!