<% If Not session("admin_loggedin" & strSUnique) = Session.SessionID then Response.Redirect "default.asp" %>
Expired Ads

<% setLocale server_locale sdd = dd(objConn) If not Request.Form("D1") = Empty then baseDate = Date - Request.Form("D1") baseDate = ConvDate(baseDate) strSQL = "SELECT images,userID,adID FROM " & tablPfx & "Ads WHERE " strSQL = strSQL & "((status = 2 OR status = 3) AND edate < " & sdd & baseDate & sdd & ");" set rs = objConn.Execute(strSQL) Do While Not rs.EOF If Not rs.EOF then userID = rs(1) img = rs(0) adID = rs(2) If not img = Empty then On Error Resume Next imgArray = Split(img, sf) For g = 0 to UBound(imgArray) - 1 delImg = uploadPATH & Split(imgArray(g), "|")(0) objFile.DeleteFile(delImg) Next On Error Goto 0 End If objConn.Execute("DELETE FROM " & tablPfx & "Ads WHERE adID = '" & adID & "';") objConn.Execute("UPDATE " & tablUPfx & "User SET ads = ads - 1 WHERE userID = " & CLng(userID) & ";") If isEvents then Call logEvent("Ad Deleted", adID, " (Expired ads page)", Empty, Empty, Empty) On Error Resume Next objFile.DeleteFile(server.mappath(ad_cache) & "\" & adID & ".htm") On Error Goto 0 rs.MoveNext End If Loop rs.close set rs = Nothing End If strSQL = "SELECT adID,userID,pdate,edate,subject,nick,price,hotlist,status FROM " & tablPfx & "Ads WHERE (status = 2 OR status = 3) ORDER BY edate;" set rs = objConn.Execute(strSQL) If rs.EOF then Response.Write "

There are no expired ads in database!

" Else iTotal = rs.getrows numrows=ubound(iTotal,2) 'Response.Write "Total Expired: " & numrows %>
Remove expired ads older than:   

Total Expired: <%= numrows %>
<% I = 1 For rcount = 0 to numrows If I mod 2 = 0 then cellColor = "class='evencell'": Else: cellColor = "class='oddcell'": End If subject = iTotal(4, rcount) If Cbool(iTotal(7, rcount)) then subject = subject & "  " nick = iTotal(5, rcount) setLocale server_locale duration = CDate(iTotal(3, rcount)) - CDate(iTotal(2, rcount)) setLocale resetLocale postedOn = FormatDateTime(iTotal(2, rcount), 2) adID = iTotal(0, rcount) adExp = FormatDateTime(iTotal(3, rcount), 2) userID = iTotal(1, rcount) status = iTotal(8, rcount) With Response .Write "" .Write "" .Write "" .Write "" .Write "" .Write "" .Write "" & vbCrLf End With I = I + 1 Next Response.Write "
Subject User Posted Duration Expired Action
" & subject & "" & nick & "" & postedOn & "" & duration & "" & adExp & "" .Write "Delete " If status = 2 then .Write "Repost": Else: .Write "Enable" .Write "
" %>
<% End If rs.close %>

Refresh | Admin Tasks | Home | Logout