<%Response.AddHeader "P3P", "CP=""CAO PSA OUR""" ipaddress=request.servervariables("REMOTE_ADDR") hit=1 varnull=0 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 rs.open "SELECT AfUsername, ipaddress from AF_Hits WHERE ipaddress ='" & ipaddress & "'", conn,1,3 If not rs.EOF Then nu=0 rs.movefirst while not rs.eof nu=nu+1 AfUsernameIP=rs("AfUsername") rs.movenext wend if nu>=2 then noLead=1 end if if affusername="" and AfUsernameIP<>"" then affusername=AfUsernameIP end if rs.close rs.open "SELECT AfUsername, activation, status from AF_Users WHERE AfUsername ='" & affusername & "'", conn,1,3 if not rs.eof and noLead<>1 then UserStatus=rs("status") if rs("activation")="1" then userok=true end if end if rs.close if UserStatus="" then UserStatus=0 if UserStatus=0 then rs.open "SELECT ConStatus, payperlead FROM AF_Constants where ConStatus = " & UserStatus & "", conn,1,3 else rs.open "SELECT ConStatus, ConstantsID, payperlead FROM AF_Constants where ConstantsID = " & UserStatus & "", conn,1,3 end if if not rs.eof then payperlead=rs("payperlead") end if rs.close if userok=true then sql = "INSERT into AF_Hits(AfUsername, ipaddress, hits, leads, salesnum, sales, earn, banners, date) Values('" & affusername & "', '" & ipaddress & "', '" & varnull & "', '" & hit & "', '" & varnull & "', '" & varnull & "', '" & payperlead & "', '" & varnull & "', '" & now() & "')" conn.execute(sql) rs.open "SELECT * from AF_Payments WHERE AfUsername ='" & affusername & "'", conn,1,3 if not rs.eof then hits=rs("leads")+1 earn=rs("earn")+payperlead SQL = "update AF_Payments Set leads = '"& hits &"', earn = '"& earn &"' Where AfUsername = '" & affusername & "'" Set RS = conn.Execute(SQL) end if end if set rs = nothing conn.close set conn = nothing %>