home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
bombers.k12.ar.us
/
bombers.k12.ar.us.tar
/
bombers.k12.ar.us
/
survey_unconfigured
/
UserListAction.asp
< prev
Wrap
Text File
|
2006-10-25
|
3KB
|
76 lines
<!--#Include File="Include/Top_inc.asp"-->
<%
'***********************************************************************
' Application: SelectSurveyASP Advanced v8.1.11
' Author: Aaron Baril for ClassApps.com
' Page Description: This page works with UserList.asp, and processes
' the form for updating the active status of all users.
'
' COPYRIGHT NOTICE
'
' See attached Software License Agreement
'
' (c) Copyright 2002 - 2006 by ClassApps.com. All rights reserved.
'***********************************************************************
%>
<!--#Include File="Include/Config_inc.asp"-->
<!--#Include File="Include/Utility_inc.asp"-->
<!--#Include File="Include/adovbs_inc.asp"-->
<!--#Include File="Include/Constants_inc.asp"-->
<!--#Include File="Include/ID_inc.asp"-->
<!--#Include File="Include/CurrentUser_inc.asp"-->
<!--#Include File="Include/SurveySecurity_inc.asp"-->
<%
'If the user does not have "Create" or "Admin" permission, redirect to the access denied page.
If lngUserSecurityLevel <> SUR_SECURITY_LEVEL_CREATE And lngUserSecurityLevel <> SUR_SECURITY_LEVEL_ADMIN Then
Response.Redirect "AccessDenied.asp?Reason=" & SUR_ACCESS_DENIED_NOT_ADMIN_SECURITY_LEVEL
End If
Dim strSQL
Dim conUsers
Dim rsUsers
Dim strActiveIDs
Dim strInactiveIDs
Dim strDeleteIDs
'Initialization
Set conUsers = Server.CreateObject("ADODB.Connection")
Set rsUsers = Server.CreateObject("ADODB.Recordset")
conUsers.Open SURVEY_APP_CONNECTION
'Get a list of all users
strSQL = "SELECT user_id FROM sur_user"
rsUsers.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenForwardOnly, adLockReadOnly, adCmdText
rsUsers.MoveFirst
'Loop through the users. Add each checked user ID to the list of users to delete.
Do While Not rsUsers.EOF
'Check to see whether or not the checkbox was selected
If Request.Form("chkDelete" & CStr(rsUsers("user_id"))) = "on" Then
strDeleteIDs = strDeleteIDs & CStr(rsUsers("user_id")) & ", "
End If
rsUsers.MoveNext
Loop
'If there are any users to be deleted, delete them
If Len(strDeleteIDs) > 0 Then
'Trim off the trailing comma
strDeleteIDs = Left(strDeleteIDs, Len(strDeleteIDs) - 2)
'Create SQL statements to delete the users and execute
strSQL = "DELETE FROM sur_user " & _
"WHERE user_id IN (" & strDeleteIDs & ")"
conUsers.Execute ConvertSQL(strSQL), , adCmdText
strSQL = "DELETE FROM sur_user_to_role_mapping " & _
"WHERE user_id in (" & strDeleteIDs +")"
conUsers.Execute ConvertSQL(strSQL), , adCmdText
End If
'Clean up
conUsers.Close
Set conUsers = Nothing
'Redirect back to the list of users
Response.Redirect "UserList.asp"
%>