<% '******************************************************* ' Version 6.50 Log Affiliate entry ' shoppaff.asp?affid=nn ' Sets Session variable and continues to main logic ' May 9, 2004 ' '********************************************************* dim affid Dim dbc Dim logincount Dim affhome dim catalogid dim url dim rc affhome=getconfig("xhome") Affid=request("affid") catalogid=request("id") 'VP-ASP 6.50 - precautionary security fix if not isnumeric(catalogid) then catalogid = "" end if url=request("directurl") url= Replace(url,"'","") If Affid="" then Continueshop affhome end if If not isnumeric(affid) then Continueshop affhome end if ShopOpenOtherDB dbc, getconfig("xAffiliateDB") UpdateAffiliate rc, affid If rc>0 then ShopCloseDatabase dbc Continueshop affhome end if If getconfig("xAffiliateUseCookies")="Yes" Then if Request.Cookies("affid")="" then Response.Cookies("affid")=Cstr(affid) Response.Cookies("affid").expires=date()+365 end if end if SetSess "affid",affid if url="" then if catalogid<>"" then url="shopexd.asp?id=" & catalogid else url=affhome end if end if UpdateAffiliatelog affid,url,0,dbc ShopCloseDatabase dbc continueshop url '******************************************************************* ' Need to locate affiliate '********************************************************************** Sub UpdateAffiliate (rc, affid) rc=0 sql="select * from affiliates where affid=" & affid set objrs=dbc.execute(sql) if not ObjRS.eof then if not isnull(objrs("directurl")) then affhome=objrs("directurl") end if logincount=objrs("logincount") if isnull(logincount) then logincount=0 else logincount=logincount+1 end if objrs.close set objrs=nothing setsess "affid",affid UpdateAffiliateinfo logincount,affid else objrs.close set objrs=nothing setsess "affid","" rc=4 end if end sub Sub UpdateAffiliateInfo (logincount,affid) dim usql usql="Update affiliates set logincount=" & logincount usql=usql & ", logindate=" & datedelimit(date() ) 'VP-ASP 6.09 - added formatdatetime call usql=usql& ",logintime='" & formatdatetime(time(),vbshorttime) & "'" usql=usql & " where affid=" & affid 'debugwrite usql dbc.execute(usql) end sub '******************************************************** ' go to someplace '******************************************************** Sub continueshop (location) if location<>"" then responseredirect location else shoperror "Unknown continue url for shopaff.asp" end if end sub %>