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: MOD Implementation
 Events Calendar - delete event error
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 3

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 02 July 2008 :  07:50:29  Show Profile
If you delete an event from within cal.asp, no problems the event is removed, however if you check that previous topic in forum.asp the event is still showing.

Testing the system if you delete from within cal.asp, a popup window cal_delete.asp prompts for a password confirmation and then deletes the event only in the events calendar.
However, if you select the event displayed in topic.asp for deletion, a pop-up pop_delete.asp, again requsts password confirmation and then deletes both topic and calendar cal.asp event. Thus flushing all associated detail.

Should, this delete process be both ways ie in cal_delete and pop_delete
<

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  11:03:50  Show Profile
It should, yes. After you delete the topic, though, you'll have to update your topic & forum counts. Adding the following just above the writefooter in cal_delete.asp should do it, but it'd be nice if one of the Snitz gurus gave a second opinion:


					'## Don't update if topic was in archive
					if (Topic_Status <= 1) and (ArchiveView = "") then
						strSql = "DELETE FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID = " & TOPIC_ID
						my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
						
						strSql = "UPDATE " & strTablePrefix & "FORUM "
						strSql = strSql & " SET F_COUNT = F_COUNT - " & cLng(risposte) + 1
						strSql = strSql & ", F_TOPICS = F_TOPICS - " & 1				
						strSql = strSql & ", F_LAST_POST = '" & strLast_Post & "' "
						strSql = strSql & ", F_LAST_POST_AUTHOR = " & strLast_Post_Author
						strSql = strSql & ", F_LAST_POST_TOPIC_ID = " & strLast_Post_Topic_ID
						strSql = strSql & ", F_LAST_POST_REPLY_ID = " & strLast_Post_Reply_ID
						strSql = strSql & " WHERE FORUM_ID = " & Forum_ID

						my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

						'## Forum_SQL - Update total TOPICS in Totals table
						strSql = "UPDATE " & strTablePrefix & "TOTALS "
						strSql = strSql & " SET T_COUNT = T_COUNT - " & 1
						strSql = strSql & ",    P_COUNT = P_COUNT - " & cLng(risposte) + 1
						my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
					end if
<
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 02 July 2008 :  11:07:54  Show Profile  Visit HuwR's Homepage
if you are deleting a topic, for completeness you should also delete any replies otherwise there will be redundant records.<
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 02 July 2008 :  11:39:41  Show Profile
carefree I tried the suggested and the following error message displays in cal_delete
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/forum/cal_delete.asp, line 123
line 123 in red
'## Don't update if topic was in archive
if (Topic_Status <= 1) and (ArchiveView = "") then
strSql = "DELETE FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID = " & TOPIC_ID
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

strSql = "UPDATE " & strTablePrefix & "FORUM "
strSql = strSql & " SET F_COUNT = F_COUNT - " & cLng(risposte) + 1
strSql = strSql & ", F_TOPICS = F_TOPICS - " & 1
strSql = strSql & ", F_LAST_POST = '" & strLast_Post & "' "
strSql = strSql & ", F_LAST_POST_AUTHOR = " & strLast_Post_Author
strSql = strSql & ", F_LAST_POST_TOPIC_ID = " & strLast_Post_Topic_ID
strSql = strSql & ", F_LAST_POST_REPLY_ID = " & strLast_Post_Reply_ID
strSql = strSql & " WHERE FORUM_ID = " & Forum_ID

my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

'## Forum_SQL - Update total TOPICS in Totals table
strSql = "UPDATE " & strTablePrefix & "TOTALS "
strSql = strSql & " SET T_COUNT = T_COUNT - " & 1
strSql = strSql & ", P_COUNT = P_COUNT - " & cLng(risposte) + 1
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end if
<
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 02 July 2008 :  12:18:17  Show Profile  Visit HuwR's Homepage
can you add the following lines between 122 and 123

Response.write(strSql)
Response.End

and post what the query looks like for us<
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  12:28:41  Show Profile
quote:
Originally posted by HuwR

if you are deleting a topic, for completeness you should also delete any replies otherwise there will be redundant records.



ok - This should get rid of replies, too. The risposte issue pointed out below was probably causing Andy's error.



					if (Topic_Status <= 1) and (ArchiveView = "") then
						strSql = "DELETE FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID = " & TOPIC_ID
						my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
						
						strSql = "DELETE FROM " & strTablePrefix & "REPLY "
						strSql = strSql & " WHERE TOPIC_ID = " & TOPIC_ID
						my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

						strSql = "UPDATE " & strTablePrefix & "FORUM "
						strSql = strSql & " SET F_COUNT = F_COUNT - " & 1
						strSql = strSql & ", F_TOPICS = F_TOPICS - " & 1				
						strSql = strSql & ", F_LAST_POST = '" & strLast_Post & "' "
						strSql = strSql & ", F_LAST_POST_AUTHOR = " & strLast_Post_Author
						strSql = strSql & ", F_LAST_POST_TOPIC_ID = " & strLast_Post_Topic_ID
						strSql = strSql & ", F_LAST_POST_REPLY_ID = " & strLast_Post_Reply_ID
						strSql = strSql & " WHERE FORUM_ID = " & Forum_ID
						my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

						'## Forum_SQL - Update total TOPICS in Totals table
						strSql = "UPDATE " & strTablePrefix & "TOTALS "
						strSql = strSql & " SET T_COUNT = T_COUNT - " & 1
						strSql = strSql & ",    P_COUNT = P_COUNT - " & 1
						my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
					end if
<

Edited by - Carefree on 02 July 2008 15:11:25
Go to Top of Page

modifichicci
Average Member

Italy
787 Posts

Posted - 02 July 2008 :  12:35:28  Show Profile  Visit modifichicci's Homepage
You have implemented my mod Decrease member post count on delete, as I can see from cLng(risposte) so there are many code lines before that
If you don't get risposte you could have an error..<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  12:43:49  Show Profile
There, that should fix the risposte issue.<

Edited by - Carefree on 02 July 2008 12:45:34
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 02 July 2008 :  13:03:31  Show Profile
Nearly there, I receive this error
<font color="purple">Microsoft VBScript compilation error '800a03f6'
Expected 'End'
/forum/cal_delete.asp, line 173 </font id="purple">
where 173 is in red
<%
'****************************************************************
'  cal.asp
'  EVENTS CALENDAR MOD
'  for Snitz Forums 3.4.05
'  by red1
'
'  Pop-up for deleting individual dates
'****************************************************************
%>

<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_func_secure.asp" -->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header_short.asp" -->

<% 

Topic_ID = cLng(Request("TOPIC_ID"))
Event_Date = cDate(Request("DATE"))
Mode_Type = Trim(ChkString(Request("mode"), "SQLString"))
strPassword = Trim(Request.Form("Pass"))


if Mode_Type = "DeleteDate" then
    'Get the Forum_ID & Cat_ID
    strSQL = "SELECT FORUM_ID, CAT_ID FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID = " & Topic_ID
    set rsCal = Server.CreateObject("ADODB.Recordset")
    rsCal.Open StrSql, My_conn

    if not rsCal.EOF then
        Forum_ID = CInt(rsCal("FORUM_ID"))
        Cat_ID = CInt(rsCal("CAT_ID"))
    else
        Forum_ID = 0
        Cat_ID = 0
    end if

    rsCal.Close
    set rsCal = nothing 
    
    strEncodedPassword = sha256("" & strPassword)

    mLev = cLng(chkUserCal(strDBNTFUserName, strEncodedPassword, Topic_ID))
    if mLev > 0 then  '## is Member
        if (chkForumModerator(Forum_ID, strDBNTFUserName) = "1") or (mLev = 1) or (mLev = 4) then
            delAr = split(Topic_ID, ",")
            delAr2 = split(Event_Date, ",")
            for i = 0 to ubound(delAr)
                for j = 0 to ubound(delAr2)
                    '## Forum_SQL - Delete any dates related to this topic
                    strSql = "DELETE FROM " & strTablePrefix & "CAL_EVENTS "
                    strSql = strSql & " WHERE TOPIC_ID = " & cLng(delAr(i))
                    strSql = strSql & " AND EVENT_DATE = '" & DateToStr(cDate(delAr2(j))) & "'"
                    my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
    next
     next
            Response.Write  "      <p align=""center""><font size=""" & strHeaderFontSize & """><b>Date Deleted!</b></font></p>" & vbNewLine & _
                            "      <script language=""javascript1.2"">self.opener.location.reload();</script>" & vbNewLine
        else
            Response.Write  "      <p align=""center""><font size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """><b>No Permissions to Delete Date</b></font><br />" & vbNewLine & _
                            "<br /><font size=""" & strDefaultFontSize & """><a href=""JavaScript:onClick=history.go(-1)"">Go Back to Re-Authenticate</a></font></p>" & vbNewLine
        end if
    else
        Response.Write  "      <p align=""center""><font size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """><b>No Permissions to Delete Date</b></font><br />" & vbNewLine & _
                        "<br /><font size=""" & strDefaultFontSize & """><a href=""JavaScript:onClick=history.go(-1)"">Go Back to Re-Authenticate</a></font></p>" & vbNewLine
    end if 

else
    Response.Write  "      <p align=""center""><font size=""" & strHeaderFontSize & """>Delete Date"

    Response.Write  "</font></p>" & vbNewLine & _
                    "      <p align=""center""><font size=""" & strDefaultFontSize & """><b><font color=""" & strHiLiteFontColor & """>NOTE: </font></b>"
    Response.Write("Only Moderators and Administrators, or the Author of a Topic can delete Dates.")
    Response.Write  "</font></p>" & vbNewLine & _
                    "      <form action=""cal_delete.asp?mode=DeleteDate"" method=""post"" id=""Form1"" name=""Form1"">" & vbNewLine & _
                    "      <input type=""hidden"" name=""TOPIC_ID"" value=""" & Topic_ID & """>" & vbNewLine & _
                    "      <input type=""hidden"" name=""DATE"" value=""" & Event_Date & """>" & vbNewLine & _
                    "      <table border=""0"" cellspacing=""0"" cellpadding=""0"">" & vbNewLine & _
                    "        <tr>" & vbNewLine & _
                    "          <td bgcolor=""" & strPopUpBorderColor & """>" & vbNewLine & _
                    "            <table border=""0"" width=""100%"" cellspacing=""1"" cellpadding=""1"">" & vbNewLine
    if strAuthType = "db" then
        Response.Write  "              <tr>" & vbNewLine & _
                        "                <td bgColor=""" & strPopUpTableColor & """ align=""right"" nowrap><b><font size=""" & strDefaultFontSize & """>User Name:</font></b></td>" & vbNewLine & _
                        "                <td bgColor=""" & strPopUpTableColor & """><input type=""text"" maxLength=""25"" name=""User"" value=""" & chkString(strDBNTUserName,"display") & """ style=""width:150px;""></td>" & vbNewLine & _
                        "              </tr>" & vbNewLine & _
                        "              <tr>" & vbNewLine & _
                        "                <td bgColor=""" & strPopUpTableColor & """ align=""right"" nowrap><b><font size=""" & strDefaultFontSize & """>Password:</font></b></td>" & vbNewLine & _
                        "                <td bgColor=""" & strPopUpTableColor & """><input type=""Password"" maxLength=""25"" name=""Pass"" value="""" style=""width:150px;""></td>" & vbNewLine & _
                        "              </tr>" & vbNewLine
    else
        if strAuthType = "nt" then
            Response.Write  "              <tr>" & vbNewLine & _
                            "                <td bgColor=""" & strPopUpTableColor & """ align=""right"" nowrap><b><font size=""" & strDefaultFontSize & """>NT Account:</font></b></td>" & vbNewLine & _
                            "                <td bgColor=""" & strPopUpTableColor & """><font size=""" & strDefaultFontSize & """>" & strDBNTUserName & "</font></td>" & vbNewLine & _
                            "              </tr>" & vbNewLine
        end if
    end if
    Response.Write  "              <tr>" & vbNewLine & _
                    "                <td bgColor=""" & strPopUpTableColor & """ colspan=""2"" align=""center""><input type=""Submit"" value=""Send"" id=""Submit1"" name=""Submit1""></td>" & vbNewLine & _
                    "              </tr>" & vbNewLine & _
                    "            </table>" & vbNewLine & _
                    "          </td>" & vbNewLine & _
                    "        </tr>" & vbNewLine & _
                    "      </table>" & vbNewLine & _
                    "      </form>" & vbNewLine
end if
'###
if (Topic_Status <= 1) and (ArchiveView = "") then
      strSql = "DELETE FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID = " & TOPIC_ID
      my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
      
      strSql = "DELETE FROM " & strActivePrefix & "REPLY "
      strSql = strSql & " WHERE TOPIC_ID = " & TOPIC_ID
      my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

      strSql = "UPDATE " & strTablePrefix & "FORUM "
      strSql = strSql & " SET F_COUNT = F_COUNT - " & 1
      strSql = strSql & ", F_TOPICS = F_TOPICS - " & 1    
      strSql = strSql & ", F_LAST_POST = '" & strLast_Post & "' "
      strSql = strSql & ", F_LAST_POST_AUTHOR = " & strLast_Post_Author
      strSql = strSql & ", F_LAST_POST_TOPIC_ID = " & strLast_Post_Topic_ID
      strSql = strSql & ", F_LAST_POST_REPLY_ID = " & strLast_Post_Reply_ID
      strSql = strSql & " WHERE FORUM_ID = " & Forum_ID
      my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

      '## Forum_SQL - Update total TOPICS in Totals table
      strSql = "UPDATE " & strTablePrefix & "TOTALS "
      strSql = strSql & " SET T_COUNT = T_COUNT - " & 1
      strSql = strSql & ",    P_COUNT = P_COUNT - " & 1
      my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
'###
WriteFooterShort
Response.End


'This function checks if the user is allowed to delete a particular date
function chkUserCal(fName, fPassword, fTopic)
    '## Forum_SQL
    strSql = "SELECT M.MEMBER_ID, M.M_LEVEL, M.M_NAME, M.M_PASSWORD, T.T_AUTHOR, T.T_REPLIES "
    strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS M, " & strTablePrefix & "TOPICS T "
    StrSql = strSql & " WHERE M." & strDBNTSQLName & " = '" & fName & "' "
    if strAuthType="db" then
        strSql = strSql & " AND M.M_PASSWORD = '" & fPassword &"' "
    End If
    strSql = strSql & " AND T.TOPIC_ID = " & fTopic
    strSql = strSql & " AND M.M_STATUS = " & 1
    
    set rsCheck = my_Conn.Execute (strSql)
    
    if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) then
        chkUserCal = 0 '## Invalid Password
    else
        if cLng(rsCheck("MEMBER_ID")) = cLng(rsCheck("T_AUTHOR")) then 
            chkUserCal = 1 '## Author
        else
            Select case cLng(rsCheck("M_LEVEL"))
                case 1
                    chkUserCal = 2 '## Normal User
                case 2
                    chkUserCal = 3 '## Moderator
                case 3
                    chkUserCal = 4 '## Admin
                case else
                    chkUserCal = cLng(rsCheck("M_LEVEL"))
            End Select
        end if  
    end if
    
    rsCheck.close   
    set rsCheck = nothing
<font color="red">end function</font id="red">
%>
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  14:02:08  Show Profile
You're missing an end if just before the writefooter.<
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 02 July 2008 :  14:05:10  Show Profile
I assume:

end
WriteFooterShort
Response.End


<
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  14:22:55  Show Profile
No, "end if"<
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 02 July 2008 :  14:55:57  Show Profile
That was done then then:
Microsoft OLE DB Provider for ODBC Drivers error '80040e37'

[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot find the input table or query 'REPLY'. Make sure it exists and that its name is spelled correctly.

/forum/cal_delete.asp, line 116



strSql = "DELETE FROM " & strActivePrefix & "REPLY "
strSql = strSql & " WHERE TOPIC_ID = " & TOPIC_ID
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords


I appreciate the support Carefree Thank you so far..<
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  15:10:56  Show Profile
Change the word Active to the word Table in the second set of sql.<
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  15:19:44  Show Profile
Fixed the routine:


	if (Topic_Status <= 1) and (ArchiveView = "") then
		strSQL = "SELECT FORUM_ID FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID = " & TOPIC_ID
		set rsCal = Server.CreateObject("ADODB.Recordset")
		rsCal.Open StrSql, My_conn
		strSql = "DELETE FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID = " & TOPIC_ID
		my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
						
		strSql = "DELETE FROM " & strTablePrefix & "REPLY"
		strSql = strSql & " WHERE TOPIC_ID = " & TOPIC_ID
		my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

		strSql = "UPDATE " & strTablePrefix & "FORUM"
		strSql = strSql & " SET F_COUNT = F_COUNT - " & 1
		strSql = strSql & ", F_TOPICS = F_TOPICS - " & 1				
		strSql = strSql & " WHERE FORUM_ID = " & rsCal("FORUM_ID")
		my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

		strSql = "UPDATE " & strTablePrefix & "TOTALS"
		strSql = strSql & " SET T_COUNT = T_COUNT - " & 1
		strSql = strSql & ",    P_COUNT = P_COUNT - " & 1
		my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
	end if
<

Edited by - Carefree on 02 July 2008 15:21:02
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 02 July 2008 :  16:29:26  Show Profile
Carefree I thought we had it, selecting an event for delete there was a slight delay and the popup cal_delete appears prompting for password etc by underneath the submit button we have
error '80020009'
/forum/cal_delete.asp, line 125



line 125 is
strSql = strSql & " WHERE FORUM_ID = " & rsCal("FORUM_ID")

Mega apologies for absorbing so much of you valuable time it is greatly appreciated what you have done and the support is second to none..
<
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.43 seconds. Powered By: Snitz Forums 2000 Version 3.4.07