<%@ Language=VBScript %> <% '-- start of function section --> ' this function replaces ' with '' and \ with \\ and space with ~ Function ConvertSpec(varTemp) If IsNull(varTemp) Then ConvertSpec = "" Else IF len(varTemp) <> 0 then newVar = "" x = 1 size = len(varTemp) + 1 Do While x < size curVar = mid(varTemp,x,1) If curVar = chr(39) Then newVar = newVar & curVar & curVar Else If curVar = chr(32) Then newVar = newVar & chr(126) Else If curVar = chr(92) Then newVar = newVar & curVar & curVar Else newVar = newVar & curVar End If End If End If x = x + 1 Loop ConvertSpec = newVar End If End If End Function ' this function replaces ~ with space Function ConvertSpecBack(varTemp) If IsNull(varTemp) Then ConvertSpecBack = "" Else IF len(varTemp) <> 0 then newVar = "" x = 1 size = len(varTemp) + 1 Do While x < size curVar = mid(varTemp,x,1) If curVar = chr(126) Then newVar = newVar & chr(32) Else If curVar = chr(10) Then newVar = newVar & "
" Else newVar = newVar & curVar End If End If x = x + 1 Loop ConvertSpecBack = newVar End If End If End Function ' this function replaces ' with '' and \ with \\ Function CheckQuote(varTemp) If IsNull(varTemp) Then ConvertSpec = "" Else IF len(varTemp) <> 0 then newVar = "" x = 1 size = len(varTemp) + 1 Do While x < size curVar = mid(varTemp,x,1) If curVar = chr(39) Then newVar = newVar & curVar & curVar Else If curVar = chr(92) Then newVar = newVar & curVar & curVar Else newVar = newVar & curVar End If End If x = x + 1 Loop CheckQuote = newVar End If End If End Function '-- end of function section --> '-- Start of Server Code --> '-- Always executed --> referral = Request("ref") if referral = "" or referral & "TBD" = "TBD" then sponsor = ucase("sykaro") else sponsor = ucase(referral) end if dbaction = 0 action = Request("action") connectionstring = "clb" Set cn = Server.CreateObject("ADODB.Connection") cn.Open connectionstring if action = "downreg" then autoresponder = "" Set member = Server.CreateObject("ADODB.Recordset") member.ActiveConnection = cn sqltext = "select * from members where userid = '" & sponsor & "'" On error resume next member.open sqltext if err <> 0 then member.Close sponsor = ucase("sykaro") email = "admin@contactlistbuilder.com" else if member.EOF then member.Close sponsor = ucase("sykaro") email = "admin@contactlistbuilder.com" else email = member("email") autoresponder = member("autoresponder") member.Close end if end if if autoresponder & "TBD" = "TBD" then sqltext = "select autoresponder from members where userid = 'SYKARO'" On error resume next member.open sqltext if err <> 0 then member.Close else autoresponder = member("autoresponder") member.Close end if end if cfirst = Request.Form("Contact_FirstName") clast = Request.Form("Contact_LastName") cemail = Request.Form("Contact_Email") cphone = Request.Form("Contact_Phone") if autoresponder & "TBD" <> "TBD" then set iMsg = CreateObject("CDO.Message") set iConf = CreateObject("CDO.Configuration") ' Apply the settings to the message. With iMsg Set .Configuration = iConf .To = autoresponder .From = cemail .Subject = "Start autoresponder series for " & email .TEXTBody = "Start autoresponder series for " & email .Send End With ' Clean up variables. Set iMsg = Nothing Set iConf = Nothing end if welcomemsg = "Contact List Builder was downloaded from the " & sponsor & " site." & chr(10) & chr(10) welcomemsg = welcomemsg & "First Name: " & cfirst & chr(10) welcomemsg = welcomemsg & "Last Name: " & clast & chr(10) welcomemsg = welcomemsg & "Email: " & cemail & chr(10) welcomemsg = welcomemsg & "Phone: " & cphone & chr(10) set iMsg = CreateObject("CDO.Message") set iConf = CreateObject("CDO.Configuration") ' Apply the settings to the message. With iMsg Set .Configuration = iConf .To = email .BCC = "admin@contactlistbuilder.com" .From = "admin@contactlistbuilder.com" .Subject = "Contact List Builder - " & sponsor .TEXTBody = welcomemsg .Send End With ' Clean up variables. Set iMsg = Nothing Set iConf = Nothing firstname = checkquote(cfirst) lastname = checkquote(clast) email = cemail phone = cphone referredby = sponsor sqltext = "insert into affiliateleads (firstname,lastname,email,phone,referredby,downloadtime)" sqltext = sqltext & " values ('" & firstname & "','" & lastname & "','" & email & "','" & phone & "','" sqltext = sqltext & referredby & "','" & now() & "')" On error resume next member.open sqltext member.Close cn.Close Response.Redirect("clbdownloadlink.asp?ref=" & sponsor) end if if action = "affreg" or action = "persreg" or action = "custreg" or action = "subreg" then cval = cint(Request("cval")) cfirst = Request.Form("Contact_FirstName") clast = Request.Form("Contact_LastName") cemail = Request.Form("Contact_Email") caffid = Request.Form("Contact_Affiliate") caffid = removeSpaces(caffid) crefby = Request.Form("referredby") bname = Request.Form("BusinessName") burl = Request.Form("BusinessURL") if action = "persreg" or action = "custreg" or action = "subreg" then mint = "" bcopy = "" customized = "1" if action = "custreg" then customized = "2" bcopy = Request.Form("BusinessCopy") end if if action = "subreg" then mint = Request("mint") customized = "3" end if else customized = "0" mint = "" bcopy = "" end if Set member = Server.CreateObject("ADODB.Recordset") member.ActiveConnection = cn sqltext = "select email,balance from members where userid = '" & crefby & "'" On error resume next member.open sqltext if err <> 0 then member.Close semail = "admin@contactlistbuilder.com" else if member.EOF then crefby = sponsor semail = "admin@contactlistbuilder.com" member.Close sqltext = "select email,balance from members where userid = '" & crefby & "'" On error resume next member.open sqltext if err <> 0 then sponsor = "SYKARO" member.Close semail = "admin@contactlistbuilder.com" else if member.EOF then sponsor = "SYKARO" member.Close semail = "admin@contactlistbuilder.com" else balance = member("balance") semail = member("email") member.close end if end if else balance = member("balance") semail = member("email") member.close end if end if sqltext = "select * from members where userid = '" & caffid & "'" On error resume next member.open sqltext if err <> 0 then member.Close cn.Close dbaction = err else if member.EOF then member.Close ' add commission to balance of sponsor balance = cdbl(balance) + cdbl(cval) sqltext = "update members set balance = '" & balance & "' where userid = '" & sponsor & "'" On error resume next member.open sqltext if err <> 0 then cn.Close msg = "There was an error adding the commission for " & sponsor & "." & chr(10) msg = msg & "A commission for $" & cval & " was being added for purchase by affiliate " & caffid & "." & chr(10) msg = msg & "The error code was - " & err set iMsg = CreateObject("CDO.Message") set iConf = CreateObject("CDO.Configuration") ' Apply the settings to the message. With iMsg Set .Configuration = iConf .To = "admin@contactlistbuilder.com" .From = "admin@contactlistbuilder.com" .Subject = "CLB Commission Error for " & sponsor .TEXTBody = msg .Send End With ' Clean up variables. Set iMsg = Nothing Set iConf = Nothing end if ' save info - id is ok cfirst = checkquote(cfirst) clast = checkquote(clast) caffid = checkquote(caffid) crefby = checkquote(crefby) bname = checkquote(bname) burl = checkquote(burl) sqltext = "insert into members (userid,email,firstname,lastname,businessname,businessurl,referrer,customized,mint,jdate)" sqltext = sqltext & " values ('" & caffid & "','" & cemail & "','" & cfirst & "','" & clast & "','" sqltext = sqltext & bname & "','" & burl & "','" & crefby & "','" & customized & "','" & mint & "','" & now() & "')" On error resume next member.open sqltext if err <> 0 then member.Close cn.Close dbaction = err else if len(bcopy) > 1 then ' save ad copy to textforad msgnum = 0 mailbody = bcopy mailbody = ConvertSpec(mailbody) msglen = Len(mailbody) bodyend = "F" Do While bodyend = "F" If msglen > 255 Then bodytext = Left(mailbody,255) msglen = msglen - 255 mailbody = Mid(mailbody,256,msglen) Else bodytext = mailbody bodyend = "T" End If bodySql = "insert into textforad (userid,adtext) values ('" bodySql = bodySql & caffid & "','" & bodytext & "')" member.Open bodySql Loop end if cn.Close welcomemsg = "Contact List Builder Registration Notice" & chr(10) & chr(10) welcomemsg = welcomemsg & "First Name: " & cfirst & chr(10) welcomemsg = welcomemsg & "Last Name: " & clast & chr(10) welcomemsg = welcomemsg & "Email: " & cemail & chr(10) welcomemsg = welcomemsg & "Affiliate ID: " & caffid & chr(10) welcomemsg = welcomemsg & "Business Name: " & bname & chr(10) welcomemsg = welcomemsg & "Business Url: " & burl & chr(10) if customized = "2" then welcomemsg = welcomemsg & "Ad Copy: " & chr(10) & chr(10) & bcopy & chr(10) end if set iMsg = CreateObject("CDO.Message") set iConf = CreateObject("CDO.Configuration") ' Apply the settings to the message. With iMsg Set .Configuration = iConf .To = cemail .CC = semail .BCC = "admin@contactlistbuilder.com" .From = "admin@contactlistbuilder.com" .Subject = "Contact List Builder Registration - " & sponsor .TEXTBody = welcomemsg .Send End With ' Clean up variables. Set iMsg = Nothing Set iConf = Nothing cmd = "clbthankyou.asp?ref=" & caffid Response.Redirect(cmd) end if else member.Close cn.Close if action = "affreg" then cmd = "affiliatereg.asp?ref=" & sponsor & "&cfirst=" & cfirst & "&clast=" & clast & "&cemail=" & cemail & "&crefby=" & crefby & "&caffid=duplicate" & "&cval=" & cval end if if action = "persreg" then cmd = "personalreg.asp?ref=" & sponsor & "&cfirst=" & cfirst & "&clast=" & clast & "&cemail=" & cemail & "&crefby=" & crefby & "&caffid=duplicate" & "&bname=" & bname & "&burl=" & burl & "&cval=" & cval end if if action = "custreg" then cmd = "customizereg.asp?ref=" & sponsor & "&cfirst=" & cfirst & "&clast=" & clast & "&cemail=" & cemail & "&crefby=" & crefby & "&caffid=duplicate" & "&bname=" & bname & "&burl=" & burl & "&bcopy=" & bcopy & "&cval=" & cval end if if action = "subreg" then if mint = "T" then cmd = "mintreg.asp?ref=" & sponsor & "&cfirst=" & cfirst & "&clast=" & clast & "&cemail=" & cemail & "&crefby=" & crefby & "&caffid=duplicate" & "&bname=" & bname & "&burl=" & burl & "&cval=" & cval else cmd = "servicereg.asp?ref=" & sponsor & "&cfirst=" & cfirst & "&clast=" & clast & "&cemail=" & cemail & "&crefby=" & crefby & "&caffid=duplicate" & "&bname=" & bname & "&burl=" & burl & "&cval=" & cval end if end if ' return and get new id - id is already taken Response.Redirect(cmd) end if end if end if cmd = "index.asp?ref=" & sponsor Response.Redirect(cmd) %>