<object runat=server id=conn1 progid="adodb.connection"></object>
<%application.Lock
Application("p_jyzx")="driver={Microsoft Access Driver (*.mdb)};dbq=" &server.MapPath("../db/sjxffriend.asa")
	
conn1.Open Application("p_jyzx")
Application.UnLock
%>
<%
   Set rs = Server.CreateObject("ADODB.Recordset")
	 sql="select * from affiliate where user_name='"&Request("user_name")&"'"
	rs.Open sql,conn1,3,2
if rs.RecordCount<>0 then
  ' if rs("checked")=2 then
	Set rs_s = Server.CreateObject("ADODB.Recordset")
	 sql="select * from affiliate_link where ip='"&Request.ServerVariables("REMOTE_HOST")&"'"
	 sql=sql&" and time=#"&date&"#"
	rs_s.Open sql,conn1,3,2
	if rs_s.RecordCount=0 then	
		 Set rs1 = Server.CreateObject("ADODB.Recordset")
		rs1.Open "affiliate_link",conn1,3,2
		rs1.addnew
		rs1("user_name")=Request("user_name")
		rs1("ip")=Request.ServerVariables("REMOTE_HOST")
		rs1("time")=date
		rs1.Update 
	 '  end if
		 Set rs = Server.CreateObject("ADODB.Recordset")
		 sql="select * from affiliate where user_name='"&Request("user_name")&"'"
		rs.Open sql,conn1,2,3
	
		 rs("visit_counter")= rs("visit_counter")+1
		 'rs("join_counter")=0
		'rs("start_time")=date
		 rs.Update
   end if
  
end if
    
    session("from_intr")=Request("user_name")
Response.Redirect "../default.asp"
%>



