Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Need script to output Snitz topics
 New Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Lon2
Junior Member

USA
151 Posts

Posted - 01 April 2016 :  22:01:58  Show Profile  Reply with Quote
Hello, I have a database as well as several backups from a current version of Snitz that's no longer on a web server. The databases are on my desktop SQL Server. I need to create a basic script that will output each topic in the database as a simple html or text file, similarly to what the Snitz "Printer Friendly" feature does but auto generate the files. Where do I start?

Thanks for any help!

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 01 April 2016 :  23:34:53  Show Profile
Easiest way would be to create an IIS on your desktop, install basic Sitz, and link to those databases. Then you could use an existing Snitz mod for the purpose.

Edited by - Carefree on 01 April 2016 23:41:29
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 04 April 2016 :  18:49:49  Show Profile
Thanks Carefree. I'm getting the following error:
quote:
Microsoft SQL Server Native Client 10.0 error '80040e37'

Invalid object name 'FORUM_TOPICS'.

/forums/admin_topic_maker.asp, line 76

Code:
58. <%
59. if AdminAllowed = 1 then
60. set countrs = my_conn.execute("SELECT CAT_ID FROM " & strTablePrefix  & "TOPICS")
61. 	ListTopic = 0
62.     do until countrs.eof
63.     	ListTopic = ListTopic + 1
64.     countrs.movenext
65.     Loop
66. set countrs = nothing
67. strTotalTopics = ListTopic
68. 'strSql = strSql & "SELECT T_COUNT FROM FORUM_TOTALS" & Topics
69. 'write_this = Request.QueryString("TOPIC_ID")
70. 'for write_this = 1 to ListTopic
71. for write_this = 1 to ListTopic
72. strSql = "SELECT FORUM_ID, CAT_ID, T_AUTHOR, T_SUBJECT, T_MESSAGE "
73. strSql = strSql & " FROM FORUM_TOPICS "
74. strSql = strSql & " WHERE TOPIC_ID = " & write_this
75. 'response.write strSql
76. set rsWrite = my_Conn.Execute (strSql)

Edited by - Lon2 on 05 April 2016 03:17:48
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 05 April 2016 :  03:08:23  Show Profile
I also tried another version of Topic Maker and got the following error:
quote:
Microsoft VBScript runtime error '800a0005'

Invalid procedure call or argument

/forums/admin_topic_maker.asp, line 173

And its code:
170. Set ObjTopicFile = Server.CreateObject("Scripting.FileSystemObject")
171. TopicFile = Server.MapPath (strTopicPath & write_this & ".htm") 
172. Set WriteTopicFile = ObjTopicFile.CreateTextFile (TopicFile, True)
173. WriteTopicFile.WriteLine(strWrite)
174. WriteTopicFile.Close
175. Set WriteTopicFile = Nothing
176. Set ObjTopicFile = Nothing
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 05 April 2016 :  03:21:05  Show Profile
quote:
Originally posted by Carefree

Easiest way would be to create an IIS on your desktop, install basic Sitz, and link to those databases. Then you could use an existing Snitz mod for the purpose.



Since I'm not having any luck with Topic Maker mods, are you aware of any other mods, tools or scripts that could possibly do what I'm looking for? I'd be willing to pay someone to write a new script providing it did everything I need.
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 05 April 2016 :  11:22:53  Show Profile
quote:
Originally posted by Lon2

Thanks Carefree. I'm getting the following error:
quote:
Microsoft SQL Server Native Client 10.0 error '80040e37'

Invalid object name 'FORUM_TOPICS'.

/forums/admin_topic_maker.asp, line 76

Code:
58. <%
59. if AdminAllowed = 1 then
60. set countrs = my_conn.execute("SELECT CAT_ID FROM " & strTablePrefix  & "TOPICS")
61. 	ListTopic = 0
62.     do until countrs.eof
63.     	ListTopic = ListTopic + 1
64.     countrs.movenext
65.     Loop
66. set countrs = nothing
67. strTotalTopics = ListTopic
68. 'strSql = strSql & "SELECT T_COUNT FROM FORUM_TOTALS" & Topics
69. 'write_this = Request.QueryString("TOPIC_ID")
70. 'for write_this = 1 to ListTopic
71. for write_this = 1 to ListTopic
72. strSql = "SELECT FORUM_ID, CAT_ID, T_AUTHOR, T_SUBJECT, T_MESSAGE "
73. strSql = strSql & " FROM FORUM_TOPICS "
74. strSql = strSql & " WHERE TOPIC_ID = " & write_this
75. 'response.write strSql
76. set rsWrite = my_Conn.Execute (strSql)




That error means that you called your forum tables something other than "FORUM" when you created it. The solution is to replace "FORUM_" with the variable "strTablePrefix". Line 68 should read something like this:

68. strSql = strSql & "SELECT T_COUNT FROM " & strTablePrefix & "TOPICS"


If you want me to write you a program especially to extract your topics, I can. Send me Email and I'll help you out.
Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 05 April 2016 :  18:01:14  Show Profile

quote:
Originally posted by Carefree

That error means that you called your forum tables something other than "FORUM" when you created it. The solution is to replace "FORUM_" with the variable "strTablePrefix". Line 68 should read something like this:

68. strSql = strSql & "SELECT T_COUNT FROM " & strTablePrefix & "TOPICS"


If you want me to write you a program especially to extract your topics, I can. Send me Email and I'll help you out.



Should be line 73 from:
73. strSql = strSql & " FROM FORUM_TOPICS "


Change it to this:
73. strSql = strSql & " FROM " & strTablePrefix & "TOPICS "



Cheers,

David Greening
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 05 April 2016 :  19:49:42  Show Profile
Thanks so much, Carefree and ClassicMC!

It seems it starting working but wrote only one empty topic in the "../topics/" folder. It ran through 3,290 topics, all with "Done processing topic number XXXX. - No such topic found." ("...topic number 3290" was last one). So I'm guessing I'll need to change all instances of "FORUM_" to "& strTablePrefix & "?

I believer there are about 15,000 topics total with archives. Will the script also write the archives? Do you think I'll need to increase "<%Server.ScriptTimeout = 10000%>" for it to write all of the topics? If so, what do you think would be a good number?
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 05 April 2016 :  22:18:52  Show Profile
Try this:


<%
'#################################################################################
'## Snitz Forums 2000 v3.4.07
'#################################################################################
'## Copyright (C) 2000-16 Michael Anderson, Pierre Gorissen,
'##                       Huw Reddick and Richard Kinser
'##
'## This program is free software; you can redistribute and/or modify it under the 
'## terms of the GNU General Public License as published by the Free Software
'## Foundation; version 2 or later of the License.
'##
'## All copyright notices regarding Snitz Forums 2000 must remain intact in the 
'## scripts and in the HTML output.  The "powered by" text/logo with a link back 
'## to http://forum.snitz.com in the footer of the pages MUST remain visible when 
'## the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful, but WITHOUT ANY 
'## WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A 
'## PARTICULAR PURPOSE.  See the GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License with this 
'## program; if not, Write to:
'## Free Software Foundation, Inc.
'## 59 Temple Place - Suite 330
'## Boston, MA  02111-1307, USA
'##
'## Support can be obtained from our support forums at:  http://forum.snitz.com
'##
'## Correspondence and marketing questions can be sent to:  manderson@snitz.com
'##
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<%
Response.Write	"			<table border=""0"" width=""100%"">" & vbNewLine & _
	"				<tr>" & vbNewLine & _
	"					<td width=""33%"" align=""left"" nowrap><font family=""" & strDefaultFontFamily & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
	"					" & getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
	"					" & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolder,"","align=""absmiddle""") & " <a href=""admin_home.asp"">Admin Section</a><br />" & vbNewLine & _
	"					" & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolderOpenTopic,"","align=""absmiddle""") & " Topic Maker</font></td>" & vbNewLine & _
	"				</tr>" & vbNewLine & _
	"			</table>" & vbNewLine & _
	"			<br />" & vbNewLine & _
	"			<table width=""800px;"" style=""border-radius: 25px; padding-top:20px; padding-left:10px; padding-right:10px; padding-bottom:10px; box-shadow:10px 5px 5px rgba(96,96,96, 0.8);"" bgcolor=""" & strPopupTableColor & """ border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"">" & vbNewLine & _
	"				<tr>" & vbNewLine & _
	"					<td bgcolor=""" & strForumCellColor & """>" & vbNewLine
If mLev > 3 Then
	strSql = "SELECT CAT_ID FROM " & strTablePrefix & "TOPICS"
	Set countrs = my_Conn.Execute(strSql)
	strTotalTopics = 0
	If Not countrs.EOF Then
		countrs.MoveFirst
		Do Until countrs.EOF
			strTotalTopics = strTotalTopics + 1
			countrs.MoveNext
		Loop
		countrs.Close
	End If
	Set countrs = Nothing
	For Write_this = 1 To strTotalTopics
		Response.Buffer = Flush
		strSql = "SELECT FORUM_ID, CAT_ID, T_AUTHOR, T_SUBJECT, T_MESSAGE FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID = " & Write_this
		Set rsWrite = my_Conn.Execute (strSql)
		If Not (rsWrite.BOF Or rsWrite.EOF) Then
			rsWrite.MoveFirst
			strSqlS = "SELECT F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & rsWrite("FORUM_ID")
			Set rsGetForum = my_Conn.Execute(strSqlS)
			If Not rsGetForum.EOF Then
				rsGetForum.MoveFirst
				forum_name = rsGetForum("F_SUBJECT")
				themessage = rsWrite("T_MESSAGE")
				strWrite = strWrite & "<html><head><title>" & strForumTitle & " (© 2002) - " & rsWrite("T_SUBJECT") & "</title>"
				strWrite = strWrite & "<meta http-equiv=""Refresh"" content=""5; URL=" & strForumURL & "topic.asp?TOPIC_ID=" & Write_this & """>"
				strWrite = strWrite & "<meta name=""Description"" CONTENT=""" & strForumTitle & " (© 2002) - " & rsWrite("T_SUBJECT") & """>"
				strWrite = strWrite & "<meta name=""Keywords"" CONTENT=""" & rsWrite("T_SUBJECT") & " " & Replace(themessage, Chr(13) & Chr(10), "") & """>"
				strWrite = strWrite & "<table width=""100%"" border=""1"" cellpadding=""2"" cellspacing=""1"" bordercolor=""#3366CC""><tr><td align=""center"" colspan=""2""><b>" & rsWrite("T_SUBJECT") & "</b></td></tr>"
				strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWrite("T_AUTHOR")) & "</b></td>"
				strWrite = strWrite & "<td>" & themessage & "</td></tr>"
				strSql2 = "SELECT R_AUTHOR, R_MESSAGE FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID = " & Write_this
				Set rsWriteReply = my_Conn.Execute(strSql2)
				If Not rsWriteReply.EOF Then
					rsWriteReply.MoveFirst
					Do Until rsWriteReply.EOF
						strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWriteReply("R_AUTHOR")) & "</b></td>"
						strWrite = strWrite & "<td>" & rsWriteReply("R_MESSAGE") & "</td></tr>"
						rsWriteReply.MoveNext
					Loop
					strWrite = strWrite & "</table>"
					Set ObjTopicFile = Server.CreateObject("Scripting.FileSystemObject")
					TopicFile = Server.MapPath ("../topics/" & Write_this & ".asp")
					Set WriteTopicFile = ObjTopicFile.CreateTextFile (TopicFile, True)
					WriteTopicFile.WriteLine(strWrite)
					WriteTopicFile.Close
					Set WriteTopicFile = Nothing
					Set ObjTopicFile = Nothing
					strStatus = "<b>Success.</b>"
				End If
			End If
		End If
		Response.Write "<b>Done processing topic number " & Write_this & ".</b> - "& strStatus & "<br>"
	Next
	strSql = "SELECT CAT_ID FROM " & strTablePrefix & "A_TOPICS"
	Set countrs = my_Conn.Execute(strSql)
	strTotalTopics = 0
	If Not countrs.EOF Then
		countrs.MoveFirst
		Do Until countrs.EOF
			strTotalTopics = strTotalTopics + 1
			countrs.MoveNext
		Loop
		countrs.Close
	End If
	Set countrs = Nothing
	For Write_this = 1 To strTotalTopics
		Response.Buffer = Flush
		strSql = "SELECT FORUM_ID, CAT_ID, T_AUTHOR, T_SUBJECT, T_MESSAGE FROM " & strTablePrefix & "A_TOPICS WHERE TOPIC_ID = " & Write_this
		Set rsWrite = my_Conn.Execute (strSql)
		If Not (rsWrite.BOF Or rsWrite.EOF) Then
			rsWrite.MoveFirst
			strSqlS = "SELECT F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & rsWrite("FORUM_ID")
			Set rsGetForum = my_Conn.Execute(strSqlS)
			If Not rsGetForum.EOF Then
				rsGetForum.MoveFirst
				forum_name = rsGetForum("F_SUBJECT")
				themessage = rsWrite("T_MESSAGE")
				strWrite = strWrite & "<html><head><title>" & strForumTitle & " (© 2002) - " & rsWrite("T_SUBJECT") & "</title>"
				strWrite = strWrite & "<meta http-equiv=""Refresh"" content=""5; URL=" & strForumURL & "topic.asp?TOPIC_ID=" & Write_this & """>"
				strWrite = strWrite & "<meta name=""Description"" CONTENT=""" & strForumTitle & " (© 2002) - " & rsWrite("T_SUBJECT") & """>"
				strWrite = strWrite & "<meta name=""Keywords"" CONTENT=""" & rsWrite("T_SUBJECT") & " " & Replace(themessage, Chr(13) & Chr(10), "") & """>"
				strWrite = strWrite & "<table width=""100%"" border=""1"" cellpadding=""2"" cellspacing=""1"" bordercolor=""#3366CC""><tr><td align=""center"" colspan=""2""><b>" & rsWrite("T_SUBJECT") & "</b></td></tr>"
				strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWrite("T_AUTHOR")) & "</b></td>"
				strWrite = strWrite & "<td>" & themessage & "</td></tr>"
				strSql2 = "SELECT R_AUTHOR, R_MESSAGE FROM " & strTablePrefix & "A_REPLY WHERE TOPIC_ID = " & Write_this
				Set rsWriteReply = my_Conn.Execute(strSql2)
				If Not rsWriteReply.EOF Then
					rsWriteReply.MoveFirst
					Do Until rsWriteReply.EOF
						strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWriteReply("R_AUTHOR")) & "</b></td>"
						strWrite = strWrite & "<td>" & rsWriteReply("R_MESSAGE") & "</td></tr>"
						rsWriteReply.MoveNext
					Loop
					strWrite = strWrite & "</table>"
					Set ObjTopicFile = Server.CreateObject("Scripting.FileSystemObject")
					TopicFile = Server.MapPath ("../topics/" & Write_this & ".asp")
					Set WriteTopicFile = ObjTopicFile.CreateTextFile (TopicFile, True)
					WriteTopicFile.WriteLine(strWrite)
					WriteTopicFile.Close
					Set WriteTopicFile = Nothing
					Set ObjTopicFile = Nothing
					strStatus = "<b>Success.</b>"
				End If
			End If
		End If
		Response.Write "<b>Done processing topic number " & Write_this & ".</b> - "& strStatus & "<br>"
	Next
Else
	Response.Write "You are not authorized to do this action."
End if
Response.Write	"					</td>" & vbNewLine & _
	"				</tr>" & vbNewLine & _
	"			</table>" & vbNewLine
WriteFooter
%>

Edited by - Carefree on 05 April 2016 22:25:35
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 06 April 2016 :  17:42:37  Show Profile
Thanks again Carefree! I had a problem with the buffers so I just removed those lines for now. I had to add the "inc_function_secure.asp" include because I was getting a "GetMemberName" error. I found the reason the original script stopped on the one topic.. it's because there are no topics before it, ha.

The script looks like it's running to the end now but getting the following error:
quote:
Microsoft VBScript runtime error '800a0005'

Invalid procedure call or argument

/forums/admin_topic_maker.asp, line 95

Line 95 looks like write file:
92. Set ObjTopicFile = Server.CreateObject("Scripting.FileSystemObject")
93. TopicFile = Server.MapPath ("../topics/" & Write_this & ".asp")
94. Set WriteTopicFile = ObjTopicFile.CreateTextFile (TopicFile, True)
95. WriteTopicFile.WriteLine(strWrite)
96. WriteTopicFile.Close
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 06 April 2016 :  22:55:10  Show Profile
Try removing the parentheses on line 95. If that doesn't work, here's another approach. The Buffering lines are there, you may need to remove them again; unsure what buffering error you had received.


<%
'#################################################################################
'## Snitz Forums 2000 v3.4.07
'#################################################################################
'## Copyright (C) 2000-16 Michael Anderson, Pierre Gorissen,
'##                       Huw Reddick and Richard Kinser
'##
'## This program is free software; you can redistribute and/or modify it under the 
'## terms of the GNU General Public License as published by the Free Software
'## Foundation; version 2 or later of the License.
'##
'## All copyright notices regarding Snitz Forums 2000 must remain intact in the 
'## scripts and in the HTML output.  The "powered by" text/logo with a link back 
'## to http://forum.snitz.com in the footer of the pages MUST remain visible when 
'## the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful, but WITHOUT ANY 
'## WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A 
'## PARTICULAR PURPOSE.  See the GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License with this 
'## program; if not, Write to:
'## Free Software Foundation, Inc.
'## 59 Temple Place - Suite 330
'## Boston, MA  02111-1307, USA
'##
'## Support can be obtained from our support forums at:  http://forum.snitz.com
'##
'## Correspondence and marketing questions can be sent to:  manderson@snitz.com
'##
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<!--#INCLUDE FILE="inc_func_secure.asp" -->
<!--#INCLUDE FILE="inc_func_member.asp" -->
<%
Response.Buffer = True
Const FSOForReading = 1
Const FSOForWriting = 2
Dim strFPath, TopicFile, strWrite
Response.Write	"			<table border=""0"" width=""100%"">" & vbNewLine & _
	"				<tr>" & vbNewLine & _
	"					<td width=""33%"" align=""left"" nowrap><font family=""" & strDefaultFontFamily & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
	"					" & getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
	"					" & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolder,"","align=""absmiddle""") & " <a href=""admin_home.asp"">Admin Section</a><br />" & vbNewLine & _
	"					" & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolderOpenTopic,"","align=""absmiddle""") & " Topic Maker</font></td>" & vbNewLine & _
	"				</tr>" & vbNewLine & _
	"			</table>" & vbNewLine & _
	"			<br />" & vbNewLine & _
	"			<table width=""800px;"" style=""border-radius: 25px; padding-top:20px; padding-left:10px; padding-right:10px; padding-bottom:10px; box-shadow:10px 5px 5px rgba(96,96,96, 0.8);"" bgcolor=""" & strPopupTableColor & """ border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"">" & vbNewLine & _
	"				<tr>" & vbNewLine & _
	"					<td bgcolor=""" & strForumCellColor & """>" & vbNewLine
If mLev > 3 Then
	Set	ObjFSO = Server.CreateObject("Scripting.FileSystemObject")
	strFPath=Server.MapPath("topics")
	If not objFSO.FolderExists(strFPath) Then
		strErr = "Path: " & strFPath & " does not exist."
		Go_Result strErr
	End If
	strSql = "SELECT CAT_ID FROM " & strTablePrefix & "TOPICS"
	Set countrs = my_Conn.Execute(strSql)
	strTotalTopics = 0
	If Not countrs.EOF Then
		countrs.MoveFirst
		Do Until countrs.EOF
			strTotalTopics = strTotalTopics + 1
			countrs.MoveNext
		Loop
		countrs.Close
	End If
	Set countrs = Nothing
	For Write_this = 1 To strTotalTopics
		Response.Buffer = Flush
		strSql = "SELECT FORUM_ID, CAT_ID, T_AUTHOR, T_SUBJECT, T_MESSAGE FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID = " & Write_this
		Set rsWrite = my_Conn.Execute (strSql)
		If Not (rsWrite.BOF Or rsWrite.EOF) Then
			rsWrite.MoveFirst
			strSqlS = "SELECT F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & rsWrite("FORUM_ID")
			Set rsGetForum = my_Conn.Execute(strSqlS)
			If Not rsGetForum.EOF Then
				rsGetForum.MoveFirst
				forum_name = rsGetForum("F_SUBJECT")
				themessage = rsWrite("T_MESSAGE")
				strWrite = strWrite & "<html><head><title>" & strForumTitle & " (© 2016) - " & rsWrite("T_SUBJECT") & "</title>"
				strWrite = strWrite & "<meta http-equiv=""Refresh"" content=""10; URL=" & strForumURL & "topic.asp?TOPIC_ID=" & Write_this & """>"
				strWrite = strWrite & "<meta name=""Description"" CONTENT=""" & strForumTitle & " (© 2016) - " & rsWrite("T_SUBJECT") & """>"
				strWrite = strWrite & "<meta name=""Keywords"" CONTENT=""" & rsWrite("T_SUBJECT") & " " & Replace(themessage, Chr(13) & Chr(10), "") & """>"
				strWrite = strWrite & "</head><body>"
				strWrite = strWrite & "<table width=""100%"" border=""1"" cellpadding=""2"" cellspacing=""1"" bordercolor=""#3366CC""><tr><td align=""center"" colspan=""2""><b>" & rsWrite("T_SUBJECT") & "</b></td></tr>"
				strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWrite("T_AUTHOR")) & "</b></td>"
				strWrite = strWrite & "<td>" & themessage & "</td></tr>"
				strSql2 = "SELECT R_AUTHOR, R_MESSAGE FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID = " & Write_this
				Set rsWriteReply = my_Conn.Execute(strSql2)
				If Not rsWriteReply.EOF Then
					rsWriteReply.MoveFirst
					Do Until rsWriteReply.EOF
						strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWriteReply("R_AUTHOR")) & "</b></td>"
						strWrite = strWrite & "<td>" & FormatStr(rsWriteReply("R_MESSAGE")) & "</td></tr>"
						rsWriteReply.MoveNext
					Loop
					rs.WriteReply.Close
				End If
				Set rs.WriteReply = Nothing
				strWrite = strWrite & "</table></body></html>"
				TopicFile = strFPath & "/" & write_this	& ".htm"
				If objFSO.FileExists(TopicFile) Then 
					objFSO.DeleteFile(TopicFile)
				End If
				Set	WriteTopicFile = ObjFSO.CreateTextFile(TopicFile, FSOForWriting, True)
				WriteTopicFile.WriteLine strWrite
				WriteTopicFile.Close
				Set WriteTopicFile = Nothing
				Set ObjTopicFile = Nothing
				Response.Write "<b>Topic number	</b>"	&	write_this & ":<b> complete.</b><br />"
			End If
		End If
		Set rsWrite = Nothing
	Next
	Set ObjFSO = Nothing
	Set	ObjFSO = Server.CreateObject("Scripting.FileSystemObject")
	strFPath=Server.MapPath("topics")
	If not objFSO.FolderExists(strFPath) Then
		strErr = "Path: " & strFPath & " does not exist."
		Go_Result strErr
	End If
	strSql = "SELECT CAT_ID FROM " & strTablePrefix & "A_TOPICS"
	Set countrs = my_Conn.Execute(strSql)
	strTotalTopics = 0
	If Not countrs.EOF Then
		countrs.MoveFirst
		Do Until countrs.EOF
			strTotalTopics = strTotalTopics + 1
			countrs.MoveNext
		Loop
		countrs.Close
	End If
	Set countrs = Nothing
	For Write_this = 1 To strTotalTopics
		Response.Buffer = True
		strSql = "SELECT FORUM_ID, CAT_ID, T_AUTHOR, T_SUBJECT, T_MESSAGE FROM " & strTablePrefix & "A_TOPICS WHERE TOPIC_ID = " & Write_this
		Set rsWrite = my_Conn.Execute (strSql)
		If Not (rsWrite.BOF Or rsWrite.EOF) Then
			rsWrite.MoveFirst
			strSqlS = "SELECT F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & rsWrite("FORUM_ID")
			Set rsGetForum = my_Conn.Execute(strSqlS)
			If Not rsGetForum.EOF Then
				rsGetForum.MoveFirst
				forum_name = rsGetForum("F_SUBJECT")
				themessage = rsWrite("T_MESSAGE")
				strWrite = strWrite & "<html><head><title>" & strForumTitle & " (© 2016) - " & rsWrite("T_SUBJECT") & "</title>"
				strWrite = strWrite & "<meta http-equiv=""Refresh"" content=""10; URL=" & strForumURL & "topic.asp?TOPIC_ID=" & Write_this & """>"
				strWrite = strWrite & "<meta name=""Description"" CONTENT=""" & strForumTitle & " (© 2016) - " & rsWrite("T_SUBJECT") & """>"
				strWrite = strWrite & "<meta name=""Keywords"" CONTENT=""" & rsWrite("T_SUBJECT") & " " & Replace(themessage, Chr(13) & Chr(10), "") & """>"
				strWrite = strWrite & "</head><body>"
				strWrite = strWrite & "<table width=""100%"" border=""1"" cellpadding=""2"" cellspacing=""1"" bordercolor=""#3366CC""><tr><td align=""center"" colspan=""2""><b>" & rsWrite("T_SUBJECT") & "</b></td></tr>"
				strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWrite("T_AUTHOR")) & "</b></td>"
				strWrite = strWrite & "<td>" & themessage & "</td></tr>"
				strSql2 = "SELECT R_AUTHOR, R_MESSAGE FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID = " & Write_this
				Set rsWriteReply = my_Conn.Execute(strSql2)
				If Not rsWriteReply.EOF Then
					rsWriteReply.MoveFirst
					Do Until rsWriteReply.EOF
						strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWriteReply("R_AUTHOR")) & "</b></td>"
						strWrite = strWrite & "<td>" & FormatStr(rsWriteReply("R_MESSAGE")) & "</td></tr>"
						rsWriteReply.MoveNext
					Loop
					rs.WriteReply.Close
				End If
				Set rs.WriteReply = Nothing
				strWrite = strWrite & "</table></body></html>"
				TopicFile = strFPath & "/" & write_this	& ".htm"
				If objFSO.FileExists(TopicFile) Then 
					objFSO.DeleteFile(TopicFile)
				End If
				Set	WriteTopicFile = ObjFSO.CreateTextFile(TopicFile, FSOForWriting, True)
				WriteTopicFile.WriteLine strWrite
				WriteTopicFile.Close
				Set WriteTopicFile = Nothing
				Set ObjTopicFile = Nothing
				Response.Write "<b>Topic number	</b>"	&	write_this & ":<b> complete.</b><br />"
			End If
		End If
		Set rsWrite = Nothing
	Next
	Set ObjFSO = Nothing
	Response.Write "You are not authorized to do this action."
End If
Response.Write	"					</td>" & vbNewLine & _
	"				</tr>" & vbNewLine & _
	"			</table>" & vbNewLine
WriteFooter
Function Go_Result(message)
	Response.Write 	"      <br /><div align=""center""><font family=""" & strDefaultFontFamily & """ size=""" & strDefaultFontSize & """ color=""" & strHiliteFontColor & """>" & message & "</font></div>"
	WriteFooter
	Response.End
End Function
%>

Edited by - Carefree on 06 April 2016 22:55:57
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 12 April 2016 :  20:28:55  Show Profile
Alright! I was able to get this one to work after removing the periods from all instances of "rs.WriteReply." Thanks again for that!

If I knew the topic number sequence of a Category and wanted to write just those Topics, is there a way to do that? E.g. Write TOPIC_ID=3500 thru TOPIC_ID=5000.
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 13 April 2016 :  07:45:52  Show Profile
Sure. Modify line 62 to something like this:

	strSql = "SELECT CAT_ID FROM " & strTablePrefix & "TOPICS WHERE (TOPIC_ID > 3499 AND TOPIC_ID < 5001)"

Edited by - Carefree on 30 April 2016 18:42:25
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 14 April 2016 :  11:55:34  Show Profile
Hmm that doesn't write any files but a few archives and then says, "You don't have permission to do this." I'm lookin online to see if I can find other commands.. found BETWEEN but it's not working either..
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 14 April 2016 :  23:05:44  Show Profile
If you want all topics from a particular category, why not simply specify the category? Change the two pieces of red below.


<%
'#################################################################################
'## Snitz Forums 2000 v3.4.07
'#################################################################################
'## Copyright (C) 2000-16 Michael Anderson, Pierre Gorissen,
'##                       Huw Reddick and Richard Kinser
'##
'## This program is free software; you can redistribute and/or modify it under the 
'## terms of the GNU General Public License as published by the Free Software
'## Foundation; version 2 or later of the License.
'##
'## All copyright notices regarding Snitz Forums 2000 must remain intact in the 
'## scripts and in the HTML output.  The "powered by" text/logo with a link back 
'## to http://forum.snitz.com in the footer of the pages MUST remain visible when 
'## the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful, but WITHOUT ANY 
'## WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A 
'## PARTICULAR PURPOSE.  See the GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License with this 
'## program; if not, Write to:
'## Free Software Foundation, Inc.
'## 59 Temple Place - Suite 330
'## Boston, MA  02111-1307, USA
'##
'## Support can be obtained from our support forums at:  http://forum.snitz.com
'##
'## Correspondence and marketing questions can be sent to:  manderson@snitz.com
'##
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<!--#INCLUDE FILE="inc_func_secure.asp" -->
<!--#INCLUDE FILE="inc_func_member.asp" -->
<%
Response.Buffer = True
Const FSOForReading = 1
Const FSOForWriting = 2
Dim strFPath, TopicFile, strWrite
Response.Write	"			<table border=""0"" width=""100%"">" & vbNewLine & _
	"				<tr>" & vbNewLine & _
	"					<td width=""33%"" align=""left"" nowrap><font family=""" & strDefaultFontFamily & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
	"					" & getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
	"					" & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolder,"","align=""absmiddle""") & " <a href=""admin_home.asp"">Admin Section</a><br />" & vbNewLine & _
	"					" & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolderOpenTopic,"","align=""absmiddle""") & " Topic Maker</font></td>" & vbNewLine & _
	"				</tr>" & vbNewLine & _
	"			</table>" & vbNewLine & _
	"			<br />" & vbNewLine & _
	"			<table width=""800px;"" style=""border-radius: 25px; padding-top:20px; padding-left:10px; padding-right:10px; padding-bottom:10px; box-shadow:10px 5px 5px rgba(96,96,96, 0.8);"" bgcolor=""" & strPopupTableColor & """ border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"">" & vbNewLine & _
	"				<tr>" & vbNewLine & _
	"					<td bgcolor=""" & strForumCellColor & """>" & vbNewLine
If mLev > 3 Then
	Set	ObjFSO = Server.CreateObject("Scripting.FileSystemObject")
	strFPath=Server.MapPath("topics")
	If not objFSO.FolderExists(strFPath) Then
		strErr = "Path: " & strFPath & " does not exist."
		Go_Result strErr
	End If
	strSql = "SELECT FORUM_ID, CAT_ID, T_AUTHOR, T_SUBJECT, T_MESSAGE FROM " & strTablePrefix & "TOPICS WHERE CAT_ID = (SPECIFY CAT_ID HERE)"
	Set rsWrite = my_Conn.Execute (strSql)
	If Not (rsWrite.BOF Or rsWrite.EOF) Then
		rsWrite.MoveFirst
		strSqlS = "SELECT F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & rsWrite("FORUM_ID")
		Set rsGetForum = my_Conn.Execute(strSqlS)
		If Not rsGetForum.EOF Then
			rsGetForum.MoveFirst
			forum_name = rsGetForum("F_SUBJECT")
			themessage = rsWrite("T_MESSAGE")
			strWrite = strWrite & "<html><head><title>" & strForumTitle & " (© 2016) - " & rsWrite("T_SUBJECT") & "</title>"
			strWrite = strWrite & "<meta http-equiv=""Refresh"" content=""10; URL=" & strForumURL & "topic.asp?TOPIC_ID=" & Write_this & """>"
			strWrite = strWrite & "<meta name=""Description"" CONTENT=""" & strForumTitle & " (© 2016) - " & rsWrite("T_SUBJECT") & """>"
			strWrite = strWrite & "<meta name=""Keywords"" CONTENT=""" & rsWrite("T_SUBJECT") & " " & Replace(themessage, Chr(13) & Chr(10), "") & """>"
			strWrite = strWrite & "</head><body>"
			strWrite = strWrite & "<table width=""100%"" border=""1"" cellpadding=""2"" cellspacing=""1"" bordercolor=""#3366CC""><tr><td align=""center"" colspan=""2""><b>" & rsWrite("T_SUBJECT") & "</b></td></tr>"
			strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWrite("T_AUTHOR")) & "</b></td>"
			strWrite = strWrite & "<td>" & themessage & "</td></tr>"
			strSql2 = "SELECT R_AUTHOR, R_MESSAGE FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID = " & Write_this
			Set rsWriteReply = my_Conn.Execute(strSql2)
			If Not rsWriteReply.EOF Then
				rsWriteReply.MoveFirst
				Do Until rsWriteReply.EOF
					strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWriteReply("R_AUTHOR")) & "</b></td>"
					strWrite = strWrite & "<td>" & FormatStr(rsWriteReply("R_MESSAGE")) & "</td></tr>"
					rsWriteReply.MoveNext
				Loop
				rsWriteReply.Close
			End If
			Set rsWriteReply = Nothing
			strWrite = strWrite & "</table></body></html>"
			TopicFile = strFPath & "/" & write_this	& ".htm"
			If objFSO.FileExists(TopicFile) Then 
				objFSO.DeleteFile(TopicFile)
			End If
			Set	WriteTopicFile = ObjFSO.CreateTextFile(TopicFile, FSOForWriting, True)
			WriteTopicFile.WriteLine strWrite
			WriteTopicFile.Close
			Set WriteTopicFile = Nothing
			Set ObjTopicFile = Nothing
			Response.Write "<b>Topic number	</b>"	&	write_this & ":<b> complete.</b><br />"
		End If
	End If
	Set rsWrite = Nothing
	Set ObjFSO = Nothing
	Set	ObjFSO = Server.CreateObject("Scripting.FileSystemObject")
	strFPath=Server.MapPath("topics")
	If not objFSO.FolderExists(strFPath) Then
		strErr = "Path: " & strFPath & " does not exist."
		Go_Result strErr
	End If
	strSql = "SELECT FORUM_ID, CAT_ID, T_AUTHOR, T_SUBJECT, T_MESSAGE FROM " & strTablePrefix & "A_TOPICS WHERE CAT_ID = (SPECIFY CAT_ID HERE)"
	Set rsWrite = my_Conn.Execute (strSql)
	If Not (rsWrite.BOF Or rsWrite.EOF) Then
		rsWrite.MoveFirst
		strSqlS = "SELECT F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & rsWrite("FORUM_ID")
		Set rsGetForum = my_Conn.Execute(strSqlS)
		If Not rsGetForum.EOF Then
			rsGetForum.MoveFirst
			forum_name = rsGetForum("F_SUBJECT")
			themessage = rsWrite("T_MESSAGE")
			strWrite = strWrite & "<html><head><title>" & strForumTitle & " (© 2016) - " & rsWrite("T_SUBJECT") & "</title>"
			strWrite = strWrite & "<meta http-equiv=""Refresh"" content=""10; URL=" & strForumURL & "topic.asp?TOPIC_ID=" & Write_this & """>"
			strWrite = strWrite & "<meta name=""Description"" CONTENT=""" & strForumTitle & " (© 2016) - " & rsWrite("T_SUBJECT") & """>"
			strWrite = strWrite & "<meta name=""Keywords"" CONTENT=""" & rsWrite("T_SUBJECT") & " " & Replace(themessage, Chr(13) & Chr(10), "") & """>"
			strWrite = strWrite & "</head><body>"
			strWrite = strWrite & "<table width=""100%"" border=""1"" cellpadding=""2"" cellspacing=""1"" bordercolor=""#3366CC""><tr><td align=""center"" colspan=""2""><b>" & rsWrite("T_SUBJECT") & "</b></td></tr>"
			strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWrite("T_AUTHOR")) & "</b></td>"
			strWrite = strWrite & "<td>" & themessage & "</td></tr>"
			strSql2 = "SELECT R_AUTHOR, R_MESSAGE FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID = " & Write_this
			Set rsWriteReply = my_Conn.Execute(strSql2)
			If Not rsWriteReply.EOF Then
				rsWriteReply.MoveFirst
				Do Until rsWriteReply.EOF
					strWrite = strWrite & "<tr><td align=""center"" valign=""top""><b>" & getMemberName(rsWriteReply("R_AUTHOR")) & "</b></td>"
					strWrite = strWrite & "<td>" & FormatStr(rsWriteReply("R_MESSAGE")) & "</td></tr>"
					rsWriteReply.MoveNext
				Loop
				rsWriteReply.Close
			End If
			Set rsWriteReply = Nothing
			strWrite = strWrite & "</table></body></html>"
			TopicFile = strFPath & "/" & write_this	& ".htm"
			If objFSO.FileExists(TopicFile) Then 
				objFSO.DeleteFile(TopicFile)
			End If
			Set	WriteTopicFile = ObjFSO.CreateTextFile(TopicFile, FSOForWriting, True)
			WriteTopicFile.WriteLine strWrite
			WriteTopicFile.Close
			Set WriteTopicFile = Nothing
			Set ObjTopicFile = Nothing
			Response.Write "<b>Topic number	</b>"	&	write_this & ":<b> complete.</b><br />"
		End If
	End If
	Set rsWrite = Nothing
	Set ObjFSO = Nothing
Else
	Response.Write "You are not authorized to do this action."
End If
Response.Write	"					</td>" & vbNewLine & _
	"				</tr>" & vbNewLine & _
	"			</table>" & vbNewLine
WriteFooter
Function Go_Result(message)
	Response.Write 	"      <br /><div align=""center""><font family=""" & strDefaultFontFamily & """ size=""" & strDefaultFontSize & """ color=""" & strHiliteFontColor & """>" & message & "</font></div>"
	WriteFooter
	Response.End
End Function
%>
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 15 April 2016 :  20:21:57  Show Profile
That's not working right... it's writing 1 post 1 file, then the same 1 post with several more posts, and keeps going.. every page with the same post plus more and more. The last file looks like almost every topic and post in the category, lol! That was strange... I think this is beginning to be more trouble than it's worth...
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.36 seconds. Powered By: Snitz Forums 2000 Version 3.4.07