%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="userEdit,webmaster"
MM_authFailedURL="/Bookings/Secure/sorryAccess.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%' Trevs - set error message IN CASE the user already exists
Session("errMsg") = "A user with this name already exists on the system"%>
<%
' *** Redirect if username exists
MM_flag = "MM_insert"
If (CStr(Request(MM_flag)) <> "") Then
Dim MM_rsKey
Dim MM_rsKey_cmd
MM_dupKeyRedirect = "/Bookings/LdrManage/sorryLdr.asp"
MM_dupKeyUsernameValue = CStr(Request.Form("uName"))
Set MM_rsKey_cmd = Server.CreateObject ("ADODB.Command")
MM_rsKey_cmd.ActiveConnection = MM_trevs_STRING
MM_rsKey_cmd.CommandText = "SELECT uName FROM users WHERE uName = ?"
MM_rsKey_cmd.Prepared = true
MM_rsKey_cmd.Parameters.Append MM_rsKey_cmd.CreateParameter("param1", 200, 1, 31, MM_dupKeyUsernameValue) ' adVarChar
Set MM_rsKey = MM_rsKey_cmd.Execute
If Not MM_rsKey.EOF Or Not MM_rsKey.BOF Then
' the username was found - can not add the requested username
MM_qsChar = "?"
If (InStr(1, MM_dupKeyRedirect, "?") >= 1) Then MM_qsChar = "&"
MM_dupKeyRedirect = MM_dupKeyRedirect & MM_qsChar & "requsername=" & MM_dupKeyUsernameValue
Response.Redirect(MM_dupKeyRedirect)
End If
MM_rsKey.Close
End If
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "newUform") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_trevs_STRING
MM_editCmd.CommandText = "INSERT INTO users (uFullname, uPrefName, uEmail, uName, uPW, uAccess, uPhone, membNum, [1stAidType], uNotes, crbTo, [1stAidEnd]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 31, Request.Form("uFullName")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, Request.Form("uPrefName")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("uEmail")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 31, Request.Form("uName")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 31, Request.Form("uPswd")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 31, Request.Form("uAccess")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 202, 1, 50, Request.Form("uPhone")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 202, 1, 32, Request.Form("membNum")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 202, 1, 32, Request.Form("1stAidType")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 202, 1, 255, Request.Form("uNotes")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 135, 1, -1, MM_IIF(Request.Form("crbTo"), Request.Form("crbTo"), null)) ' adDBTimeStamp
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param12", 135, 1, -1, MM_IIF(Request.Form("1stAidEnd"), Request.Form("1stAidEnd"), null)) ' adDBTimeStamp
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "/Bookings/LdrManage/manageLdrs.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<%
Dim users
Dim users_cmd
Dim users_numRows
Set users_cmd = Server.CreateObject ("ADODB.Command")
users_cmd.ActiveConnection = MM_trevs_STRING
users_cmd.CommandText = "SELECT * FROM users"
users_cmd.Prepared = true
Set users = users_cmd.Execute
users_numRows = 0
%>
<%
Dim editUser__MMColParam
editUser__MMColParam = "0"
If (Request.QueryString("IDusers") <> "") Then
editUser__MMColParam = Request.QueryString("IDusers")
End If
%>
<%
Dim editUser
Dim editUser_cmd
Dim editUser_numRows
Set editUser_cmd = Server.CreateObject ("ADODB.Command")
editUser_cmd.ActiveConnection = MM_trevs_STRING
editUser_cmd.CommandText = "SELECT * FROM users WHERE IDusers = ?"
editUser_cmd.Prepared = true
editUser_cmd.Parameters.Append editUser_cmd.CreateParameter("param1", 5, 1, -1, editUser__MMColParam) ' adDouble
Set editUser = editUser_cmd.Execute
editUser_numRows = 0
%>
Rhydd Covert New Leader / User
Rhydd Activity Tracking System Add Activity Leader / User
Activity Permits: Once a user has been created then that user can have activity permits assigned to them.
This will enable the user to be assigned to booked activities that require permit holding activity leaders.
Note: First aid and CRB expiry is recoded on the Users contact information as it applies across all acivites.
Access Codes - Dictates what user can do on whole RATS system.
Blocked / View Only : will only allow people to see some things.
Act Leader : Activity Leaders can view the ACTIVITY bookings and volunteer for them - if permit page allows they can edit those bookings.
Edit Bookings : This is for ALL bookings inc' Visits, Sites, Equipment.
Manager : All the above plus creating / editing other users access rights.
<%
users.Close()
Set users = Nothing
%>
<%
editUser.Close()
Set editUser = Nothing
%>
<%
Function USDate(x)
If Not IsDate(x) Then Exit Function
USDate = Month(x) & "/" & Day(x) & "/" & Year(x)
End Function
%>
<%
Function dateShort(x)
If Not IsDate(x) Then Exit Function
dateShort=""
dateShort = Day(x) & "/"
dateShort=dateShort & Month(x) & "/"
dateShort=dateShort & Right(Year(x),2)
End Function
%>