<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_Popfun.asp -->

<!--#include file="ad_conn.asp"-->
<%
DEF_BBS_HomeUrl = "../../"
const npage = 2

GBL_CHK_TempStr=""
OpenDatabase
CheckUserOnline

dim master
if CheckSupervisorUserName = 1  then
	master=true
  else
        master=false
end if

dim rs,sql
dim headvar,stats
	headvar="&nbsp>>&nbsp<a href=ad.asp><font class=NavColor>广告公司</font></a>"
              stats=">>&nbsp广告公司后台管理"
BBS_SiteHead DEF_SiteNameString&" "&DEF_BBS_Name,GBL_board_ID,headvar&" "&stats


	If Not master Then
	   msg= "<li>您不是管理员，没有进入广告公司后台的权利。</li>"
	   Errormsg
	else
		dim action 
		action=request("action")
		if action="add" then
			call save()
		else
			call main()
		end if 
	End If

	
sub main()
   If Not master Then
      exit sub
   else
	set rs=server.createobject("adodb.recordset")
	sql="select * from [adv_config] where adv_type='默认'"
	rs.Open sql,conn_adv,1,3
	if rs.eof and rs.bof then
		rs.addnew
		rs("adv_type")="默认"
		rs("adv_url")=myurl
		rs("adv_txt")=DEF_SiteNameString
		rs("adv_img")=myurl&"/plug-ins/ad/images/adv.gif"
		rs("adv_cheat")=200
		rs("adv_wealth")=100
		rs("adv_ep")=1
		rs("adv_cp")=5
		rs.update
	end if

	Response.Write "<table cellspacing=1 cellpadding=3 class=tbone width="&DEF_BBS_ScreenWidth&" align=center ><tr class=tbhead2>"
	Response.Write "<td colspan='2' align=center><b><font class=HeadFont>广告公司统计</font></b></td></tr>"
	Response.Write "<tr><td class=tbbg1>总反馈量：<b> "&rs("adv_click")&" </b>次<br>有效反馈：<b> "&rs("adv_click1")&" </b>次<br>看来，有<b> "&rs("adv_click")-rs("adv_click1")&" </b>的反馈量你是不用付钱的，或者说，是客户乱点击的，无效。</td></tr></table>"
		
	Response.Write "<table cellspacing=1 cellpadding=3 class=tbone width="&DEF_BBS_ScreenWidth&" align=center ><form method='POST' action='?action=add'><tr class=tbhead2>"
	Response.Write "<td colspan='2' align=center><b><font class=HeadFont>广告公司参数设定</font></b></td></tr>"
	Response.Write "<tr class=tbbg1><td width=28%  align='right'><b>广告内容</b>：<br>即点击广告后，要打开的网页&nbsp;</td><td><input name='adv_url' type='text' size=50 value='"&rs("adv_url")&"'> * 请输入网址</td></tr>"
	Response.Write "<tr class=tbbg1><td align='right' ><b>文字广告</b>：<br>即文字链接的内容&nbsp;</td><td><input name='adv_txt' type='text' size=50 value='"&rs("adv_txt")&"'> * 请输入字符，比如 <b><font color='#ff0000'>进入leadbbs论坛</font></b> 这几个字</td></tr>"
	Response.Write "<tr class=tbbg1><td align='right' valign=top><b>图片广告</b>：<br>即发到别人网站上时显示的个性图片&nbsp;</td><td><input name='adv_img' type='text' size=50 value='"&rs("adv_img")&"'> * 请输入个性图片的绝对地址<br><img src='"&rs("adv_img")&"' > </td></tr>"
	Response.Write "<tr class=tbbg1><td align='right'><b>防止作弊：</b><br>即防止刷新，可限定同一IP点击的间隔&nbsp;</td><td><input name='adv_cheat' type='text' size=5 value='"&rs("adv_cheat")&"'> * 请输入同一IP点击有效的间隔秒数</td></tr>"
	Response.Write "<tr class=tbbg1><td align='right'><b>金钱/反馈点：</b></td><td><input name='adv_wealth' type='text' size=5 value='"&rs("adv_wealth")&"'>  * 请输入数字</td></tr>"
	Response.Write "<tr class=tbbg1><td align='right'><b>经验/反馈点：</b></td><td><input name='adv_ep' type='text' size=5 value='"&rs("adv_ep")&"'>  * 请输入数字</td></tr>"
	Response.Write "<tr class=tbbg1><td align='right'><b>魅力/反馈点：</b></td><td><input name='adv_cp' type='text' size=5 value='"&rs("adv_cp")&"'>  * 请输入数字</td></tr>"
	Response.Write "<tr class=tbbg1><td colspan='2' align='center'>以上数据请规规矩矩的输入，该输数字的，就输数字，该输网址的，就输网址，否则，出错了，天皇老子也救不了你了。</td></tr>"
	Response.Write "<tr class=tbbg1><td colspan='2' align='center'><input type='submit' value='  确　定  '  name='cmdok' ></td></tr>"
	Response.Write "</font></table><br>"
	
	rs.close
	set rs=nothing
   end if	
	

end sub

sub save()
    If Not master Then
       exit sub
    else
	if request.form("adv_url")="" or request.form("adv_txt")="" or request.form("adv_img")="" or  request.form("adv_cheat")="" or  request.form("adv_wealth")="" or  request.form("adv_cp")="" or  request.form("adv_ep")="" then
		msg= "<li>信息保存不够。有一栏或更多栏信息尚未填写。</li>"
		Errormsg
                exit sub
	end if
	
	set rs=server.createobject("adodb.recordset")
	sql="select * from [adv_config] where adv_type='默认'"
	rs.Open sql,conn_adv,1,3
	if rs.eof and rs.bof then
		rs.addnew
		rs("adv_type")="默认"
		rs("adv_url")=request.form("adv_url")
		rs("adv_txt")=request.form("adv_txt")
		rs("adv_img")=request.form("adv_img")
		rs("adv_cheat")=request.form("adv_cheat")
		rs("adv_wealth")=request.form("adv_wealth")
		rs("adv_ep")=request.form("adv_ep")
		rs("adv_cp")=request.form("adv_cp")
		rs.update
	else
		rs("adv_url")=request.form("adv_url")
		rs("adv_txt")=request.form("adv_txt")
		rs("adv_img")=request.form("adv_img")
		rs("adv_cheat")=request.form("adv_cheat")
		rs("adv_wealth")=request.form("adv_wealth")
		rs("adv_ep")=request.form("adv_ep")
		rs("adv_cp")=request.form("adv_cp")
		rs.update
	end if
	rs.close
	set rs=nothing
%>
<script language="vbscript">
msgbox "广告公司信息已经保存成功！"
location.href = "ad_admin.asp"
</script>			 
	
<%
   end if	
end sub
'尾部信息
If GBL_TableBottomString <> "" Then %>
 <table width=<%=DEF_BBS_ScreenWidth%> border=0 cellspacing=0 cellpadding=0 align=center>
   <tr><td><%=GBL_TableBottomString%></td></tr>
 </table>
<% End If 
  SiteBottom 
   If GBL_SiteBottomString <> "" Then Response.Write GBL_SiteBottomString
%>