<% '----------------------------------------------------------- '-- TITLE: USER FUNCTIONS '-- AUTHOR: MALCOLM ELSWORTH [malcolm@electricputty.co.uk] '-- LAST MODIFIED: 09-08-05 '-- (C) ELECTRIC PUTTY LIMITED '----------------------------------------------------------- user_id = request("user_id") '----------------------------------------------------------- '-- FUNCTION TO CMS USER INFORMATION '----------------------------------------------------------- function viewAllUsers() dim thisUserID dim thisUserName dim thisUserEmail dim thisUserGroupID dim thisUserGroupName dim thisSecurityLevel dim thisPassword rowClass = "odd" if len(confirmMsg) > 0 then response.write("

" & confirmMsg & "

") else response.write("

 

" & VbCrLf) end if call writeUserErrorMessages() response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) strSQL = ""&_ "SELECT u.keyuser, u.user, u.email_address, u.security_level, u.password, "&_ "g.group_id, g.group_name "&_ "from epcms_users u "&_ "INNER JOIN epcms_groups g ON g.group_id = u.group_id" if session("securityLevel") < 4 then strSQL = strSQL & " WHERE u.security_level < 4" end if strSQL = strSQL & " ORDER BY u.user" Set rs = LoadRSFromDB(strSQL) if not rs.EOF then Do While not rs.EOF thisUserID = rs("keyuser") thisUserName = rs("user") thisUserEmail = rs("email_address") thisSecurityLevel = rs("security_level") thisPassword = rs("password") thisUserGroupID = rs("group_id") thisUserGroupName = rs("group_name") response.write("" & VbCrLf) response.write("" & VbCrLf) if thisSecurityLevel = 1 then thisSecurityLevel = "Contributor" elseif thisSecurityLevel = 2 then thisSecurityLevel = "Editor" elseif thisSecurityLevel = 3 then thisSecurityLevel = "Administrator" elseif thisSecurityLevel = 4 then thisSecurityLevel = "Super" end if response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) if rowClass = "odd" then rowClass = "even" else rowClass = "odd" end if rs.movenext Loop end if rs.close set rs = Nothing response.write("
User nameUser roleUser groupEditDelete
" & thisUserName & "" & thisSecurityLevel & "" & thisUserGroupName & "
") response.write("
" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("
" & VbCrLf) end function '----------------------------------------------------------- '-- FUNCTION TO CMS USER INFORMATION '----------------------------------------------------------- function addEditUser(user_id) dim this_process dim this_screenTitle if len(user_id) > 0 then this_process = "update" strSQL = ""&_ "SELECT u.keyuser, u.user, u.email_address, u.security_level, u.password, "&_ "g.group_id, g.group_name "&_ "from epcms_users u "&_ "INNER JOIN epcms_groups g ON g.group_id = u.group_id "&_ "where keyuser = " & user_id Set rs = LoadRSFromDB(strSQL) if not rs.EOF then thisUserID = rs("keyuser") thisUserName = rs("user") thisUserEmail = rs("email_address") thisSecurityLevel = rs("security_level") thisPassword = rs("password") thisUserGroupID = rs("group_id") thisUserGroupName = rs("group_name") end if set rs = nothing this_screenTitle = "Edit user info" else this_process = "add" this_formAction = "Add user" thisUserName = request.querystring("newUserName") thisUserGroupID = request.querystring("newUserGroup") thisUserEmail = request.querystring("newUserEmail") thisSecurityLevel = request.querystring("newUserSecurityLevel") this_screenTitle = "Add user" end if response.write("

" & this_screenTitle & "

" & VbCrLf) if len(errorMsg) <> 0 then call writeUserErrorMessages() end if response.write("
" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("
" & VbCrLf) end function '----------------------------------------------------------- '-- FUNCTION TO WRITE ERROR MESSAGES '----------------------------------------------------------- sub writeUserErrorMessages() select case errorMsg case "UserNameZeroLength" response.write("

You must enter a user name

" & VbCrLf) case "UserEmailZeroLength" response.write("

You must enter a user email address

" & VbCrLf) case "invalidEmail" response.write("

You must enter a valid email address

" & VbCrLf) case "passwordZeroLength" response.write("

You must enter a password

" & VbCrLf) case "passwordUnconfirmed" response.write("

You must confirm the password

" & VbCrLf) case "userNameInUse" response.write("

This user name is taken. Please enter a different name.

" & VbCrLf) end select end sub %>