<%
 	data_path="../../" 'ACC连接数据库路径，对SQL无效
	numid="no"
	dir="no" 
  %>
  <!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/filesystem.asp"-->
 <!--#include file="../../inc/safe.asp"-->
  <!--#include file="../rolecheck.asp"-->


 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<LINK href="../css/style.css" rel=stylesheet type=text/css>
 <title></title>
 <style type="text/css">
<!--
.STYLE1 {
	color: #0099CC;
	font-weight: bold;
}
.STYLE3 {color: #CC4A44}
.STYLE4 {color: #CE4942}
.STYLE5 {
	color: #0033FF;
	font-weight: bold;
}
.STYLE6 {color: #666666}
.STYLE7 {color: #FF0000}
.STYLE8 {color: #FFFFFF}
.STYLE9 {color: #FFFFFF; font-weight: bold; }
.STYLE10 {color: #0066CC}
-->
 </style>
 <script language="javascript">
 function gook()
 {
 var i=confirm("你确定要删除吗？");
 if(i)
 {
 return true ;
 }
 else
 {
 return false;
 }
 }
   function strDateTime(str,str1)
      {
        var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/; 
          
        if(reg.test(str)==false)
		{
alert(str1);
 return false;
		}
		else
		{
return true ;
		}
 
      } 
 function strDateTimef()
 {
  var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/; 
     if((reg.test(document.form1.starttime.value)==false)||(reg.test(document.form1.endtime.value)==false))
		{
 		 alert('请输入正确的竞价时间格式！');
		  return false;
 		}
		else
		{
 		 return true ;
		}
  
 }
 </script>
</head>

<%

msg=""
'-更新竞价配置数据----------------------------
goo=Replace_Text(request("goo"))
starttime=Replace_Text(request("starttime"))
endtime=Replace_Text(request("endtime"))
isopen=Replace_Text(request("isopen"))
  des=request("content")

if goo<>"" then
if not  (isdate(starttime) and isdate(endtime)) then
 response.Write("<script >alert('对不起！你输入的竞价起始时间格式不正确，请输入如:"&now()&"的时间格式!');history.back(-1);</script>")
response.End()
 end if
 if isopen<>"" then
 isopen=1 
 else
 isopen=0
 end if
 if maxnum="" then
 maxnum=0
 end if
set rsc=server.CreateObject("adodb.recordset")
sqlc="select top 1 * from Websen_config_price "
rsc.open sqlc,conn,1,3
if not rsc.eof  then
rsc("starttime")=starttime
rsc("endtime")=endtime
rsc("isopen")=isopen
rsc.update
msg="修改成功！"
rsc.close
end if
  
end if

'-------------------------

'--添加竞价搜索率级别-------------------------------------
addgo=Replace_Text(request("addgo"))
addminrates=Replace_Text(request("addminrates"))
addmaxrates=Replace_Text(request("addmaxrates"))
addlowprice=Replace_Text(request("addlowprice"))
addhighprice=Replace_Text(request("addhighprice"))
addaddprice=Replace_Text(request("addaddprice"))
 if addgo<>"" then
  if addmaxrates<>"" and addminrates<>"" and addlowprice<>"" and addhighprice<>"" and addaddprice<>"" then
   set rsr=server.CreateObject("adodb.recordset")
   sqlr="select  * from Websen_rate_price where minrates='"&addminrates&"' and maxrates='"&addmaxrates&"'  "
   rsr.open sqlr,conn,1,3
    if not rsr.eof  then 
	response.Write("<script>alert('对不起！添加失败！该搜索率已经存在！');history.back(-1);</script>")
	response.End()
	else
	rsr.addnew
	rsr("minrates")=addminrates
	rsr("maxrates")=addmaxrates
 	rsr("lowprice")=addlowprice
	rsr("addprice")=addaddprice
	rsr("highprice")=addhighprice
	rsr.update	
	end if
	rsr.close
  end if 
 end if
 
 
'------------------------------------



'删除记录-----------------------------
action=Replace_Text(request("action"))
rateid=Replace_Text(request("rateid"))
if action="del" then
if rateid<>"" then
conn.execute "delete from Websen_rate_price  where id="&rateid
end if

end if


'---------------------------------


' 修改记录----------------------------------------
ego=Replace_Text(request("ego"))
eminrates=Replace_Text(request("eminrates"))
emaxrates=Replace_Text(request("emaxrates"))
elowprice=Replace_Text(request("elowprice"))
ehighprice=Replace_Text(request("ehighprice"))
eaddprice=Replace_Text(request("eaddprice"))
 moid=Replace_Text(request("moid"))
 'conn.execute "TRUNCATE TABLE Websen_info"
 if ego<>"" then
 if eminrates<>"" and emaxrates<>""  and elowprice<>"" and  ehighprice<>"" and eaddprice<>"" and moid<>"" then 
 if int(eminrates)>int(emaxrates) then
 	response.Write("<script>alert('对不起！你输入的搜索率范围值不符合要求，请检查！');history.back(-1);</script>")
	response.End()
 end if
 set rsre=server.CreateObject("adodb.recordset")
   sqlre="select  * from Websen_rate_price where minrates='"&eminrates&"' and maxrates='"&emaxrates&"'  and 	 id<>"&moid&" "
     rsre.open sqlre,conn,1,3
    if not rsre.eof  then 
	response.Write("<script>alert('对不起！修改失败！该搜索率已经存在！');history.back(-1);</script>")
	else
 	conn.execute "update Websen_rate_price set minrates='"&eminrates&"',maxrates='"&emaxrates&"',lowprice="&elowprice&",addprice="&eaddprice&",highprice="&ehighprice&" where id="&moid
  	end if
	rsre.close
 end if
 
 end if
'---------------------------------------------

%>
<body>
<table cellpadding="1" cellspacing="1" border="0" width="100%" class="tableBorder" align="center">
    <tr align="center">
      <th height="25" align="center"><span class="tableHeaderText"><strong>竞价系统参数管理</strong></span> </th>
    </tr>
</table>
  
  <table cellpadding="0" bordercolor="#D6EFF7" cellspacing="0" border="1" width="98%"  align="center">
    <tr align="center">
 <td>
 
   <table cellpadding="0" cellspacing="0" border="0" width="100%"  align="center">
    <tr align="center">
 <td>
    <table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#79A3DB">
  <form   name="form1" method="post" action="index.asp"  onsubmit="return  strDateTimef();">
    <script language="JavaScript" src="datetime.js"> </script> 
   <tr bgcolor="#F9F9F9">
      <td height="23" colspan="4"    > <font color="red">注意</font>:①.输入的竞价的起始、结束时间格式应如：<font color="#0000FF"><%=now()%></font> <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;②.操作提示：点击可以输入时间，双击可以选择时间 <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;③.由于服务设置段为一个月，故每月只进行一次竞价活动，本月参加竞价成功(已支付费用的)，由系统的栏目<span class="STYLE7">【<a href="compare_price/current.asp" target="main">当前竞价数据管理</a> 】中的 "竞价处理"按钮</span>决定进行处理存储以备下月启用！对竞价失败的将删除！ <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;④.请注意本月竞价活动的开通与关闭的结束时间及后台进行审核处理期一定要在下月1号前完成,防止成功的用户不能及时看到效果！<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⑤.请点击栏目<span class="STYLE7">【<a href="compare_price/current.asp" target="main">当前竞价数据管理</a> 】中的"竞价处理"按钮</span>将执行本月竞价最终结果处理！此操作不可逆！不可同一个月内重复执行，切记，后果自负！
  <br />
  <span class="STYLE10">&nbsp;竞价成功的服务将在用户输入关键字进行查询时，优先将该服务会员的相关信息优先排前，本月竞价成功的将在下月方可生效！        </span>
  <hr size="3"    color="#6888D2" width="99%" />	<%if msg<>"" then%><center><br /><font color="red"><b><%=msg%></b></font><br />	</center><%end if%> 
          <% 
 	 	sql1="SELECT  * FROM Websen_config_price"
		Set rs1= Server.CreateObject("ADODB.Recordset") 
		rs1.Open sql1,conn
       if not  rs1.eof then 
		%>
          (一).<span class="STYLE1">是否开通竞价活动</span>：<br />
          <input type="checkbox" name="isopen" value="<%=rs1("isopen")%>"  <% if rs1("isopen")= 1 then %>checked<% end if%> />开通
 
 	  &nbsp; <span class="STYLE4">竞价的起始时间</span>:
	   
           <input name="starttime"  type="text" onDblClick="calendar()" onBlur="strDateTime(this.value,'请输入正确的竞价的起始时间格式');" value="<%
 		   if Replace_Text(rs1("starttime"))="" then 
		    startdate=now()
			else
			startdate=rs1("starttime")
		   end if
		   response.Write(startdate)
		   %>" size="22" maxlength="35" />
		   
           &nbsp;<span class="STYLE3">竞价的结束时间</span>：
		   
           <input name="endtime" type="text" onDblClick="calendar()"  onblur="strDateTime(this.value,'请输入正确的竞价的结束时间格式');" value="<%
		  if Replace_Text(rs1("endtime"))="" then 
		    enddate=now()
			else
			enddate=rs1("endtime")
		   end if
		   response.Write(enddate)
           %>" size="22" maxlength="35" />
            
        <% 
  		rs1.Close
		set rs1=Nothing
		end if
 	%>      
  	
	&nbsp;&nbsp;<input type="submit" value=" 修 改 " name="goo" /><hr  size="1" color="#7487D6" width="99%" />&nbsp;
    <a href="des.asp"><span class="STYLE5"   >修改竞价服务使用说明</span></a>(<font  color="#999999">用于展示说明竞价服务、帮助使用</font>)</td>
    </tr>	
	<tr><td align="center">
	
	</td></tr>
	</form>
 	</table>
 </td>    </tr>
  </table>
  
  
 </td>    </tr>
  </table>
  
 	
	<table width="98%" border="1" style=" border-collapse:collapse" align="center" cellpadding="0" cellspacing="0" bordercolor="#6694D0" >

    <tr>
      <td height="23" colspan="5" align="left" valign="bottom" bgcolor="#79A3DB"  >&nbsp;<span class="STYLE9">(二).搜索率与对应的价格设置</span><span class="STYLE8">↓</span>&nbsp;&nbsp;<span class="STYLE8">(参加竞价的关键词的搜索率越高，相应的价格就越高,在此设置相应的等次供竞价时参照使用) </span><br /></td>
    </tr>
    <tr>
      <td width="42%" height="23" align="left" valign="bottom" bgcolor="#C0CEE0" class="forumRow"><span class="STYLE4">搜索率(<span class="STYLE6">次数</span>)-----与[<a href="../hotkeywords.asp" target="main">热门关键字(动态)设置</a>]相关联</span></td>
      <td width="20%" align="left" valign="bottom" bgcolor="#C0CEE0" class="forumRow"><span class="STYLE4">起拍价</span></td>
      <td width="13%" align="left" valign="bottom" bgcolor="#C0CEE0" class="forumRow"><span class="STYLE4">一口价</span></td>
      <td height="23" colspan="2" align="left" valign="bottom" bgcolor="#C0CEE0" class="forumRow"><span class="STYLE4">每次加价幅度</span></td>
    </tr>
 
    	<form name="addform"   action="index.asp"  method="post" >
 <tr>
      <td height="23" bgcolor="#E2E9F0"  >范围:<input name="addminrates"  onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}" type="text" value="" size="7" maxlength="20" />与<input name="addmaxrates"  onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}" type="text" value="" size="7" maxlength="20" />之间</td>
      <td height="23" bgcolor="#E2E9F0"  ><input name="addlowprice"  onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}" type="text" value="" size="7" maxlength="20" />
元</td>
      <td height="23" bgcolor="#E2E9F0"  ><input name="addhighprice" onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}"  type="text" size="8" maxlength="20" value="" />
元</td>
      <td width="13%" height="23" bgcolor="#E2E9F0"  ><input name="addaddprice" onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}"  type="text" size="8" maxlength="20" value="" />
元</td><td width="12%"  bgcolor="#E2E9F0">&nbsp;
  <input type="submit" value="添加" name="addgo" />
   </td>
    </tr>
	</form>	
	<%
	if Replace_Text(request("action"))="modi"  and  Replace_Text(request("modiid"))<>"" then
	 set rsm=server.CreateObject("adodb.recordset")
	 sqlm="select * from Websen_rate_price where id="&Replace_Text(request("modiid"))
	 rsm.open sqlm,conn,1,3
	 if not rsm.eof then 
  	 %>
  <form name="modiform"   action="index.asp"  method="post" >
 <tr  bgcolor="#6694D0" style="color:#FFFFFF; font-weight:bold">
      <td height="30"    >范围:<input name="eminrates"  onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}" type="text" value="<%=rsm("minrates")%>" size="7" maxlength="20" />与<input name="emaxrates"  onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}" type="text" value="<%=rsm("maxrates")%>" size="7" maxlength="20" />之间</td>
      <td     ><input name="elowprice"  onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}" type="text" value="<%=rsm("lowprice")%>" size="7" maxlength="20" />
元</td>
      <td   ><input name="ehighprice" onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}"  type="text" size="8" maxlength="20" value="<%=rsm("highprice")%>" />
元</td>
      <td    ><input name="eaddprice" onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}"  type="text" size="8" maxlength="20" value="<%=rsm("addprice")%>" />
元</td><td   >&nbsp;<input  type="hidden" name="moid" value="<%=Replace_Text(request("modiid"))%>" /><input type="submit" value="修改" name="ego" />
   </td>
    </tr>
 </form>	
 	<%
	rsm.close
    end if
	end if
 
  
	 	sql2="SELECT id, minrates,maxrates, lowprice, addprice, highprice FROM Websen_rate_price"
		Set rs2= Server.CreateObject("ADODB.Recordset") 
		rs2.Open sql2,conn
		do while Not rs2.Eof
	%>
    <tr  bgcolor="#F7F7F7">
      <td height="30"  > &nbsp;&nbsp;<%= rs2("minrates") %><font  color="#FF0000"><=</font><font color="#999999">搜索率</font><font color="#FF0000"><=</font><%=rs2("maxrates")%> </td>
      <td  > &nbsp;&nbsp;<%= rs2("lowprice")%> 
<font color="#999999">元</font></td>
      <td  > &nbsp;&nbsp;<%=rs2("highprice")%> 
<font color="#999999">元</font></td>
      <td >  &nbsp;&nbsp;<%=rs2("addprice")%> 
<font color="#999999">元</font></td><td>
   &nbsp;&nbsp;<a href="index.asp?action=modi&modiid=<%=rs2("id")%>">修改</a>&nbsp;<a href="index.asp?action=del&rateid=<%=rs2("id")%>" onClick="return gook();">删除</a></td>
    </tr>
	<tr><td colspan="5"  bgcolor="#EFEFEF" height="1" ></td></tr>
    <% 
		rs2.movenext
		loop 
		rs2.Close
		set rs2=Nothing
 	%>
</table>
  
 
  
</body>
</html>
