% ' Field Definitions for Affiliates ' Used to read nd update affiates records '********************************************************* ' VP-ASP 6.50 April 1, 2003 ' Affiliate subroutines ' Master Affiliate ' '****************************************************** dim affmastercommissionrate Dim AdminFlag Dim lngAffid Dim lngReferralid ' master Dim dbc Dim affstrFirstname Dim affstrLastname Dim affstrAddress Dim affstrCity Dim affstrState Dim affstrPostcode Dim affstrCountry Dim affstrCompany Dim affstrPhone Dim affstrWebsite Dim affstrWorkphone Dim affstrMobilephone Dim affstrFax Dim affstrEmail Dim affstrComment Dim affLoginCount Dim datLogindate Dim datLogintime Dim affstrAffother1 Dim affstrAffother2 Dim affstrAffother3 Dim affstrCommissionrate Dim lngOrders Dim curTotalcommission Dim affstrTypeofpayment Dim affstrBank Dim affstrBankaccount Dim affstrBankbranch Dim affstrBankAddress Dim affstrBankother Dim affstrpassword Dim affstrpassword1 Sub UpdateAffiliate 'VP-ASP 6.50 - broadened defintion of IF statement to cover cases where xmysql hasn't been set if ucase(xdatabasetype) = "MYSQL" OR ucase(xdatabasetype) = "MYSQL351" OR getconfig("xMYSQL")="Yes" then mysqlupdateaffiliate exit sub end if Dim doupdate doupdate="" ShopOpenOtherDB dbc,getconfig("xaffiliateDB") If GetSess("affRegister")<>"" then LngAffid=Getsess("AffRegister") SQL="Select * from affiliates Where affid=" & lngaffid Set objRS = Server.CreateObject("ADODB.Recordset") objRS.open SQL, dbc, adOpenKeyset, adLockOptimistic, adcmdText if not ObjRS.eof then DoUpdate="True" objRS.update else objRs.close set objRS=nothing end if end if If Doupdate="" then Set objRS = Server.CreateObject("ADODB.Recordset") objRS.open "affiliates", dbc, adOpenKeyset, adLockOptimistic, adCmdTable objRS.AddNew SetSess "AffRegister","" end if updateaff "firstname", affstrfirstname updateaff "lastname", affstrlastname updateaff "address", affstraddress updateaff "city", affstrcity updateaff "state", affstrstate updateaff "postcode", affstrpostcode updateaff "country", affstrcountry updateaff "company", affstrcompany updateaff "phone", affstrphone updateaff "website", affstrwebsite updateaff "fax", affstrfax updateaff "email", affstremail updateaff "comment", affstrcomment updateaff "typeofpayment", affstrtypeofpayment updateaff "bank", affstrbank updateaff "bankaccount", affstrbankaccount updateaff "bankbranch", affstrbankbranch updateaff "bankaddress", affstrbankaddress updateaff "bankother", affstrbankother updateaff "password", affstrpassword updateaff "referralid", lngreferralid if doupdate="" then updateaff "commissionrate", getconfig("affcommissionrate") updateaff "directurl", getconfig("affdirecturl") updateaff "mastercommissionrate", getconfig("affmastercommissionrate") end if objrs.update lngaffid= objrs("affid") objRS.close set objrs=nothing shopclosedatabase dbc end sub Sub UpdateAff (fieldname, fieldvalue) if fieldvalue="" then objRS(fieldname)=NULL else objRS(fieldname)=fieldvalue end if end sub Sub ReadAffRecord (affid, lastname, password) ' We leave the recordset open. the caller must close it and the database ShopOpenOtherDB dbc,getconfig("xaffiliateDB") SQL="Select * from affiliates Where affid=" & affid If password<>"" then Sql=sql & " AND password='" & replace(password,"'","") & "'" SQL=SQL & " AND lastname='" & replace(lastname,"'","''") & "'" end if Set objRS = dbc.Execute(SQL) If objRS.EOF Then lngAffid = "" affstrFirstname = "" affstrLastname = "" affstrAddress = "" affstrCity = "" affstrState = "" affstrPostcode = "" affstrCountry = "" affstrCompany = "" affstrPhone = "" affstrWebsite = "" affstrWorkphone = "" affstrMobilephone = "" affstrFax = "" affstrEmail = "" affstrComment = "" affstrTypeofpayment = "" affstrBank = "" affstrBankaccount = "" affstrBankbranch = "" affstrBankAddress = "" affstrBankother = "" affstrPassword="" affstrCommissionrate="" Serror= getlang("LangAffNotFound") Else lngaffid = objrs("affid") lngreferralid=objrs("referralid") affstrfirstname = objrs("firstname") affstrlastname = objrs("lastname") affstraddress = objrs("address") affstrcity = objrs("city") affstrstate = objrs("state") affstrpostcode = objrs("postcode") affstrcountry = objrs("country") affstrcompany = objrs("company") affstrphone = objrs("phone") affstrwebsite = objrs("website") affstrworkphone = objrs("workphone") affstrmobilephone = objrs("mobilephone") affstrfax = objrs("fax") affstremail = objrs("email") affstrcomment = objrs("comment") afflogincount = objrs("logincount") datlogindate = objrs("logindate") datlogintime = objrs("logintime") affstrtypeofpayment = objrs("typeofpayment") affstrbank = objrs("bank") affstrbankaccount = objrs("bankaccount") affstrbankbranch = objrs("bankbranch") affstrbankaddress = objrs("bankaddress") affstrbankother = objrs("bankother") affstrpassword=objrs("password") affstrcommissionrate=objrs("commissionrate") If not isnull(affstrCommissionrate) then if affstrCommissionrate>1 then affstrCommissionrate=affstrCommissionrate/100.00 end if end if End If End Sub ' Sub CloseAffRS objrs.close set Objrs=nothing ShopClosedatabase dbc ' Close the database end sub ' Sub FormatAffiliate (affid, iFlag) AdminFlag=iFlag lngAffid=affid ReadAffRecord Affid, "","" If lngAffid="" then shopwriteError getlang("LangAffNotFound") & affid CloseAffRS exit sub else FormatAffiliateDetails end if CloseAffRS end sub Sub FormatAffiliateDetails if lcase(right(request.ServerVariables("URL"), len(request.ServerVariables("URL")) - instrrev(request.ServerVariables("URL"), "/"))) = "shopaffregister.asp" then GenerateDisplayHeaderFlat else GenerateDisplayHeader getlang("LangAffId") & " " & lngAffid end if GenerateDisplayBodyHeader Response.write FoRderTable If Getconfig("affmultilevel")="Yes" then If not isnull(lngreferralid) then DoHeader getlang("LangReferringAffiliate") & " " & lngReferralid end if end if Dofield getlang("LangCustFirstName"), affstrFirstName DoField getlang("LangCustLastName"), affstrLastName DoField getlang("LangCustAddress") ,affstrAddress DoField getlang("LangCustCity"), affstrCity DoField getlang("LangCustState") , affstrState DoField getlang("LangCustPostCode"),affstrPostCode DoField getlang("LangCustCountry"),affstrcountry DoField getlang("LangCustEmail"),affstremail DoField getlang("LangCustPhone"),affstrphone DoField getlang("LangCustFax"),affstrfax DoField getlang("LangCustCompany"),affstrcompany If AdminFlag="Register" then DoField getlang("LangCustWebsite"),affstrwebsite DoField getlang("LangAffComments"),affstrcomment DoField getlang("LangLoginPassword"),affstrpassword end if DoHeader getlang("LangFormatPaymentInformation") DoField getlang("LangCheckoutPaymentType"), affstrtypeofpayment DoField getlang("LangAffBank"),affstrBank DoField getlang("LangAffBankaccount"),affstrBankaccount DoField getlang("LangAffBankbranch"),affstrBankbranch DoField getlang("LangAffBankAddress"),affstrBankAddress DoField getlang("LangAffBankother"),affstrBankother Response.write "" GenerateDisplayBodyFooter end sub ' Sub DoField (fieldname,fieldvalue) if fieldvalue="" or isNull(fieldvalue) then exit sub end if %> <%=ForderFieldRow%> <%=ForderFieldLeft%><%=fieldname%> <%=FOrderFieldRight%><%=fieldvalue%> <% end sub Sub DoHeader (mytext) %>