%
If Not session("admin_loggedin" & strSUnique) = Session.SessionID then Response.Redirect "default.asp"
Application("Cat_List" & strUnique) = Empty
catID = CLng(Request.Form("catID"))
subcatID = CLng(Request.Form("subcatID"))
cat3rdID = Request.Form("cat3rdID")
If IsNumeric(cat3rdID) then cat3rdID = CLng(cat3rdID)
flag = Request.Form("submitFlag")
Select Case flag
Case "delcat"
Set rs = objConn.Execute("SELECT ads FROM " & tablPfx & "Cat WHERE catID=" & catID & ";")
If not rs.EOF then
If CLng(rs(0)) > 0 then
Response.Write "
Cannot Remove category! Category List is not Empty! All ads (including expired and pending) must be removed first. <<back"
Else
rs.Close
objConn.Execute("DELETE FROM " & tablPfx & "Cat WHERE catID=" & catID & ";")
Set rs = objConn.Execute("SELECT sCatID FROM " & tablPfx & "Scat WHERE catID=" & catID & ";")
If Not rs.EOF then
Do While Not rs.EOF
sCatID = rs(0)
objConn.Execute("DELETE FROM " & tablPfx & "Scat WHERE catID = " & sCatID & ";")
rs.MoveNext
Loop
End If
rs.close
objConn.Execute("DELETE FROM " & tablPfx & "Scat WHERE catID=" & catID & ";")
Response.Redirect "admin_cat.asp"
End If
Else: Response.Write "
Cannot find seleceted category!"
End If
rs.Close
Case "delscat"
strSCat = "SELECT " & tablPfx & "Scat.* from " & tablPfx & "Scat WHERE catID=" & catID & ";"
rs.CursorLocation = 3
rs.CursorType = 3
rs.Open strSCat, strConn
rc = rs.RecordCount
If not rs.EOF then
If rc > 1 then
removeSCat = True
Else
Response.Write "
You have selected the Last Subcategory in Category. Cannot Remove!<<back"
removeSCat = False
End If
End If
rs.close
If removeSCat then
Set rs = objConn.Execute("SELECT ads FROM " & tablPfx & "Scat WHERE sCatID=" & subcatID & ";")
If CLng(rs("ads")) > 0 then
Response.Write "
Cannot Remove Subcategory! Subcategory List is not Empty! All ads (including expired and pending) must be removed first. <<back"
Else
rs.close
objConn.Execute("DELETE FROM " & tablPfx & "Scat WHERE catID = " & subcatID & ";")
objConn.Execute("DELETE FROM " & tablPfx & "Scat WHERE sCatID = " & subcatID & ";")
Response.Redirect "admin_cat.asp?cid=" & catID
End If
rs.close
End If
Case "del3rdcat"
objConn.Execute("DELETE FROM " & tablPfx & "Scat WHERE sCatID = " & cat3rdID & ";")
Response.Redirect "admin_cat.asp?cid=" & catID & "&subcatID=" & subcatID
End Select
%>