<!--#include file="Inc.asp"-->
<!--#include file="z_adv_conn.asp"-->
<%
Sub Alert(message)
	message = replace(message,"'","\'")
	Response.Write ("<script LANGUAGE='javascript'>alert('" & message & "');window.location.href='z_adv.asp';</script>")
	Response.End
End Sub

If Not BBS94KK.Founduser Then BBS94KK.GoToErr(10)
Call BBS94KK.Head("广告公司")

Select Case Request("action")
case "save" 
		call save()
case "update"
		call update()
case else
		call main()
end select
BBS94KK.Footer()
Set BBS94KK=Nothing
sub main()
	Dim rs_adv,Content
	set rs_adv=server.createobject("adodb.recordset")
	rs_adv.Open "select * from [adv_config] where adv_type='默认'",conn_adv,1,1
	if rs_adv.eof and rs_adv.bof then
		Call Alert("错误!广告公司尚未启用.")
	else
	dim adv_url
	dim adv_txt
	dim adv_img
	dim adv_cheat
	dim adv_wealth
	dim adv_cp
	dim adv_ep
	dim myurl
	myurl="http://bbs.ju4t.com"
	if mid(myurl,len(myurl),1)="/" then myurl=mid(myurl,1,len(myurl)-1)
		adv_url=rs_adv("adv_url")
		adv_txt=rs_adv("adv_txt")
		adv_img=rs_adv("adv_img")
		adv_cheat=rs_adv("adv_cheat")
		adv_wealth=rs_adv("adv_wealth")
		adv_ep=rs_adv("adv_ep")
		adv_cp=rs_adv("adv_cp")
	end if
	rs_adv.close
	set rs_adv=nothing
       Content= "<table border=0 cellpadding=4 cellspacing=0 style='border-collapse: collapse' width='100%'><tr><td height=25>"
        Content=Content& "<TD width=40% valign=top>"
        Content=Content& "<TABLE height=100% width=98% cellSpacing=1 cellPadding=3 border=0 align=center>"
	Content=Content& "<tr height=5><td align=middle colspan=3><b>广告经纪人排行</b></td></tr>"
	Content=Content& "<tr height=5><td align=middle>名次</td><td align=middle>姓名</td><td align=middle>反馈量</td></tr>"
	set rs_adv=server.createobject("adodb.recordset")
	rs_adv.Open "select top 10 * from [adv_broker] order by count_Z desc",conn_adv,1,2
	dim i
	i=1
	do while not rs_adv.eof
		Content=Content& "<tr  height=22><td align=middle><img src='plusimg/img_adv/level-1-"&i&".gif'></td>"
		Content=Content& "<td align=middle><a href='userinfo.asp?userid="&rs_adv("userid")&"' target='_blank'>"&rs_adv("username")&"</a></td><td align=middle><b>"&rs_adv("count_z")&"</b></td></tr>"
		i=i+1
		rs_adv.movenext
	loop
	rs_adv.close
	Content=Content& "</table></td><td width=55% valign=top><TABLE>"
	Content=Content& "<tr><td><table width=100% cellspacing=1 cellpadding=1 align=center valign=top><tr><td class=a1 height=25 align=middle><b>您的业务统计</b>"
	Content=Content& "</td></tr><tr><td>"
	rs_adv.Open "select * from [adv_broker] where username='"&BBS94KK.MyName&"'",conn_adv,1,2
	if rs_adv.eof and rs_adv.bof then
    Content=Content& "<table width='98%' border='0' cellpadding='3' cellspacing='1' class=a2><tr><td width=30% border=0>"
Content=Content& "<center>欢迎你，<b>"&BBS94KK.MyName&"</b></center>"              
Content=Content& "<br><li>目前现金："&SESSION(CACHENAME & "MyInfo")(7)
Content=Content& "<br><li>目前存款："&SESSION(CACHENAME & "MyInfo")(26)
Content=Content& "<br><li>目前积分："&SESSION(CACHENAME & "MyInfo")(6)
Content=Content& "</td><td width=70% border=0>"
Content=Content& "<li><b>业务介绍：</b>通过做社区的广告经纪人赚钱<br><br><li><b>办理费用：</b>完全免费<br><br><li><b>办理条件：</b>只要是会员均可，只要办理一张证书<br>　　　   　　<a href='?action=save'><img src='plusimg/img_adv/adv_1.gif' border=0></a></td></tr>" 
	else
Content=Content& "<table width='98%' border='0' cellpadding='3' cellspacing='1'><tr><td>"
Content=Content& "<center>欢迎你，<b>"&BBS94KK.MyName&"</b></center>"              
Content=Content& "<br><li>目前现金："&SESSION(CACHENAME & "MyInfo")(7)
Content=Content& "<br><li>目前存款："&SESSION(CACHENAME & "MyInfo")(26)
Content=Content& "<br><li>目前积分："&SESSION(CACHENAME & "MyInfo")(6)
Content=Content& "</td><td>"
Content=Content& "<li>总有效广告反馈量："&rs_adv("count_z")
Content=Content& "次<br><br><li>本次累积的反馈量："&rs_adv("count_b")
Content=Content& "次<br><br><li>本次共累积<br>　　　   佣金："&rs_adv("count_b")*adv_wealth
Content=Content& "点<br>　　　   积分："&rs_adv("count_b")*adv_ep
Content=Content& "点</td><td align=middle>"
Content=Content& "您上次领取佣金时间："&rs_adv("updatetime")		
Content=Content& "<br><br><a href='?action=update'><img src='plusimg/img_adv/adv_2.gif' border=0></a></td></tr>"
end if
rs_adv.close	
Content=Content& "</table></td></tr></table></td></tr><tr><td height=15></td></tr>"
Content=Content& "<tr><td><TABLE height=98% cellSpacing=1 cellPadding=3 border=0><tr><td align=middle height=25><b>宣传方式</b></td>"
Content=Content& "</tr><tr><td height=25><font color=red><b>你的广告代码："
Content=Content& myurl&"/get.asp?get="&BBS94KK.MyID
Content=Content& "</b></font></td></tr><tr><td><table width=""98%"" border=""0"" cellspacing=""0"" cellpadding=""3""><tr><td><b><br>方法一：在其他论坛或聊天室发带有以下链接的帖子</b><br><br></td></tr><tr><td>在支持UBB的论坛上可以是这样</td>             </tr>              <tr>  <td><input name=""textarea"" type=""text"" style=""width:470px"" style=""border: 1px  solid #000000; height: 18px;"" value=""[url="&myurl&"/get.asp?get="&BBS94KK.MyID&"]"&adv_txt&"[/url]""></td>             </tr>              <tr>                <td><font color=""#FF0000"">效果：</font><a target=_blank href="&myurl&"/get.asp?get="&BBS94KK.MyID&">"&adv_txt&"</a></td></tr><tr>                <td>在论坛上，还可以把图片链接放到签名里（在帖子里好像不行）</td></tr>             <tr><td><input name=""textfield"" type=""text"" style=""width:470px"" style=""border: 1px  solid #000000; height: 18px;""  value=""[url="&myurl&"/get.asp?get="&BBS94KK.MyID&"][IMG]"&adv_img&"[/IMG][/URL]""></td></tr> <tr>                <td><font color=""#FF0000"">效果：</font><a href="&myurl&"/get.asp?get="&BBS94KK.MyID&"><img border=0 src="&adv_img&"></a></td></tr></table>"
	Content=Content& "</td></tr><tr><td class=a3>"
    Content=Content& "<table width=100% cellspacing=0 cellpadding=3><td>"
    Content=Content& "<tr><b><br>方法二：将此链接通过邮件或者QQ发给你的朋友</b></td></tr><tr><td>"
	Content=Content& "<br><font color=red>代码："
	Content=Content& myurl&"/get.asp?get="&BBS94KK.MyID
        Content=Content& "</font></td></tr></table><tr><td><table width=98% cellspacing=0 cellpadding=3><tr><td><br><b>广告公司说明：</b><br></td></tr><tr><td>"
	Content=Content& "<li>将广告代码贴到其他论坛或主页等地方，别人通过这个链接进入本社区，您就能获得反馈。<br><br><li>您可根据反馈量获得奖励，交换比例暂定为：("&adv_wealth&"元现金)/每反馈点。<br><br><li>为防止作弊，同一IP地址在"&adv_cheat&"分钟内重复点击，只算一次点击。 </td></tr>"
	Content=Content& "</table></td></tr></table></td></tr></table></td></tr></table></div>"
	Call BBS94KK.ShowTable("广告公司",Content)

end sub
'领取证书
sub save()
	dIM RS_ADV
	set rs_adv=server.createobject("adodb.recordset")
	rs_adv.Open "select * from [adv_broker] where username='"&BBS94KK.MyName&"'",conn_adv,1,2
	if rs_adv.eof and rs_adv.bof then
		rs_adv.addnew
		rs_adv("userid")=BBS94KK.MyID
		rs_adv("username")=BBS94KK.MyName
		rs_adv("addtime")=now()
		rs_adv.update
		rs_adv.close
		set rs_adv=nothing
		conn_adv.close
		Call Alert("提示：广告经纪人证书获取成功!")
		else
		rs_adv.close
		set rs_adv=nothing
		conn_adv.close
		Call Alert("提示：你已经领取证书了，请不要重复申领")
		end if
end sub
'领取佣金
sub update()
	dim rs_adv
	set rs_adv=server.createobject("adodb.recordset")
	rs_adv.Open "select * from [adv_broker] where userid="&BBS94KK.MyID,conn_adv,1,2
	if rs_adv.eof and rs_adv.bof then
		rs_adv.close
		set rs_adv=nothing
		conn_adv.close
		Call Alert("你尚未办理广告经纪人证书,请到广告公司去申请吧.")
	else
		if rs_adv("updatetime")=date() then
			rs_adv.close
			set rs_adv=nothing
			conn_adv.close	
		Call Alert("你今天已经领取雇佣金了，明天再来吧")
else
rs_adv("updatetime")=date()
			dim dianshu
			dianshu=rs_adv("count_b")
			rs_adv("count_b")=0
			rs_adv.update
			rs_adv.close
	set rs_adv=server.createobject("adodb.recordset")
			rs_adv.Open "select * from [adv_config] where adv_type='默认'",conn_adv,1,1
if rs_adv.eof and rs_adv.bof then
			Call Alert("出现故障了，数据找不到了，请联系管理员.")
else
dim adv_wealth
dim adv_cp
dim adv_ep
dim myurl
adv_wealth=rs_adv("adv_wealth")
adv_ep=rs_adv("adv_ep")
adv_cp=rs_adv("adv_cp")
end if
rs_adv.close

BBS94KK.Execute("Update [KK_user] Set Coin=Coin+"&dianshu*adv_wealth&" where Name='"&BBS94KK.MyName&"'")
Call Alert("你已经成功领取佣金：金钱"&dianshu*adv_wealth&"。")
end if
end if
end sub
%>