<object runat=server id=conn1 progid="adodb.connection"></object>
<%application.Lock
conn1.Open Application("p_jyzx")
Application.UnLock
%>
<%set rs=server.CreateObject ("ADODB.recordset")
 sql="select * from my_system where system_id=1"
 rs.Open sql,conn1,3
 if rs.RecordCount<>0 then
	affiliate_visit_value=rs("affiliate_visit_value")
	affiliate_join_value=rs("affiliate_join_value")
	affiliate_join_vip=rs("affiliate_join_vip")
 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("left_money")=rs("visit_counter")*affiliate_visit_value+rs("join_counter")*affiliate_join_value+rs("vip_join_counter")*affiliate_join_vip+rs("left_money")
  rs("visit_counter")=0
  rs("join_counter")=0
  rs("vip_join_counter")=0
 
   rs.update 
    

   set rs=server.createobject("adodb.recordset")
sql="delete * from affiliate_link where user_name='"&Request("user_name")&"'"
rs.open sql,conn1,3,2
   set rs=server.createobject("adodb.recordset")
sql="delete * from affiliate_intro where user_name='"&Request("user_name")&"'"
rs.open sql,conn1,3,2
   set rs=server.createobject("adodb.recordset")
sql="delete * from affiliate_intro_vip where checked=1 and user_name='"&Request("user_name")&"'"
rs.open sql,conn1,3,2
    
Response.Redirect "affiliate_list.asp"
%>

