<!--#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")
 %>
 
<SCRIPT language=javascript> 
<!-- Hide 
function killErrors() { 
return true; 
} 
window.onerror = killErrors; 
//需要报JS错的请删除此JS
// --> 
</SCRIPT> 
<script >

function gog()
{
if(document.addform.addkey.value.replace(/^\s+|\s+$/g,'')=="")

{
alert("请输入关键字！");
return false;
}
}

</script>
  <style type="text/css">
<!--
.STYLE1 {
	color: #FF0000;
	font-weight: bold;
}
 -->
</style>
<%
refgo=Replace_Text(request("refgo"))
refkeyword=Replace_Text(request("refkeyword"))

%><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 Websen_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;<a href="inprice.asp?action=addprice">我要参加关键词竞价</a>
	</td>
 	</tr>
	<tr><td height="2" colspan="3"  bgcolor="#CAD8EA"></td></tr>	
	</form>
   </table>
   
   <%
   '竞价服务说明
      if Replace_Text(request("action"))="des" then
%>
    <table width="100%" border="0"  cellspacing="0" cellpadding="0" align="center">
     <tr><td align="center" height="30"> <b>关键词竞价服务说明</b></td></tr>
	 <tr   bgcolor="#F9F9F9">

  	<td  >	    <table width="98%" style="border-collapse:collapse" border="1" bgcolor="#FFFFFF"    bordercolor="#95A3D2" cellspacing="0" cellpadding="0" align="center">
     <tr    >

  	<td  style="word-break:break-all" > <%
	 set rss=server.CreateObject("adodb.recordset")
	 sqls="select * from Websen_config_price "
	 rss.open sqls,conn,1,1
	 if not rss.eof then
	 %>
	 <%=rss("description")%> 
	 <%
	 
	 rss.close
	 end if
	 
	 
	 %></td></tr></table>
 	</td>
 	</tr>	
    </table>
   
  <%
    end if
   %>
   
   
   <%
   '我要竞价
   if Replace_Text(request("action"))="addprice" then
    
   %>
   
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
     <tr >
  	<td  height="55" align="center">
	
	<%
	set rsp=server.CreateObject("adodb.recordset")
   sqlp="select  * from Websen_config_price "
   rsp.open sqlp,conn,1,1
   if not rsp.eof then 
   if rsp("isopen")=0 then 
   response.Write(" <font color=red>对不起！当前尚未开通关键词竞价功能！</font>")
   else
   '已开通竞价并时间未到
    if month(rsp("starttime"))=month(date()) and  rsp("endtime")>now() then 
    %>
   
      
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
    <form name="addform" method="post" action="addprice.asp"  onSubmit="return gog();"> <tr >
  	<td  >
	&nbsp;请输入你所要竞价的关键词：<input  name="addkey" type="text"  onblur="this.value=this.value.replace(/\s/g,'');" value="" size="20"  maxlength="16">
	&nbsp;
  &nbsp;<input  type="submit" value="我要竞价" name="goprice"  > 
	</td></tr>
	</form>
	</table>
   
   <%
   end if
    end if
   rsp.close
   end if
	%>
	
 	</td>
 	</tr>	
    </table>
   
   <%
   end if
   %>
   
   
   
   
   
   <%
   if   Replace_Text(request("keys"))<>"" 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 Websen_temp_price where keywords='"&Replace_Text(request("keys"))&"' order by price desc"
   rsx.open sqlx,conn,1,1
   if   rsx.eof then
   %>
   <tr><td  height="25">关键词：<font color="#FF0000"><%=Replace_Text(request("keys"))%></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("keys"))%></font>
   </td>
   <td>
   <%
   set rsg=server.CreateObject("adodb.recordset")
   sqlg="select * from Websen_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 Websen_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>元</td>
   <td align="center"><%=rsx("addtime")%></td>
   </TR>
    <%
    rsx.movenext
   loop
   rsx.close
   end if
   %>   
   
 </table>
   <%
   end if
   %>  <table width="100%" border="1" bordercolor="#F5F5F5" cellspacing="0" cellpadding="0" align="center">
    	<tr><td  colspan="3"></td></tr>
		<%
		if  refgo<>"" and  refkeyword<>"" then 
		 total=1
		 set rst=server.CreateObject("adodb.recordset")
		 sqlt="select  sum(hits) as totalnum from Websen_keyhots "
		 rst.open sqlt,conn,1,1
		 if not rst.eof then
		 total=rst("totalnum")
		 rst.close
		 end if
		 '
         set rsref=server.CreateObject("adodb.recordset")
		 sqlref="select  top 15 * from Websen_keyhots  where keywords like '%"&refkeyword&"%' order by hits  desc"
		 rsref.open sqlref,conn,1,1
		 if   rsref.eof then
		 %>
		 <tr><td width="9%" height="25"><%=refkeyword%></td><td width="40%" >
		 <table width="400" border="0" cellspacing="0" cellpadding="0" align="left">
	<tr><td height="5" width="1%" bgcolor="red"><td  bgcolor="#DFE3F0" width="99%"></td> </tr>	</table>
		  </td>
		  <td width="51%"><font  color="#999999">暂无竞价情况</font></td>
     </tr>
		 <%
		 
		 else 
		 %>
		 <tr bgcolor="#6583C7" height="30" style="color:#FFFFFF" align="center"><td>关键词</td>
		 <td>搜索量</td> 
		 <td>竞价情况</td><td>操作</td>
           <%
		 do while not rsref.eof 
		 %>
 		<tr>
	<td height="25"  >&nbsp;
	<%
		 Set re = New RegExp
        re.Pattern ="("&refkeyword&")"
         re.IgnoreCase = True
        re.Global=True
         result = re.Replace(rsref("keywords"), "<font color=red>$1</font>")
 		 %>
	<a href="inprice.asp?refgo=<%=refgo%>&refkeyword=<%=refkeyword%>&keys=<%=rsref("keywords")%>"   style="text-decoration:none"><%=result%></a></td><td>
	   <table width="340" border="0" cellspacing="0" cellpadding="0" align="left">
	<tr><td height="5" width="<%if (rsref("hits")/total)*100<1  then response.Write("1") else response.Write((rsref("hits")/total)*100)  end if%>%" bgcolor="red"><td  bgcolor="#DFE3F0" width="<%=100-(rsref("hits")/total)*100%>%"></td> </tr>	</table>
 	</td><td>
	<%
	set rsm=server.CreateObject("adodb.recordset")
	sqlm="select max(price) as maxprice from Websen_temp_price where keywords='"&rsref("keywords")&"'"
	rsm.open sqlm,conn,1,1
    if not rsm.eof then 
	if rsm("maxprice")<>"" then
	response.Write("<font color=#666666>当前最高出价</font>:<font color=red>"&rsm("maxprice")&"</font>元<br>")
	end if
	rsm.close
 	end if
	
	%>
	
	
	<%
		vhit=1
		set rsv=server.CreateObject("adodb.recordset")
		sqlv="select * from Websen_keyhots where  keywords ='"&rsref("keywords")&"'"
		rsv.open sqlv,conn,1,1
		if not rsv.eof then
		vhit=rsv("hits")
  		end if
		rsv.close
 		 set rsk=server.CreateObject("adodb.recordset")
		 sqlk="select  * from Websen_rate_price  where   minrates<="&vhit&"  and maxrates>"&vhit&"" 
  		 rsk.open sqlk,conn,1,1
		 if not rsk.eof then
		response.Write("<font color=#666666>起拍价:"& rsk("lowprice")&"元&nbsp;每次加价幅度:"&rsk("addprice")&"元&nbsp;一口价:"&rsk("highprice")&"元</font>")
		rsk.close
		 end if
		 %>
		  
	</td><td><a href='addprice.asp?goprice=gg&addkey=<%=rsref("keywords")%>'>我要竞价</a></td>
	
	</tr>
 <%
		 rsref.movenext
		 loop
		 rsref.close		
		 end if
 
	end if
	%> 

  </table>

<%
 conn.close
set conn=nothing
%>