<% '================ 'do a quick check to make sure the page is not being hit 'from the outside world (only want to signup people from THIS page) dim error, error_msg, emailexist, chknum, status dim sendto, from, subject, body if (Request.QueryString("submitted") = "true") and (instr(12,Request.ServerVariables("HTTP_REFERER"),"/mailout.asp") > 12) then 'if everything is cool, then do ya stuff 'Response.Write(instr(1,Request.ServerVariables("HTTP_REFERER"),"/mailout.asp")) 'Response.Write("yera!") '==================== 'do a quick check on the email addy 'Response.Write(ValidEmail(Request.Form("emailaddy"))) if not ValidEmail(Request.Form("emailaddy")) then error = true error_msg = error_msg & "
  • The email address you entered does not seem to be valid, try again?
  • " end if '=================== '1st step is clear - now see if they are 'already signed up before trying to add them if not error then set tigRS = Server.CreateObject("ADODB.Recordset") query = "SELECT emailaddy " & _ "FROM mailout " & _ "WHERE emailaddy = '" & SQLsafe(Request.Form("emailaddy")) & "'" 'Response.Write("Query = [" & query & "]
    ") tigRS.Open query,DSN,1 if not tigRS.EOF then emailexist = true end if tigRS.close '================= 'now do what they want (subscribe or un-subscribe) '================= if (Request.Form("status") = "subscribe") and (not emailexist) then '================= 'they want to subscribe!! - yayayay! 'grab a random number (to add secruity) Randomize chknum = Int((9999999) * Rnd) set tigCON = Server.CreateObject("ADODB.Connection") tigCON.Open(DSN) query = "insert into mailout " & _ "(emailaddy, checknum) " & _ "VALUES " & _ "('" & SQLsafe(Request.Form("emailaddy")) & "', " & _ "'" & chknum & "')" 'Response.Write("Query = [" & query & "]
    ") tigCON.Execute(query) tigCON.close '==================== 'now send a email to the user so they 'can unlock their subscribtion 'emailtime(byval sendto, byval from, byval subject, byval body) sendto = SQLsafe(Request.Form("emailaddy")) from = "lvl@ebom.org" subject = "..::LvL mailout subscribtion" body = "Either you or someone pretending to be you, has requested a subscription to the ..::LvL mailout - if it wasnt you " & _ "then simply ignore this email. If you really want to receive the ..::LvL mailout then " & _ "you will need to open your subscription by visiting the URL below. " & vbcr & vbcr & _ site_url & "unlock.asp?n=" & chknum & "&e=" & server.URLPathEncode(Request.Form("emailaddy")) & vbcr & vbcr & _ "(make sure you get the FULL URL, it will end with your email address)" & vbcr & _ "If you have any question or problems forward them to lvl@ebom.org" & vbcr & vbcr & _ "Thanx" & vbcr & _ "..::LvL Admin " & vbcr & vbcr & _ "====== "& replace(site_url,"http://","") &" =======" if Request.ServerVariables("LOCAL_ADDR") = local_ip then call cdontstime(sendto, from, subject, body) else call emailtime(sendto, from, subject, body) end if 'so we can print a nice little msg status = "subed" elseif (Request.Form("status") = "unsubscribe") and (emailexist) then '===================== 'they want off the list! set tigCON = Server.CreateObject("ADODB.Connection") tigCON.Open(DSN) query = "delete from mailout " & _ "where emailaddy =" & _ "'" & SQLsafe(Request.Form("emailaddy")) & "'" 'Response.Write("Query = [" & query & "]
    ") tigCON.Execute(query) tigCON.close '==================== 'now send a email to the user so they 'can unlock their subscribtion 'emailtime(byval sendto, byval from, byval subject, byval body) sendto = SQLsafe(Request.Form("emailaddy")) from = "lvl@ebom.org" subject = "..::LvL mailout subscribtion" body = "Your subscription to the ..::LvL mailout has been removed as requested. " & _ "If you did NOT request to be unsubscribed then visit the URL below and you will be re-subscribed" & vbcr & vbcr & _ "http://www.planetquake.com/lvl/mailout.asp?e=" & server.URLPathEncode(Request.Form("emailaddy")) & vbcr & vbcr & _ "(make sure you get the FULL URL, it will end with your email address)" & vbcr & _ "If you have any question or problems forward them to lvl@ebom.org" & vbcr & vbcr & _ "Thanx" & vbcr & _ "..::LvL Admin " & vbcr & vbcr & _ "====== www.planetquake.com/lvl/ =======" if Request.ServerVariables("LOCAL_ADDR") = "203.24.131.65" then call cdontstime(sendto, from, subject, body) else call emailtime(sendto, from, subject, body) end if 'so we can print a nice little msg status = "unsubed" elseif (Request.Form("status") = "subscribe") and (emailexist) then '================= 'they have a small problem - alert them to it! error = true error_msg = error_msg & "
  • The email address you are trying to subscribe is already on the list.
  • " elseif (Request.Form("status") = "unsubscribe") and (not emailexist) then '================= 'they have a small problem - alert them to it! error = true error_msg = error_msg & "
  • The email address you are trying to unsubscribe is NOT on the list, do you have another email address?
  • " end if end if end if %> [ contact ] ..::LvL Mailout
    +---------------------

     

    <% if status = "unsubed" then %>

    You have successfully unsubscribed from the ..::LvL mailout.

    <% elseif status = "subed" then %>

    You have successfully subscribed to the ..::LvL mailout. A confirmation email will soon turn-up in your <%=Request.Form("emailaddy")%> in-box. This email will have information on how to *unlock* your subscription. (its just a security check to stop spammers and junk accounts)

    <% elseif error then Response.Write("There was an error processing your request.
      "& error_msg &"
    ") else %>

    The ..::LvL mailout is sent out with every update. Each one will give you a quick run-down on the maps that have been added. To subscribe just enter your vaild email address below.

    To unsubscribe (for whatever reason) just select unsubscribe before you hit the submit button :]

    <% end if if (status = "subed") or (status = "unsubed") then 'do nothing else %> ?submitted=true" method="post">
    Your email address:
    <% if Request.Form("emailaddy") <> "" then %> " />
    <% elseif Request.QueryString("e") <> "" then %> " />
    <% else %>
    <% end if if (Request.QueryString("u") = "y") or (Request.Form("status") = "unsubscribe") then %>  subscribe |  unsubscribe <% else %>  subscribe |  unsubscribe <% end if %>
    +---------------------

    Your email address is held in the ..::LvL database - it is safe from spam. Your email address will NOT be sold to anyone. You can remove yourself at any time from the list by accessing this web page. Any question or concerns can be sent to <%=tig_mail%>

    <% end if %>