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
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 3

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  17:23:28  Show Profile
sql must do a great job of forgetting values lol

OK - this will assign that value to a variable that shouldn't disappear as soon as the conn.execute completes.

At the top of the page, add this:

dim calfid

Then replace the delete routine with this:


	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
		calfid = rsCal("FORUM_ID")
		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 = " & calfid
		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
<
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 02 July 2008 :  17:45:50  Show Profile
Square two: select event for delete, I get the pop up, add password, new error:
Then No Permissions to Delete Date
Go Back to Re-Authenticate
ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/forum/cal_delete.asp, line 117


line 117 is your new dim
calfid = rsCal("FORUM_ID")

Refresh the cal.asp and the event and reply is deleted ok..

Is this permissions any thing to do with the last routine at the bottom of the file
'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
end function
%>



Fingers crossed ,,,
<
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  17:49:01  Show Profile
Change line 117 to say this, checking for end/beginning of file:

if not rsCal.BOF and not rsCal.EOF then calfid = rsCal("FORUM_ID")
<
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 02 July 2008 :  18:00:55  Show Profile
ohhh!
we have
No Permissions to Delete Date
Go Back to Re-Authenticate
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'FORUM_ID ='.
/forum/cal_delete.asp, line 129


line 129 in red
strSql = "UPDATE " & strTablePrefix & "FORUM"
strSql = strSql & " SET F_COUNT = F_COUNT - " & 1
strSql = strSql & ", F_TOPICS = F_TOPICS - " & 1
strSql = strSql & " WHERE FORUM_ID = " & calfid
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords


soon, fingers crossed.. thanks again..........<
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  18:14:57  Show Profile
I know what's happening, it's trying to do it twice. After this bit,

    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


Delete the line saying "end if".

Then add a line saying "end if" immediately before writefooter (you'll have two "end if" lines in a row).

That'll enclose the deletion routine and stop it from attempting it twice.

Seems like it's working except for the no-permissions blurb. I'll have to check that routine.<

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

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 02 July 2008 :  18:29:37  Show Profile
Still err, so close

No Permissions to Delete Date
Go Back to Re-Authenticate
Close Window


The event and reply has been deleted though "No Permissions to Delete Date" is that something to do with the last function? which is after 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
end function
%>



<

Edited by - Andy Humm on 02 July 2008 18:31:13
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  18:31:21  Show Profile
OK - I think this is it. I moved the entire routine. No more changes, right?????


<%
'################################################################################
'## Snitz Forums 2000 v3.4.06                          #
'################################################################################
'## Copyright (C) 2000-06 Michael Anderson, Pierre Gorissen,          #
'##                       Huw Reddick and Richard Kinser            #
'##                                       #
'## This program is free software; you can redistribute it and/or        #
'## modify it under the terms of the GNU General Public License         #
'## as published by the Free Software Foundation; either version 2       #
'## of the License, or (at your option) any later version.           #
'##                                       #
'## All copyright notices regarding Snitz Forums 2000              #
'## must remain intact in the scripts and in the outputted HTML         #
'## 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 of       #
'## MERCHANTABILITY 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      #
'## along with this program; if not, write to the 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                             #
'##                                       #
'################################################################################

'****************************************************************
'  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" -->
<% 
DIM FID,TID
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 > 2) 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

      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
       if not rsCal.BOF and not rsCal.EOF then fid = rsCal("FORUM_ID")
       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 = " & fid
       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

         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

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
end function
%>
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 02 July 2008 :  18:37:44  Show Profile
OK - I think this is it. I moved the entire routine. No more changes, right?????
Your a genius and where did you learn all these tricks of the trade... I am impressed and I don't think you'll know or realise how greatful I am, a BIG THANK YOU from rainy old UK.. <
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 02 July 2008 :  18:52:54  Show Profile
You're quite welcome. Just wish I could get that goofy message issue fixed and we'd be done with this.<
Go to Top of Page

Panhandler
Average Member

USA
783 Posts

Posted - 03 July 2008 :  10:16:32  Show Profile  Visit Panhandler's Homepage
  • Okay. . .I'm trying to follow along and it looks like my current cal_delete.asp should be replaced with your improved code, right?
  • pop_delete.asp was mentioned at the beginning of this thread. . .are changes required there as well?


<
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 03 July 2008 :  10:53:29  Show Profile
No, pop delete functions properly with the mod from the events calendar's setup instructions. The extensive modification for the cal_delete.asp was required to give it identical capabilities.<
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 03 July 2008 :  12:00:48  Show Profile
Panhandler: Okay. . .I'm trying to follow along and it looks like my current cal_delete.asp should be replaced with your improved code, right?
Absolutely, but the pop_delete.asp is okay
For the completed cal_delete.asp code look on page 1 of this thread - Carefree's posting Posted - 02 July 2008 : 18:31:21

<
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 05 July 2008 :  16:39:33  Show Profile
Further to another investigation regarding the vents calendar mod, Carefree has highlighted that Modifichicci's Post Count Mod within pop_delete has a lot of occasions where Italian is among the modded code. Firstly will this have an effect on the file or has these Italian varables been accounted for.
Example: Autore_Replica, Status_Replica = rs("R_STATUS"), Autore_Replica = rs("R_AUTHOR"), Forum_Replica = rs("FORUM_ID"), strSql = strSql & " WHERE MEMBER_ID = " & Topic_Autore

There are others but should these be coverted to English..<
Go to Top of Page

modifichicci
Average Member

Italy
787 Posts

Posted - 05 July 2008 :  16:57:14  Show Profile  Visit modifichicci's Homepage
That isn't important. Whatever is the name , it is sufficient that it is always the same.
You can call them xxxxyyy and it doesn't affect the result.
Variable name is an help for programmer to remaind what is it.

Or snitz could not work in italian versions as all variables are in English..
<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum

Edited by - modifichicci on 05 July 2008 16:59:25
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 09 September 2008 :  10:41:26  Show Profile
Since, the initial post "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." Solutions were provided above which sorted the problem and removed any associated replies with the event.

However, I have noticed if you have recurring dates i.e. 9, 10, 11, 12 Sep and you delete any of the individual dates i.e. 11 Sep on its own, all the complete set of dates are deleted and their replies.
<
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Previous Page | 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.33 seconds. Powered By: Snitz Forums 2000 Version 3.4.07