I have coded a fairly simple database driven news application for my site. I would like that every time I post a news article the a new topic will be created in the forum with the same subject and message as the original news post. This because now people could easily comment the news.
I know this has been asked before but I only need a little help as I don't know how Snitz creates all posts etc.
I would need to know which pieces of code in post_info.asp handle the creation of a new topic, or more specificly, which do I need to use in my news posting application.
Correct me if I'm wrong, but this next piece of code (line 446) should be the one inserting the new topic.
'## Forum_SQL - Add new post to Topics Table
strSql = "INSERT INTO " & strTablePrefix & "TOPICS (FORUM_ID"
strSql = strSql & ", CAT_ID"
strSql = strSql & ", T_SUBJECT"
strSql = strSql & ", T_MESSAGE"
strSql = strSql & ", T_AUTHOR"
strSql = strSql & ", T_LAST_POST"
strSql = strSql & ", T_LAST_POST_AUTHOR"
strSql = strSql & ", T_DATE"
strSql = strSql & ", T_STATUS"
if strIPLogging <> "0" then
strSql = strSql & ", T_IP"
end if
strSql = strSql & ", T_MAIL"
strSql = strSql & ") VALUES ("
strSql = strSql & Request.Form("FORUM_ID")
strSql = strSql & ", " & Request.Form("CAT_ID")
strSql = strSql & ", '" & txtSubject & "'"
strSql = strSql & ", '" & txtMessage & "'"
strSql = strSql & ", " & rs("MEMBER_ID")
strSql = strSql & ", '" & DateToStr(strForumTimeAdjust) & "'"
strSql = strSql & ", " & rs("MEMBER_ID")
strSql = strSql & ", '" & DateToStr(strForumTimeAdjust) & "'"
if Request.Form("lock") = 1 then
strSql = strSql & ", 0 "
else
strSql = strSql & ", 1 "
end if
if strIPLogging <> "0" then
strSql = strSql & ", '" & Request.ServerVariables("REMOTE_ADDR") & "'"
end if
strSql = strSql & ", " & TF & ")"
my_Conn.Execute (strSql)
But, I think that I need to do something else also. The counts should perhaps be updated, or am I wrong on that? Line 487.
'## Forum_SQL - Increase count of topics and replies in Forum table by 1
strSql = "UPDATE " & strTablePrefix & "FORUM "
strSql = strSql & " SET F_LAST_POST = '" & DateToStr(strForumTimeAdjust) & "'"
strSql = strSql & ", F_TOPICS = F_TOPICS + 1"
strSql = strSql & ", F_COUNT = F_COUNT + 1"
strSql = strSql & ", F_LAST_POST_AUTHOR = " & rs("MEMBER_ID") & ""
strSql = strSql & " WHERE FORUM_ID = " & Request.Form("FORUM_ID")
my_Conn.Execute (strSql)
Is there anything else that should be inserted/updated? Some counts maybe?
Hope you understood what I mean