<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/plus_check.asp"-->
<!--#include file="X_AdvCom_Conn.asp"-->
<%
Dv_plus.name="X_AdvCom"
Dv_plus.checklogin()
Dvbbs.Loadtemplates("")
If Not Dv_plus.plus_master Then
	Response.redirect "showerr.asp?ErrCodes=<li>对不起，您不是本广告公司经理，不能进行管理。&action=Plus"
End If

If Request("action")="add" Then
	Dvbbs.stats="保存设置"
	Dvbbs.nav()
	Dvbbs.Head_var 0,0,"广告公司","X_AdvCom.asp"
	Save()
Else
	Dvbbs.stats="后台管理"
	Dvbbs.nav()
	Dvbbs.Head_var 0,0,"广告公司","X_AdvCom.asp"
	Main()
End If
ClosePlusDB()
Set Dv_plus=Nothing 
Dvbbs.Footer

Sub Main()
	Dim MainSettings
	Dvbbs.Name="X_AdvCom_MainSetting"
	If Dvbbs.ObjIsEmpty() Then ReLoadSettings
	MainSettings=Split(Dvbbs.Value,"||")		
	

	Response.Write "<table cellspacing=1 cellpadding=6 class=tableborder1 align=center ><form method='POST' action='?action=add'><tr>"&_
		"<th  colspan='2'>广告公司简单统计</th></tr>"&_
		"<tr><td class=tablebody1>总反馈量：<b> "&MainSettings(7)&" </b>次<br>有效反馈：<b> "&MainSettings(8)&" </b>次<br>看来，有<b> "&int(MainSettings(7))-int(MainSettings(8))&" </b>次的反馈量你是不用付钱的，或者说，是客户乱点击的，无效。</td></tr></table><br>"&_
		"<table cellspacing=1 cellpadding=6 class=tableborder1 align=center ><form method='POST' action='?action=add'><tr>"&_
		"<th  colspan='2'>广告公司参数设定（总反馈："&MainSettings(7)&"，有效反馈："&MainSettings(8)&"</th></tr>"&_
		"<tr><td width=28%  align='right' class=tablebody1><b>广告内容</b>：<br>即点击广告后，要打开的网页&nbsp;</td><td class=tablebody1><input name='adv_url' type='text' size=50 value='"&MainSettings(0)&"'> * 请输入网址</td></tr>"&_
		"<tr><td  align='right' class=tablebody1><b>文字广告</b>：<br>即文字链接的内容&nbsp;</td><td class=tablebody1><input name='adv_txt' type='text' size=50 value='"&MainSettings(1)&"'> * 请输入字符，比如 <b><font color='#ff0000'>进入动网论坛</font></b> 这六个字</td></tr>"&_
		"<tr><td  align='right' class=tablebody1><b>图片广告</b>：<br>即发到别人网站上时显示的个性图片&nbsp;</td><td class=tablebody1><input name='adv_img' type='text' size=50 value='"&MainSettings(2)&"'> * 请输入个性图片的绝对地址<br><img src='"&MainSettings(2)&"' > </td></tr>"&_
		"<tr><td  align='right' class=tablebody1><b>防止作弊</b>：<br>即防止刷新，可限定同一IP点击的间隔&nbsp;</td><td class=tablebody1><input name='adv_cheat' type='text' size=5 value='"&MainSettings(3)&"'> * 请输入同一IP点击有效的间隔秒数</td></tr>"&_
		"<tr><td  align='right' class=tablebody1>金钱/反馈点：</td><td class=tablebody1><input name='adv_wealth' type='text' size=5 value='"&MainSettings(4)&"'>  * 请输入数字</td></tr>"&_
		"<tr><td  align='right' class=tablebody1>经验/反馈点：</td><td class=tablebody1><input name='adv_ep' type='text' size=5 value='"&MainSettings(5)&"'>  * 请输入数字</td></tr>"&_
		"<tr><td  align='right' class=tablebody1>魅力/反馈点：</td><td class=tablebody1><input name='adv_cp' type='text' size=5 value='"&MainSettings(6)&"'>  * 请输入数字</td></tr>"&_
		"<tr><td colspan='2' align='center' class=tablebody1><input type='submit' value='  确　定  '  name='cmdok' ></td></tr>"&_
		"</font></table><br>"
End Sub

Sub Save()
	Dim Rs,Sql
	Dim adv_url,adv_txt,adv_img,adv_cheat,adv_wealth,adv_cp,adv_ep
	adv_url=Request.Form("adv_url"):adv_txt=Request.Form("adv_txt"):adv_img=Request.Form("adv_img")
	adv_cheat=Request.Form("adv_cheat"):adv_wealth=Request.Form("adv_wealth"):adv_cp=Request.Form("adv_cp")
	adv_ep=Request.Form("adv_ep")
	
	If adv_url="" Or adv_txt="" Or adv_img="" Then
		Response.redirect "showerr.asp?ErrCodes=<li>请将各项信息填写完整。&action=Plus"
	ElseIf (Not IsNumeric(adv_cheat)) Or (Not IsNumeric(adv_wealth)) Or (Not IsNumeric(adv_cp)) Or (Not IsNumeric(adv_ep)) Then
		Response.redirect "showerr.asp?ErrCodes=<li>防作弊时间、金钱、经验或魅力点数都必须为数字型，请正确填写。&action=Plus"
	End If
	
	Set Rs=Server.CreateObject("ADODB.RecordSet")
	Sql="Select adv_url,adv_txt,adv_img,adv_cheat,adv_wealth,adv_ep,adv_cp,adv_type From [adv_config] where adv_type=1"
	If Not IsObject(Pconn) Then ConnectionPlusDB
	rs.Open sql,Pconn,1,3
	Dvbbs.SqlQueryNum=Dvbbs.SqlQueryNum+1
	If Rs.Eof And Rs.Bof Then
		Rs.AddNew
	End If
		Rs(0)=adv_url
		Rs(1)=adv_txt
		Rs(2)=adv_img
		Rs(3)=adv_cheat
		Rs(4)=adv_wealth
		Rs(5)=adv_ep
		Rs(6)=adv_cp
		Rs(7)=1
	Rs.update
	Rs.Close
	Set Rs=Nothing
	ReLoadSettings()
	Dvbbs.Dvbbs_Suc "<li>广告公司设置成功"
End Sub
%>