%
if session("AccessLevel") <> "1" then
response.redirect "login.asp"
end if
strUserName = request("Id")
'strUserName = session("UserName2")
Response.Expires = 0
Response.Buffer = True
' Create a recordset object to store specific table information
Set objRS = Server.CreateObject("ADODB.Recordset")
'Establish what records you want selected for the SQL query string
SQL = "Select * From TblLogin where (UserName = '" + strUserName + "')"
'Set the recordset object equal to the SQL query string
objRS.Open SQL, objADO, 1, 3
'Retrieving database info.
strUserName = objRs.Fields("UserName")
strPassword = objRs.Fields("Password")
strFirstName = objRs.Fields("FirstName")
strLastName = objRs.Fields("LastName")
strCompany = objRs.Fields("AgencyName")
strWebsite = objRs.Fields("Website")
strAddress = objRs.Fields("Address")
strCity = objRs.Fields("City")
strState = objRs.Fields("State")
strZip = objRs.Fields("Zip")
strCountry = objRs.Fields("Country")
strPhoneNumber = objRs.Fields("PhoneNumber")
strFaxNumber = objRs.Fields("FaxNumber")
strCell = objRs.Fields("CellPhone")
strPager = objRs.Fields("Pager")
strEmailAddress = objRs.Fields("EmailAddress")
strDescription = objRs.Fields("AgentDescription")
strServiceCategory = objRs.Fields("ServiceCategory")
strAccessLevel = objRs.Fields("AccessLevel")
'Retrieving form input and assigning to a variable
'txtLastName is the name of the text box on the form
'strUserName2 = Request.Form ("txtUserName")
strPassword2 = Request.Form("txtPassword")
strLastName2 = Request.Form ("txtLastName")
strFirstName2 = Request.Form("txtFirstName")
strCompany2 = Request.Form ("txtAgencyName")
strWebsite2 = Request.Form ("txtWebsite")
strAddress2 = Request.Form("txtAddress")
strCity2 = Request.Form("txtCity")
strState2 = Request.Form("cboState")
strZip2 = Request.Form("txtZip")
strCountry2 = Request.Form ("Country")
strPhoneNumber2 = Request.Form("txtPhoneNumber")
strCell2 = Request.Form ("txtCell")
strPager2 = Request.Form ("txtPager")
strFaxNumber2 = Request.Form("txtFaxNumber")
strEmailAddress2 = Request.Form("txtEmailAddress")
strDescription2 = Request.Form ("txtDescription")
strServiceCategory2 = Request.Form ("ServiceCategory")
if session("AccessLevel") = "1" then
strAccessLevel2 = Request.Form("txtAccessLevel")
else
strAccessLevel2 = objRs.Fields("AccessLevel")
end if
'This code only runs if the submit button is clicked
if Request.Form <> "" then
'Sets an error message if any required fields are left blank
if strPassword2 = "" or strLastName2 = "" or strFirstName2 = "" or strCompany2 = "" or strAddress2 = "" or strcity2 = "" or strState2 = "" or strZip2 = "" or strCountry2 = ""or strPhoneNumber2 = "" or strEmailAddress2 = "" or strAccessLevel2 = "" then
WarningErrMsg = "
Fields marked with an * are required."
end if
if not isnumeric(strPhoneNumber2) and strPhoneNumber2 <> "" then
warningErrMsg = WarningErrMsg + "
Phone # can only contain numbers."
end if
if strPhoneNumber2 <> "" and len(strPhoneNumber2)<> "10" then
warningErrMsg = WarningErrMsg + "
Phone # must contain 10 digits. Please include the area Code."
end if
if not isnumeric(strFaxNumber2) and strFaxNumber2 <> "" then
warningErrMsg = WarningErrMsg + "
Fax # can only contain numbers."
end if
if strFaxNumber2 <> "" and len(strFaxNumber2)<> "10" then
warningErrMsg = WarningErrMsg + "
Fax # must contain 10 digits. Please include the area Code."
end if
if session("AccessLevel") = "1" then
if strAccessLevel2 <> "" and (strAccessLevel2 <> "4" and strAccessLevel2 <> "8") then
warningErrMsg = WarningErrMsg + "
Access Level must be a 4 or 8 for a services account."
end if
end if
'Checks for a valid email address
if strEmailAddress2 <> "" and (instr( strEmailAddress2, "@") = 0 or instr( strEmailAddress2, ".") = 0) then
WarningErrMsg = WarningErrMsg + "
Email Address must be in the form account@server.com."
end if
'If error message was not set, then all error checks were passed; Connect to the database
if warningErrMsg = "" then
' objRs.Fields("UserName") = strUserName2
objRs.Fields("Password") = strPassword2
objRs.Fields("LastName") = strLastName2
objRs.Fields("FirstName") = strFirstName2
objRs.Fields("AgencyName") = strCompany2
objRs.Fields("Website") = strWebsite2
objRs.Fields("AgentDescription") = strDescription2
objRs.Fields("ServiceCategory") = strServiceCategory2
objRs.Fields("Address") = strAddress2
objRs.Fields("City") = strCity2
objRs.Fields("State") = strState2
objRs.Fields("Zip") = strZip2
objRs.Fields("Country") = strCountry2
objRs.Fields("PhoneNumber") = strPhoneNumber2
objRs.Fields("FaxNumber") = strFaxNumber2
objRs.Fields("CellPhone") = strCell2
objRs.Fields("Pager") = strPager2
objRs.Fields("EmailAddress") = strEmailAddress2
objRs.Fields("AccessLevel") = strAccessLevel2
objRs.update
Response.redirect "accountupdated.asp"
end if
end if
%>
EDIT SERVICES ACCOUNT
Edit the user account information below.
Fields marked with an * are required.
| Error(s):<%= warningErrMsg %> |