<!-- #include file="skin.asp" -->
<%
sub ajk_SortOrder()
        Response.Write "<table border=0 width='100%' cellspacing=0 cellpadding=0>"
	Response.Write "<tr><td align='right' class=td0></td> "
        Response.Write "<td width='75%'  class=td0><img src='images/img_adv/left_ajk.gif'></td>"
        Response.Write "<td  class=td0></td></tr></table>"
	Response.Write "<table cellpadding=0 cellspacing=6 width='100%' align=center>"
        Response.Write "<tr><td width='15%' align='left'>名次</td><td width='50%' align='center'>姓名</td><td width=* align=center>反馈量</td></tr>"
        Set rs=server.createobject("adodb.recordset")
	sql="select top 10 * from [adv_broker] order by count_Z desc"
	rs.Open sql,conn_adv,1,2
	dim i
	i=1
	do while not rs.eof
		Response.Write "<tr height='23'><td class=tablebody1><img src='images/img_adv/level-1-"&i&".gif' width='27' height='15'></td>"
		Response.Write "<td class=tablebody1 align='center'><a href='user_view.asp?username="&rs("username")&"' target='_blank'>"&rs("username")&"</a><td class=red_3 align=center>"&rs("count_z")&"</td></tr>"
		i=i+1
		rs.movenext
	loop
	rs.close
        set rs=nothing
	Response.Write "</table>"
end sub

sub ajk_Stat()
        set rs=server.createobject("adodb.recordset")
	sql="select * from [adv_config] where adv_type='默认'"
	rs.Open sql,conn_adv,1,1
	if rs.eof and rs.bof then
	  	errmsg=errmsg+"<br>"+"<li>广告公司尚未启用，请用管理员帐号登陆后进入<a href='ajk_admin.asp'>管理</a>。"
		exit sub
        else
        dim adv_url
		dim adv_txt
		dim adv_img
		dim adv_logo
		dim adv_cheat
		dim adv_wealth
		dim adv_ep
		dim myurl
      dim ajk_username:ajk_username="经纪人名"
		myurl=web_dim(2)+web_dim(6)
		if mid(myurl,len(myurl),1)="/" then myurl=mid(myurl,1,len(myurl)-1)
		adv_url=rs("adv_url")
		adv_txt=rs("adv_txt")
		adv_img=rs("adv_img")
		adv_logo=rs("adv_logo")
		adv_cheat=rs("adv_cheat")
		adv_wealth=rs("adv_wealth")
		adv_ep=rs("adv_ep")
        end if
        rs.close
	set rs=nothing
        if login_username<>"" and login_mode<>"" then
                set rs=server.createobject("adodb.recordset")
	        sql="select * from [adv_broker] where username='"&login_username&"'"
	        rs.Open sql,conn_adv,1,2 
                Response.Write "<table border=0 width='100%' cellspacing=0 cellpadding=0>"
	        Response.Write "<tr height=20><td align='right'  class=td0></td> "
                Response.Write "<td width='95%'  class=td0 align='center'><b><font class=red>您的业务统计</font></b></td>"
                Response.Write "<td class=td0></td></tr></table>"
      	        Response.Write "<table cellspacing=1 cellpadding=6 class=tableborder1>" 
                if rs.eof and rs.bof then     
                    Response.Write "<tr><td class=tablebody1>"
                    Response.Write "<a href='?ajk_action=save'><img src='images/img_adv/adv_1.gif' border=0></a>"
		    Response.Write "<br><br>通过做社区的广告经纪人赚钱可是一种很不错的方法，不过先要办一张证书。<br><b>办理费用：</b>免费<br><b>办理条件：</b>只要是会员均可办理" 
	            Response.Write "</td></tr>"
                else
                    ajk_username=login_username
		    Response.Write "<tr><td width=60% >"
		    Response.Write "你总有效广告反馈量：<font class=red>"&rs("count_z")
		    Response.Write "</font> 次<br><br>您本次累积的反馈量：<font class=red>"&rs("count_b")
		    Response.Write "</font> 次<br><br>您本次累积业务佣金：<font class=red>"&rs("count_b")*adv_wealth
		    Response.Write "</font> 元<br>　　　　　　　积分：<font class=red>"&rs("count_b")*adv_ep
		    Response.Write "</font> 点<br><br>您上次领取佣金时间："&rs("updatetime")
		    Response.Write "</td><td>"
		    Response.Write "<b><font class=blue>"&login_username&"</font></b>，欢迎你来到广告公司<br><br>"
		    Response.Write "<a href='?ajk_action=update'><img src='images/img_adv/adv_2.gif' border=0></a>"
		    Response.Write "</td></tr>"
	       end if
               rs.close
               set rs=nothing
        else
              Response.Write "<table cellspacing=1 cellpadding=6 class=tableborder1>" 
              Response.Write "<tr><td class=tablebody1></td></tr>"
              Response.Write "<tr><td>你还没有登陆，请先<a href='login.asp'>登陆</a></td></tr>"
        end if
        Response.Write "</table>"
        Response.Write "<table border=0 width='100%' cellspacing=0 cellpadding=0>"
	Response.Write "<tr height=20><td align='right'  class=td0></td> "
        Response.Write "<td width='95%' class=td0 align='center'><b><font class=red>宣传方式</font></b></td>"
        Response.Write "<td class=td0></td></tr></table>"
        Response.Write "<table cellspacing=1 cellpadding=6 class=tableborder1>" 
	Response.Write "<tr><td class=tablebody1><b><font color='#FF0000'>代  码:</font></b><br><br>"
	Response.Write myurl&"/get.asp?get="&ajk_username
	Response.Write "</td></tr><tr><td align='left'><font class=blue>进阶方法一：</font>在其他论坛或聊天室发带有以下链接的帖子</td></tr>"
	%>    
              <tr> 
                <td>在支持UBB的论坛上可以是这样</td>
              </tr>
              <tr>
              <td><textarea name=textfield rows=3 cols=66 >[url=<%=myurl%>/get.asp?get=<%=ajk_username%>]<%=adv_txt%>[/url]</textarea></td></tr>
              <tr> 
                <td><font color="#FF0000">效果：</font><a target=_blank href=<%=myurl%>/get.asp?get=<%=ajk_username%>><%=adv_txt%></a></td>
              </tr>
              <tr> 
                <td>在论坛上，还可以把图片链接放到签名里（在帖子里好像不行）</td>
              </tr>
              <tr> 
                <td><font class=blue>例子一：</font></td>
              </tr>
              <tr>
              <td><textarea name=textfield rows=3 cols=66 >[url=<%=myurl%>/get.asp?get=<%=ajk_username%>][IMG]<%=adv_logo%>[/IMG][/URL]</textarea></td></tr>
              <tr> 
                <td><font color="#FF0000">效果：</font><a href=<%=myurl%>/get.asp?get=<%=ajk_username%>><img border=0 src="<%=adv_logo%>"></a></td>
              </tr>
              <tr> 
                <td><font class=blue>例子二：</font></td>
              </tr>
              <tr>
              <td><textarea name=textfield rows=3 cols=66 >[url=<%=myurl%>/get.asp?get=<%=ajk_username%>][IMG]<%=adv_img%>[/IMG][/URL]</textarea></td></tr>
              <tr> 
                <td><font color="#FF0000">效果：</font><a href=<%=myurl%>/get.asp?get=<%=ajk_username%>><img border=0 src="<%=adv_img%>"></a></td>
              </tr>
            <%
	Response.Write "<tr><td align='left'><font class=blue>进阶方法二：</font>将此链接通过邮件或者QQ发给你的朋友</td></tr><tr><td class=tablebody1>"
	Response.Write "代码："
	Response.Write myurl&"/get.asp?get="&ajk_username
	Response.Write "</td></tr></table>"
        Response.Write "<table border=0 width='100%' cellspacing=0 cellpadding=0>"
	Response.Write "<tr height=20><td align='right' class=td0></td> "
        Response.Write "<td width='95%' class=td0 align='center'><b><font class=red>广告公司说明</font></b></td>"
        Response.Write "<td  class=td0></td></tr></table>"
	Response.Write "<table cellspacing=1 cellpadding=6 class=tableborder1><tr><td class=tablebody1>" 
        Response.Write "*您可将这些广告代码贴到其他论坛或个人主页等地方，别人通过这个链接进入本社区，您就能获得反馈。<br>*您可根据反馈量获得良心（本站虚拟货币），交换比例暂定为：<font color='#FF0000'>"&adv_wealth&"</font>元现金  + <font color='#FF0000'>"&adv_EP&"</font> 点积分值/反馈点。<br>*为防止作弊，同一IP地址在"&adv_cheat&"秒内重复点击，只算一次点击。 </td></tr>"
	Response.Write "</td></tr></table>"
end sub

sub ajk_save()
        set rs=server.createobject("adodb.recordset")
	sql="select * from [adv_broker] where username='"&login_username&"'"
	rs.Open sql,conn_adv,1,2
	if rs.eof and rs.bof then
		rs.addnew
		rs("username")=login_username
		rs("addtime")=now()
		rs.update
		rs.close
		set rs=nothing
		conn_adv.close
                             
		Response.Write "<br><br><li>广告经纪人证书领取成功，请<a href='ajk.ASP'>[点击这里刷新]"
		exit sub
	else
		rs.close
		set rs=nothing
		Response.Write "<br><li>你已经领取过证书了，请不要重复领取。"
		exit sub
	end if
end sub

sub ajk_update()
	set rs=server.createobject("adodb.recordset")
	sql="select * from [adv_broker] where username='"&login_username&"'"
	rs.Open sql,conn_adv,1,2
	if rs.eof and rs.bof then
		rs.close
		set rs=nothing
		conn_adv.close
		Response.Write "<br><br><li>你尚未办理广告经纪人证书，请到<a href=ajk.asp>[广告公司]</a>去申请吧。"
		exit sub
	else
		if rs("updatetime")=date() then
			rs.close
			set rs=nothing
			conn_adv.close	
			Response.Write "<br><br><li>你今天已经领取佣金了，明天再来吧。"
			exit sub
		else
			rs("updatetime")=date()
			dim dianshu
			dianshu=rs("count_b")
			rs("count_b")=0
			rs.update
			rs.close

			set rs=server.createobject("adodb.recordset")
			sql="select * from [adv_config] where adv_type='默认'"
			rs.Open sql,conn_adv,1,1
			if rs.eof and rs.bof then
				Response.Write "<br><br><li>出现故障了，数据找不到了，请联系管理员。"
				exit sub
			else
				dim adv_wealth
				dim adv_cp
				dim adv_ep
				dim myurl
				adv_wealth=rs("adv_wealth")
				adv_ep=rs("adv_ep")
			end if
			rs.close
	
			sql = "select integral,emoney from [user_data] where username='"&login_username&"'"
			rs.open sql,conn,1,3
			if not rs.eof then
				rs("emoney")=rs("emoney")+dianshu*adv_wealth
				rs("integral")=rs("integral")+dianshu*adv_ep
				rs.update
			end if
			rs.close
			set rs=nothing
			Response.Write "<br><br>你已成功领取佣金：金钱"&dianshu*adv_wealth&",货币"&dianshu*adv_EP
                        Response.Write "<br><br>请<a href=ajk.asp>[返回]</a>吧！"
			exit sub
		end if
	end if
end sub
%>