<% Dim db,rst,DSNtemp,fso Dim userids,deleteids,names,usernames Dim i,fldname,folder,fileid,userid,authenticated authenticated = Session("PrivateAreaAuthenticated") If authenticated <> True Then Response.Redirect("http://www.goaction.com") ElseIf Session("PrivateAreaAdmin") <> True Then Response.Redirect(Session("PrivateAreaUserpage")) End if Set db = Server.CreateObject("ADODB.Connection") Set rst = Server.CreateObject("ADODB.Recordset") DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/data/private.mdb") db.Open DSNtemp deleteids = "" If Not IsNull(Request.QueryString("UserIDs")) Then deleteids = Request.QueryString("UserIDs") End If %> Action Systems: Private Download Area: Admin Page: Delete users
Private Download Area
Admin Page
Delete user(s)
<% names = "" If deleteids <> "" Then userids = split(deleteids,"|",-1,1) For i = 0 to UBound(userids) Set rst = db.Execute("SELECT UserID,UserName FROM tblUser WHERE UserID=" & userids(i)) fldname = "" If Not rst.EOF Then names = names & rst("UserName") & "|" fldname = rst("UserName") End If rst.Close Set rst = Nothing If fldname <> "" Then Set fso = Server.CreateObject("Scripting.FileSystemObject") folder = Server.MapPath("/private/" & fldname) If fso.FolderExists(folder) Then fso.DeleteFolder(folder) End if Set fso = Nothing End If Set rst = db.Execute("SELECT * FROM qryUserFiles WHERE UserID=" & userids(i)) Do While Not rst.EOF userid = rst("UserID") If rst("FileID") <> "" Or Not IsNull(rst("FileID")) Then fileid = rst("FileID") db.Execute("DELETE FROM tblUserFiles WHERE UserID=" & userid & " AND FileID=" & fileID) db.Execute("DELETE FROM tblFiles WHERE FileID=" & fileid) End If db.Execute("DELETE FROM tblUser WHERE UserID=" & userid) rst.MoveNext Loop Next Response.Write "Successfully deleted the following user(s):
" usernames = split(names,"|",-1,1) For i = 0 to UBound(usernames) Response.Write usernames(i) & "
" Next End If db.Close Set db = Nothing %>

Close this window