home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / survey / DeleteUser.asp < prev    next >
Text File  |  2006-11-29  |  2KB  |  49 lines

  1. <!--#Include File="Include/Top_inc.asp"-->
  2. <%
  3. '***********************************************************************
  4. '   Application: SelectSurveyASP Advanced v8.1.11
  5. '   Author: Aaron Baril for ClassApps.com
  6. '   Page Description: This page deletes a single user.
  7. '
  8. '   COPYRIGHT NOTICE                                
  9. '
  10. '   See attached Software License Agreement
  11. '
  12. '   (c) Copyright 2002 - 2006 by ClassApps.com.  All rights reserved.
  13. '***********************************************************************
  14. %>
  15. <!--#Include File="Include/Config_inc.asp"-->
  16. <!--#Include File="Include/Utility_inc.asp"-->
  17. <!--#Include File="Include/adovbs_inc.asp"-->
  18. <!--#Include File="Include/ID_inc.asp"-->
  19. <!--#Include File="Include/CurrentUser_inc.asp"-->
  20. <!--#Include File="Include/SurveySecurity_inc.asp"-->
  21. <!--#Include File="Include/Constants_inc.asp"-->
  22. <%
  23.     'In order to delete a user, the user must have "Admin" permission
  24.     If lngUserSecurityLevel <> SUR_SECURITY_LEVEL_ADMIN Then
  25.         Response.Redirect "AccessDenied.asp?Reason=" & SUR_ACCESS_DENIED_NOT_ADMIN_SECURITY_LEVEL
  26.     End If
  27.  
  28.     Dim strSQL
  29.     Dim conDeleteUser
  30.     
  31.     'Initialization
  32.     Set conDeleteUser = Server.CreateObject("ADODB.Connection")
  33.     conDeleteUser.Open SURVEY_APP_CONNECTION
  34.     
  35.     'Delete the entry from the role to user mapping table (SUR_USER_TO_ROLE_MAPPING)
  36.     strSQL = "DELETE FROM sur_user_to_role_mapping WHERE user_id = " & Request.QueryString("UserID")
  37.     conDeleteUser.Execute ConvertSQL(strSQL), , adCmdText
  38.  
  39.     'Delete the user from the user table (SUR_USER)
  40.     strSQL = "DELETE FROM sur_user WHERE user_id = " & Request.QueryString("UserID")
  41.     conDeleteUser.Execute ConvertSQL(strSQL), , adCmdText
  42.  
  43.     'Clean up
  44.     conDeleteUser.Close
  45.     Set conDeleteUser = Nothing
  46.  
  47.     'Only admins can delete users, so direct back to the list of users.
  48.     Response.Redirect "UserList.asp"
  49. %>