<!--#include file="../prohead.asp"-->
 <!--#include file="../checkrole.asp"-->
 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 <style type="text/css">
<!--
.STYLE1 {font-weight: bold}
-->
</style>
 <%
 call checkuser("gjj")
 if issession=0 then
gsid=Replace_Text(request.Cookies("Yxmemberid"))
else
gsid=session("id")
end if
 %>
 
 <script language="javascript">
 function showgrade(obj)
{
 if(obj.value==1)
 {
document.mform.addtwo.value=1;
if(document.all("zhu").style.display=='none')
{
document.all("zhu").style.display='';
}
else
{
document.all("zhu").style.display='';
}

 }
 else if(obj.value==2)
 {
 document.mform.addtwo.value=2;
 if(document.all("zhu").style.display=='')
{
document.all("zhu").style.display='none';
}
else
{
document.all("zhu").style.display='none';
}
 }
 else
 {
 document.mform.addtwo.value=1;
 if(document.all("zhu").style.display=='none')
{
document.all("zhu").style.display='';
}
else
{
document.all("zhu").style.display='';
}
 }
 }
 
  
function checkform()
{
var str=parseInt(document.mform.toprice.value);

var str2=parseInt(document.mform.topricebak.value);
 var str3=parseInt(document.mform.addhigh.value);
var str4=parseInt(document.mform.oldp.value);

 if(document.mform.addtwo.value=="1")
{
 if(((str+str4)-str3)>=0)
{
alert("温馨提示：您的总出价已符合一口价的条件！请你选择一口价！");
return false;
}
if((str-str2)<0)
{
alert(document.mform.txtv.value);
return false;
}
else
{
var i=confirm("您确定出此价吗？");
if(i)
{
return true ;
}
else
{
return false;
}

return true;
}
}
}
  </script>
<SCRIPT language=javascript> 
<!-- Hide 
function killErrors() { 
return true; 
} 
window.onerror = killErrors; 
//需要报JS错的请删除此JS
// --> 
</SCRIPT> 
  <style type="text/css">
<!--
.STYLE1 {
	color: #FF0000;
	font-weight: bold;
}
 -->
</style>
<%
'添加记录------------------------------------------------------------------
goadd=Replace_Text(request("goadd"))
addkey=Replace_Text(request("addkey"))
addtype=Replace_Text(request("addtype"))
toprice=Replace_Text(request("toprice"))
oldp=Replace_Text(request("oldp"))
topricebak=Replace_Text(request("topricebak"))
addhigh=Replace_Text(request("addhigh"))
addp=Replace_Text(request("addp"))
if goadd<>"" then
	if not isnumeric(toprice) then
	response.Write("<script>alert('请输入金额为数字！');history.back(-1);</script>")
	response.End()
	end if
	if addtype="1" then
	  if addp="1" then
		if clng(toprice)<clng(topricebak) then
		response.Write("<script>alert('对不起！你输入的竞价金额不能低于该关键字的起拍价！');history.back(-1);</script>")
		response.End()
		end if
	  end if
  	elseif addtype="2" then
	  if addp="1" then
		if clng(toprice)<clng(topricebak) then
		response.Write("<script>alert('对不起！你输入的加价金额不能低于该关键字的每次加价幅度！');history.back(-1);</script>")
		response.End()
		end if
	  end if
 	end if
	 if addp="1" then
		 if (clng(toprice)+clng(oldp))>clng(addhigh) then
		 response.Write("<script>alert('温馨提示：您的总出价已符合一口价的条件！请你选择一口价！');history.back(-1);</script>")
		 response.End()
		 end if	
	 end if
 
 set rsyi=server.CreateObject("adodb.recordset")
 sqlyi="select * from yixiang_temp_price where keywords='"&addkey&"' and ishigh=1"
 rsyi.open sqlyi,conn,1,1
 if not rsyi.eof then
   response.Write("<script>alert('温馨提示：对不起！该关键词已被一口价买断！出价失败！');location.href='addprice.asp?addkey="&addkey&"&goprice=zhu';</script>")
   response.End()
 else
 
   set rsadd=server.CreateObject("adodb.recordset")
  sqladd="select  * from yixiang_temp_price where keywords='"&addkey&"' and gsid="&gsid
  rsadd.open sqladd,conn,1,3
  if  rsadd.eof then
  rsadd.addnew 
  rsadd("keywords")=addkey
  rsadd("gsid")=gsid
   rsadd("addtime")=now()
   
  if addp="1" then
  rsadd("ishigh")=0
  rsadd("price")=clng(toprice)
  else
  rsadd("ishigh")=1
  rsadd("price")=clng(addhigh)
  end if
  rsadd.update
  
  response.Write("<script>alert('温馨提示：出价成功！');location.href='addprice.asp?addkey="&addkey&"&goprice=zhu';</script>")
   response.End()
  else
  
  rsadd("addtime")=now()
  if addp="1" then
  rsadd("ishigh")=0
  rsadd("price")=(clng(toprice)+clng(oldp))
  else
  rsadd("ishigh")=1
  rsadd("price")=clng(addhigh)
  end if
  
  rsadd.update
  response.Write("<script>alert('温馨提示：出价成功！');location.href='addprice.asp?addkey="&addkey&"&goprice=zhu';</script>")
   response.End()
  end if
  rsadd.close
  end if
  
end if



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

goprice=Replace_Text(request("goprice"))
addkey=Replace_Text(request("addkey"))
if goprice<>"" then 
msg=""
set rsc=server.CreateObject("adodb.recordset")
sqlc="select  * from yixiang_keyhots where keywords='"&addkey&"'"
rsc.open sqlc,conn,1,3
if   rsc.eof then
rsc.addnew
rsc("keywords")=addkey
rsc("hits")=1
rsc("startdate")=now()
rsc("filekey")="searchall.asp"
rsc.update
vhit=1
else
if rsc("hits")<=0 then 
vhit=1
else
vhit=rsc("hits")
end if
  end if
 rsc.close	
 set rsk=server.CreateObject("adodb.recordset")
		 sqlk="select  * from yixiang_rate_price  where   minrates<="&vhit&"  and maxrates>"&vhit&"" 
  		 rsk.open sqlk,conn,1,1
		 if not rsk.eof then
		 addprice=rsk("addprice")
		 lowprice=rsk("lowprice")
		 highprice=rsk("highprice")
		msg="<font color=#666666>&nbsp;&nbsp;该关键字的起拍价:"& rsk("lowprice")&"元&nbsp;每次加价幅度:"&rsk("addprice")&"元&nbsp;一口价:"&rsk("highprice")&"元</font>" 
		rsk.close
		end if

end if

%><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
     <tr>
      <td align="center"  height="30"   bgcolor="#C6DFFF"  style="font-size:16px "> 参加关键字竞价 &nbsp;&nbsp;&nbsp;<font style="font-size:12px"><a  href="inprice.asp?action=des">关键字竞价服务说明</a></font></td>
  </tr> 
   </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  <%
	 set rsp1=server.CreateObject("adodb.recordset")
   sqlp1="select  * from yixiang_config_price "
   rsp1.open sqlp1,conn,1,1
   if not rsp1.eof then 
   if rsp1("isopen")=0 then 
 %> <tr>
      <td   height="25"   bgcolor="#95A3D2" style="color:#FFFFFF; font-weight:bold"> 
	  <%
     	  if month(rsp1("starttime"))=month(date()) and  rsp1("endtime")>now() then 
	  %>
	   &nbsp;关键字竞价信息：
 本月关键字竞价活动开始时间<font color=blue>&nbsp;<%=rsp1("starttime")%></font>&nbsp;至&nbsp;<font color="blue">&nbsp;<%=rsp1("endtime")%></font>&nbsp;结束
 
 <%
 end if
    else
	%>
	 <tr>
      <td   height="25"   bgcolor="#F5793D" style="color:#FFFFFF">  &nbsp;关键字竞价信息：
	<%
   response.Write("<font color=white>关键字竞价正在进行中........................请赶快参与，商机无限！谨请把握！</font>")   
   end if
   rsp1.close
   end if 
	  
	  %> </td>
  </tr>  
  </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<form name="refform" method="post" action="inprice.asp">
    <tr bgcolor="#EFF7FF">
      <td width="14%"  height="30" align="center"  >  参考关键字  </td>
 	<td width="86%">
	<input name="refkeyword" value=""  maxlength="16" >
	<input type="submit" name="refgo" value="查看">&nbsp;&nbsp;&nbsp;&nbsp; 
	</td>
 	</tr>
	<tr><td height="2" colspan="3"  bgcolor="#CAD8EA"></td></tr>	
	</form>
   </table>
   
   
   
   
   
   <%
   if msg<>"" then
   %>
   
   
     <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	 <tr><td height="30">&nbsp;您所选择的关键字是：<font color="red"><b><%=Replace_Text(request("addkey"))%></b></font></td></tr>
     <tr>
  	<td >
	<%=msg%>
     
	
 	</td>
 	</tr>
   <form name="mform" method="post" action="addprice.asp?goprice=<%=Replace_Text(request("goprice"))%>&addkey=<%=Replace_Text(request("addkey"))%>"  onSubmit="return checkform();">
	<tr><td> <input  type="radio" value="1" checked  onClick="showgrade(this)" name="addp" >逐步加价&nbsp;&nbsp;<input  type="radio" value="2" name="addp" onClick="showgrade(this)"> 一口价<br>
  
   <%
   set rsh=server.CreateObject("adodb.recordset")
   sqlh="select * from yixiang_temp_price where keywords='"&addkey&"' and gsid="&gsid
   rsh.open sqlh,conn,1,1
   if  rsh.eof then
   %>
   
  
   <div id="zhu"> &nbsp;请输入参加竞价的金额：
   <input  name="toprice" type="text" onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}" value="<%=lowprice%>" size="10" maxlength="6"> 
  ( 操作提示：请输入的金额不能小于该关键词的起拍价！)
  </div> <input type="hidden" name="txtv" maxlength="10" value="对不起！你输入的竞价金额不能低于该关键字的起拍价！">
    <input type="hidden" name="topricebak" maxlength="10" value="<%=lowprice%>">
	<input type="hidden" name="addtype" value="1">
	<input type="hidden" name="oldp" value="0">
    <%else%>
     <div id="zhu">
   &nbsp;请输入加价金额：<input name="toprice"  type="text" onBlur="if(/[^0-9]/g.test(this.value)){alert('请输入整型数字！');this.select()}" value="<%=addprice%>" size="10" maxlength="6">
  ( 操作提示：请输入的金额不能小于该关键词的每次加价幅度！)
  </div>  
  <input type="hidden" name="txtv" maxlength="10" value="对不起！你输入的加价金额不能低于该关键字的每次加价幅度！">

  	<input type="hidden" name="addtype" value="2">
<input type="hidden" name="oldp" value="<%=rsh("price")%>">

  <input type="hidden" name="topricebak" maxlength="10" value="<%=addprice%>">
   <%
   
   end if
   
   %>
   </td></tr><%
   if not rsh.eof then
   %><tr><td height="30" bgcolor="#8AA3D0">
   
   &nbsp;<font color="#FFFFFF">你已出价的总金额=</font><font color="red"><%=rsh("price")%></font><font color="#FFFFFF">元</font>
  </td></tr><%
   end if
   %> <tr><td align="center">
   <br><br>
      <input type="hidden" value="<%=highprice%>" name="addhigh">
    <input type="hidden" value="1" name="addtwo">
	<%
	sql1="SELECT  * FROM yixiang_config_price"
		Set rs1= Server.CreateObject("ADODB.Recordset") 
		rs1.Open sql1,conn
       if not  rs1.eof then 
	   if rs1("isopen")= 1 then
	%>
	<input type="submit" name="goadd" value="确定出价">
	<%
	else
	response.Write("尚未开通竞价服务！")
	end if
	rs1.close
	end if
	%>
	<br><br>
	</td></tr>
	</form>
	
	<tr><td height="2" colspan="3"  bgcolor="#CAD8EA"></td></tr>	
    </table>
   
   
   
   
   <%end if%>
   
   
   
   
   
   
   
   
   
   
   
   <%
   if   Replace_Text(request("addkey"))<>"" then 
    %>
 <table width="100%" border="1" bordercolor="#F5F5F5" cellspacing="0" cellpadding="0" align="center">
   <%
   set rsx=server.CreateObject("adodb.recordset")
   sqlx="select top 15  * from yixiang_temp_price where keywords='"&Replace_Text(request("addkey"))&"' order by price desc"
   rsx.open sqlx,conn,1,1
   if   rsx.eof then
   %>
   <tr><td  height="25">关键词：<font color="#FF0000"><%=Replace_Text(request("addkey"))%></font>&nbsp;当前暂无可用竞价情况</td></tr>
   <%
   else
   %>
   <tr bgcolor="#8AA3D0"  height="25" style="color:#FFFFFF" align="center"><td>关键词</td><td>竞价公司</td><td>竞价金额</td><td>竞价时间</td></tr>
   <%
   do while not rsx.eof 
   %>
   <TR><td align="center" height="25">
<font color="#0099CC"><%=Replace_Text(request("addkey"))%></font>
   </td>
   <td>
   <%
   set rsg=server.CreateObject("adodb.recordset")
   sqlg="select * from yixiang_corporation where id="&rsx("gsid")
   rsg.open sqlg,conn,1,1
   if not rsg.eof then
    '---------------------------------------------------
	   set rsmp1=server.CreateObject("adodb.recordset")
	   sqlmp1="select * from yixiang_vipgrade where roleid="&rsg("gradeid")
	   rsmp1.open sqlmp1,conn,1,1
	   if not rsmp1.eof  then 
	    if rsg("flag")=1 then
 	   if instr(rsmp1("rolelist"),"qw")>0 then					
 		 if is2weburl=1 then
   %>
       <a href="http://<%=rsg("user")%>.<%=weburl1%>/"   target="_blank"> <%=rsg("qymc")%></a>  
       <%else%>
        <a href="<%=HOPE_InstallDir%>vipcom/<%=rsg("user")%>/"  target="_blank"><%=rsg("qymc")%></a> 
  <%
	  end if 
	  else
  %>
	     <a href="<%=HOPE_InstallDir%>ptcom/<%=rsg("user")%>.html"  target="_blank"><%=rsg("qymc")%></a> 
  <%
	  end if
	  end if
	  rsmp1.close
	  end if  
	  '----------------------------------------------------------
	   
    rsg.close
   end if
   %>
   </td>
   <td align="center"><font color="red"><%=rsx("price")%></font>元<%if rsx("ishigh")=1 then response.Write("(<font color=red>一口价</font>)") end if%></td>
   <td align="center"><%=rsx("addtime")%></td>
   </TR>
    <%
    rsx.movenext
   loop
   rsx.close
   end if
   %>   
   
 </table>
   <%
   end if
   %>  
   
 <%
 conn.close
set conn=nothing
%>
