<%Response.AddHeader "P3P", "CP=""CAO PSA OUR""" if request("bn")<>"" and session(CookieName & "BN")="" then session(CookieName & "BN")=request("bn") end if ipaddress=request.servervariables("REMOTE_ADDR") hit=1 referurl=Request.ServerVariables("HTTP_REFERER") bn=request("bn") varnull=0 if request("af")<>"" then Set conn = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.Recordset") Conn.Open dsn rs.open "SELECT AfUsername, status, activation from AF_Users WHERE AfUsername ='" & request("af") & "'", conn,1,3 if not rs.eof then UserStatus=rs("status") if rs("activation")="1" and bn>0 then userok=true end if end if rs.close if UserStatus=0 then rs.open "SELECT ConStatus, payperclick, EnableTiers FROM AF_Constants where ConStatus = " & UserStatus & "", conn,1,3 else rs.open "SELECT ConStatus, ConstantsID, payperclick, EnableTiers FROM AF_Constants where ConstantsID = " & UserStatus & "", conn,1,3 end if if not rs.eof then payperclick=rs("payperclick") EnableTiers=rs("EnableTiers") end if rs.close if EnableTiers<>0 then session("aft")=request("af") end if if request.cookies(CookieName)="" and session(CookieName)="" then if request("af")<>"" and userok=true then rs.open "SELECT ipaddress from AF_Hits WHERE ipaddress ='" & ipaddress & "'", conn,1,3 If rs.EOF Then sql = "INSERT into AF_Hits(AfUsername, ipaddress, hits, leads, salesnum, sales, earn, banners, referurl, date) Values('" & request("af") & "', '" & ipaddress & "', '" & hit & "', '" & varnull & "', '" & varnull & "', '" & varnull & "', '" & payperclick & "', '" &bn & "', '" & referurl & "', '" & now() & "')" conn.execute(sql) rs.close rs.open "SELECT * from AF_Payments WHERE AfUsername ='" & request("af") & "'", conn,1,3 if not rs.eof then hits=rs("hits")+1 earn=rs("earn")+payperclick SQL = "update AF_Payments Set hits = '"& hits &"', earn = '"& earn &"' Where AfUsername = '" & request("af") & "'" Set RS = conn.Execute(SQL) else sql = "INSERT into AF_Payments(AfUsername, hits, leads, sales, numOfSales, Earn, downlineEarn, amountPaid, Bonus) Values('" & request("af") & "', '" & hit & "', '" & varnull & "', '" & varnull & "', '" & varnull & "', '" & payperclick & "', '" & varnull & "', '" & varnull & "', '" & varnull & "')" conn.execute(sql) end if end if response.cookies(CookieName)=request("af") response.cookies(CookieName).expires=dateadd("yyyy",1,date()) session(CookieName)=request("af") set rs = nothing conn.close set conn = nothing end if end if end if %>