%Response.AddHeader "P3P", "CP=""CAO PSA OUR""" order_number=request("order_number") product_price=request("total") product_name=request("product_name") security_code="12345" 'request("security_code") salesnum=1 varnull=0 ipaddress=Request.ServerVariables("REMOTE_ADDR") if request.cookies(CookieName)<>"" then affusername=request.cookies(CookieName) elseif session(CookieName)<>"" then affusername=session(CookieName) else affusername="" end if Set conn = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.Recordset") Conn.Open dsn ' check afusername if cookies are disabled or deleted if affusername="" then rs.open "SELECT AfUsername, ipaddress from AF_Hits WHERE ipaddress ='" & ipaddress & "'", conn,1,3 nu=0 if not rs.eof then rs.movefirst while not rs.eof nu=nu+1 AfUsernameIP=rs("AfUsername") rs.movenext wend end if rs.close affusername=AfUsernameIP end if rs.open "SELECT AfUsername, status, activation, Password, Email from AF_Users WHERE AfUsername ='" & affusername & "'", conn,1,3 if not rs.eof then if security_code="12345" then if rs("activation")="1" then userok=true end if affiliateun=rs("AfUsername") affiliatepw=rs("Password") Email=rs("Email") UserStatus=rs("status") end if end if rs.close if UserStatus="" then UserStatus=0 if UserStatus=0 then rs.open "SELECT ConStatus, paypersale, flatfee FROM AF_Constants where ConStatus = " & UserStatus & "", conn,1,3 else rs.open "SELECT ConStatus, ConstantsID, paypersale, flatfee FROM AF_Constants where ConstantsID = " & UserStatus & "", conn,1,3 end if if not rs.eof then paypersale=rs("paypersale") flatfee=rs("flatfee") end if rs.close 'check if flatfee disabled if flatfee=0 then paypersale=product_price*paypersale/100 if affusername<>"" and product_price>0 and order_number<>"" and userok=true then rs.open "SELECT order_number from AF_Hits WHERE order_number ='" & order_number & "'", conn,1,3 If rs.EOF Then if session(CookieName & "BN")="" then BannerSales=0 else BannerSales=session(CookieName & "BN") end if sql = "INSERT into AF_Hits(AfUsername, ipaddress, hits, leads, salesnum, sales, product_name, earn, order_number, BannerSales, date) Values('" & affusername & "', '" & ipaddress & "', '" & varnull & "', '" & varnull & "', '" & salesnum & "', '" & product_price & "', '" & product_name & "', '" & paypersale & "', '" & order_number & "', '" & BannerSales & "', '" & now() & "')" conn.execute(sql) rs.close rs.open "SELECT * from AF_Payments WHERE AfUsername ='" & affusername & "'", conn,1,3 if not rs.eof then totalsales=rs("sales")+product_price numOfSales=rs("numOfSales")+1 earn=rs("earn")+paypersale SQL = "update AF_Payments Set sales = '"& totalsales &"', numOfSales = '"& numOfSales &"', earn = '"& earn &"' Where AfUsername = '" & affusername & "'" Set RS = conn.Execute(SQL) 'send email notification dim b, emailsubject, fullname fullname=affusername emailsubject="A Sale was made from your referral link!" b="
" b=b & "Hi " & affusername & ",