<%@Language="VBScript"%> <% font = "Verdana, Arial, Helvetica, sans-serif" fileName = Mid(request.servervariables("SCRIPT_NAME"), InstrRev(request.servervariables("SCRIPT_NAME"), "/") + 1) if isnumeric(request("i")) then subID = clng(request("i")) else subID = 0 if isnumeric(request("a")) then action = clng(request("a")) else action = 1 %>
<% if action = 2 then ' ok, so we're gonna update the info, start the checks isValid = validateInfo(subListname, subListID) ' call validation function if isValid = 1 then ' all valid, update and show success messgae mlConn.Execute("UPDATE ML_Subscribers SET Email = '" & replace(trim(request("email")), "'", "''") & "', Name = '" & replace(trim(request("name")), "'", "''") & "', Format = '" & replace(trim(request("format")), "'", "''") & "' WHERE SubscriberID = " & subID) %>
Your subscription information has been successfully updated. Thanks!

<% elseif isValid = 2 then %> Your information could not be found. If this error continues, please contact the list manager. <% else %> <% if isValid = 3 then %> Invalid email address. Please correct and try again. <% elseif isValid = 4 then %> This email address is already subscribed to this list. Please use another. <% elseif isValid = 5 then %> Invalid Format. Please choose the Text or HTML format Newsletter. <% end if %>
Name:
">
Email Address:
">
Format:
> Text > HTML
List:
<%=subListname%>
<% end if ' end action 2 ifs else ' not an action 2, attempt to get details and show message set subRecord = mlConn.execute("SELECT ML_Subscribers.ListID, ML_Subscribers.Email, ML_Subscribers.Name, ML_Subscribers.Format, ML_Subscribers.SubscriberID, ML_Lists.Listname FROM ML_Subscribers INNER JOIN ML_Lists ON ML_Subscribers.ListID = ML_Lists.ListID WHERE ML_Subscribers.SubscriberID = " & subID) if subRecord.EOF then ' no subscriber found... %> Your details could not be found. Please make sure the URL you received did not wrap to the next line thus cutting off parts of it. If this error continues, please contact the list manager. <% else ' record found, show edit form %>

Name:
">
Email Address:
">
Format:
> Text > HTML
List:
<%=subRecord("listname")%>

<% end if end if %>

<% function validateInfo(subListname, subListID) set subChk = mlConn.Execute("SELECT ML_Subscribers.ListID, ML_Subscribers.Email, ML_Subscribers.Name, ML_Subscribers.Format, ML_Subscribers.SubscriberID, ML_Lists.Listname FROM ML_Subscribers INNER JOIN ML_Lists ON ML_Subscribers.ListID = ML_Lists.ListID WHERE ML_Subscribers.SubscriberID = " & subID) if (NOT subChk.EOF) then : subListname = subChk("Listname") : subListID = subChk("ListID") : subEmail = subChk("Email") : else : validateInfo = 2 : exit function : end if if (NOT verifyEmail(request("email"))) then validateInfo = 3 : exit function if trim(request("email")) <> subEmail then set dupChk = mlConn.Execute("SELECT * FROM ML_Subscribers WHERE Email = '" & request("email") & "' AND ListID = " & subListID) if (NOT dupChk.EOF) then validateInfo = 4 : exit function end if if (lcase(trim(left(request("Format"), 1))) <> "t" AND lcase(trim(left(request("Format"), 1))) <> "h") then validateInfo = 5 : exit function validateInfo = 1 end function %> <% ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' uncommenting the lines below will print out all data at the bottomof the page. To be used for debugging purposes ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'response.write "


" 'response.write "fileName = " & fileName & "
" 'response.write "Action = " & action & "
" 'response.write "subID = " & subID & "
" 'response.write "isValid = " & isValid & "
" 'response.write "request.format = " & request("format") & "
" 'response.write "request.name = " & request("name") & "
" 'response.write "request.email = " & request("email") & "
" 'response.write "Listname: " & subListName & "
" 'response.write "ListID: " & subListID & "
" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %>