<?php
/**
 * @version        Somao_Search X1.0 9:23 2012-1-1 Somao $
 * @package        Somao_Search.Site
 * @copyright      Copyright (c) 2009 - 2012, Somao, Inc.
 * @license        http://www.somao123.com/
 * @link           http://www.somao.cc/
 */
require "../global.php";
require_once(PATH."/include/inc_page.php");
//运行时间开始
$runtime= new runtime;
$runtime->start();
$wd=HtmlReplace($_GET["wd"]);
$stime=intval($_GET["stime"]);
$urlid=intval($_GET["urlid"]);
if($urlid>0) Ucontribution($urlid);//贡献
$log=intval($_GET["log"]);
if($log>0) { //记录
    key_log();
	header("location:/s/?wd=".$wd);
}
$from_host=str_replace("http://","",GetSiteUrl($_SERVER['HTTP_REFERER']));
if($from_host!=$_SERVER['HTTP_HOST']){$wd=get_encoding($wd,"GB2312");}
$old_wd=$wd;
$wd=FilterSearch($wd);
if(strlen($wd)<=0){header("location:".$config["url"]);}
$wd_en=urlencode($wd);		
$is_site=false;	
update_hits($wd);//点击
$time=time();
$pos = strstr(strtolower($wd),"site:");//echo $pos;
if (strlen($pos) > 5)
{ 
    $is_site=true;
	$domain=GetSiteUrl($wd);
	$domain=str_replace("site:","",$domain);
    $sql="select * from ve123_links where title<>'' and url like '%".str_replace("site:","",$domain)."%'"; 
	$sql_count="select link_id from ve123_links where title<>'' and url like '%".str_replace("site:","",$domain)."%'"; 
}
else
{
    $domain="";	   
}
    $search=new search();
	$data=$search->q($wd,$domain,$stime);
	$total=$search->total;
	$wd_split=$search->wd_split;
	$wd_array=$search->wd_array;
	$wd_count=$search->wd_count;
	$totalpage=$search->totalpage;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=7">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><?php echo $config["adtitle"];?>_<?php echo $wd;?></title>
<link rel="stylesheet" href="css/css.css" type="text/css">
<script>
var $s=(function(){var a="0.1.0",f={},b={};f.ext_js="/js/sext.js";var c=f.$d=document,e={};function d(k,i,l){var h=this;var g=Array.prototype.slice.call(arguments,3);if(typeof window[k]=="function"){if(e[i]=="1"){e[i]="2";if(typeof l=="function"){l.apply(h,g)}}window[k].apply(h,g)}else{if(!e[i]){var j=c.createElement("script");e[i]="1";j.type="text/javascript";j.src=i;if($s.ua&&$s.ua.ie6){setTimeout(function(){$s.$h().appendChild(j)},50)}else{$s.$h().appendChild(j)}}g=Array.prototype.slice.call(arguments,0);setTimeout(function(){d.apply(h,g)},50)}}f.cjs=d;f.$=function(g){return c.getElementById(g)};f.$$=function(g,h){if(g){return g.getElementsByTagName(h)}return[]};f.$b=function(k,g,h){if(k){for(var j in g){if(window.attachEvent){k.attachEvent("on"+g[j],h[j])}else{k.addEventListener(g[j],h[j],false)}}}};f.$c=function(j,i,g){var h=document.createElement(j);if(i){i.appendChild(h)}if(g){h.className=g}return h};f.$h=function(){return f.$$(c,"head")[0]};f.t=function(){return(new Date()).getTime()};f.ua=(function(){var g=window.navigator.userAgent.toLowerCase();var i={};if(window.opera){i.opera=true}else{if(g.indexOf("msie")!=-1){i.ie=true;var h=/msie\s+(.)/.exec(g);if(h){i["ie"+h[1]]=true}}else{if(g.indexOf("webkit")!=-1){i.webkit=true;if(g.indexOf("chrome")!=-1){i.chrome=true}else{if(g.indexOf("ipad")!=-1){i.ipad=true;i.ios=true}else{if(g.indexOf("safari")!=-1){i.safari=true}}}}else{if(g.indexOf("gecko")!=-1){i.gecko=true;if(g.indexOf("firefox")!=-1){i.firefox=true}}}}}if(g.indexOf("android")!=-1){i.and=true}if(g.indexOf("iphone")!=-1){i.ios=true}return i})();f.wait=function(g,h){var i=$s.$(g);if(i){return h(i)}setTimeout(function(){f.wait(g,h)},100)};f.preload=function(i){if($s.ua.ie||$s.ua.opera){var g=new Image();g.src=i}else{if("undefined"===typeof(c.body)||!c.body){setTimeout("$s.preload('"+i+"')",50);return}var h=c.createElement("object");h.data=i;h.width=0;h.height=0;c.body.appendChild(h)}};f.extend=function(g){d("$s_ext",$s.ext_js,g)};return f})();var sogou_preview=function(d,c){$s.cjs("sogou_preview_swap","/js/preview.v.2.js?osjd=<?php echo(rand(1000,2000));?> ",null,d,c)};(function(){window.scol=function(){var e=$s.$("switchcolimg");var d=$s.$("leftcolumn");var f="leftColumn_";var c=false;if(d.className.indexOf("col2")<0){d.className=d.className+" col2";c=true}else{d.className=d.className.replace(" col2","")}a(c?"2":"1");uigsPB(f+(c?"close":"open"))};if(screen.width<=800){if(document.cookie.indexOf("columnnum")<0){b()}}})();
</script>
<script type="text/javascript" src="/js/jike-autoComplete.js"></script>
<script type="text/javascript" src="/js/jike-log.js"></script>
<script language="javascript" src="/js/mug.php"></script>
<script type="text/javascript">
 var makeSearchUrl = function(){
	var keys = document.getElementById("keyword").value;
	if(keys == "" || keys == "请输入关键字"){
		alert("请输入关键字");
		document.getElementById("keyword").focus();
		return false;
	}
}
</script>
<script language="JavaScript">
function killErrors() {
return true;
}
window.onerror = killErrors;
</script>
<style type="text/css">
<!--
body {
	margin-right: 0px;
}
.STYLE2 {color: #666}
-->
</style></head>
<body onLoad="onLoadHandler()|init()" >
<DIV class="top">
      <span class="l"><a href="javascript:void(0)" data-evt="sosoyi_search('w', this)" class="search_a curr_a">网页</a>
<a href="http://v.zxyt.cn">视频</a>
<a href="javascript:void(0)" data-evt="sosoyi_search('d', this)" class="search_a">下载</a>
<a href="http://baike.zxyt.cn" class="search_a" target="_blank">百科</a>
<a href="http://music.baidu.com" class="search_a" target="_blank">音乐</a>
<a href="http://image.baidu.com" class="search_a" target="_blank">图片</a>
<a href="http://map.baidu.com" class="search_a" target="_blank">地图</a></span> 
	 <span class="r"><script language="javascript" src="/user/login_ajax.php"></script></span> 
 </DIV>
 
<div class="wrapper">
 <div id="header">
  <div class="logo"><a title="回到泽许首页" href="/"><img src="css/logo.png" alt="<?php echo $config["name"];?>" width="135" height="55"></a></div>
     <div class="searchHome">
      <form method="get" name=f id="frm" onsubmit="return makeSearchUrl();">
        <input type="text" name="wd" class="searchInputBot" id="keyword" autocomplete="off" disableautocomplete maxlength="25" onkeydown="if(event.keyCode==32) return false" value="<?php echo $wd;?>"/>
        <input type="hidden" name=s value="0">
        <input type="submit" value="搜 索" class="searchBUtton"/>
      </form>
      <div class="resultstats">找到约 <span id="scd_num"><?php echo $total;?></span>条结果（用时 <?php $runtime->stop(); echo $runtime->spent(); ?>秒）</div>
    </div>
  </div>
<!--主体 -->
<div class="outer" id="leftcolumn">
  <div class="outerwrap">
    <!--左侧-->
    <div class="left">
      <span id="switchcolimg" class="switchcol" onclick="scol()"></span>
       <ul class="snav1">
         <li><strong>网页结果</strong></li>
         <li><a href="http://baike.zxyt.cn" class="search_a" target="_blank">百科</a></li>
         <li><a href="http://music.baidu.com" class="search_a" target="_blank">音乐</a></li>
         <li><a href="http://map.baidu.com" class="search_a" target="_blank">地图</a></li>
         <li><a href="http://image.baidu.com" class="search_a" target="_blank">图片</a></li>
         <li><a href="http://v.zxyt.cn">视频</a></li>
       </ul>
       <ul class="snav2" id="snav2">
         <li><strong>全部时间</strong></li>
         <li><a href="?stime=1&wd=<?php echo $wd;?>">一天内</a></li>
         <li><a href="?stime=7&wd=<?php echo $wd;?>">一周内</a></li>
         <li><a href="?stime=30&wd=<?php echo $wd;?>">一月内</a></li>
         <li><a href="?stime=365&wd=<?php echo $wd;?>">一年内</a></li>
       </ul>
       <ul class="snav2" id="snav2">
         <li><strong>历史搜索</strong></li>
<?php
$IP_address = $_SERVER["REMOTE_ADDR"];
$sql="select * from ve123_keywords where ip like '%".$IP_address."%' ";
$query=$db->query($sql." order by lasttime desc limit 10");
while($row_kw=$db->fetch_array($query)) {
?>
 <li><a href="?wd=<?php echo urlencode($row_kw["keyword"]);?>"><?php echo str_cut($row_kw["keyword"],20,"");?></a></li>
<?php
  }
?>       <li style="margin-left:8px;"><a href="?log=1&wd=<?php echo $wd;?>"><font color="#666666">清除历史</font></a></li>
       </ul>
       
     </div>
    <!--左侧 -->
    <!--中侧 -->
	<div class="In the side of">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="721" valign="top">
</div>
<div align="left" style="padding-left:1px; padding-right:50px;">
<?php echo file_get_contents("../open/html/$wd.html");?>
</div>
<!--中侧 -->
    <div class="centrecontent">   
      <div class="results" >    
<?php
 $filter_word=$config['filter_word'];
 if(preg_match("/$filter_word/i",$wd)){
?>
<div style="margin:0 0 0 15px;font-size:14px;line-height:20px;">
对不起，输入的关键字不符合国家互联网言论法规。
<br><br>
<font class="fB"><?php echo $config["name"];?>建议您：</font>
  <div style="margin-top:0px;margin-left:15px;">
   <li>看看输入的文字是否有误</li>
   <li>去掉可能不必要的字词，如"的"、"什么"等</li>
   <li>直接在线申请收录<a target="_blank" href="http://sighttp.qq.com/authd?IDKEY=a4cd97ebd86d03be8726d40d21cf92fd9709df1e9b237b75"><img border="0"  src="http://wpa.qq.com/imgd?IDKEY=a4cd97ebd86d03be8726d40d21cf92fd9709df1e9b237b75&pic=50" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>有事Q我</a></li>
   <li><a href="../search/url_submit.php" target="_blank"><font color=\"#3366CC\">网站登录入口</font></a></li>
   </li>在线申请收录<a target="_blank" href="http://sighttp.qq.com/authd?IDKEY=a4cd97ebd86d03be8726d40d21cf92fd9709df1e9b237b75"><img border="0"  src="http://wpa.qq.com/imgd?IDKEY=a4cd97ebd86d03be8726d40d21cf92fd9709df1e9b237b75&pic=50" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>有事Q我</a></li>
  </div>
</div>
<?php
 }else{
 $pt=$_GET['p'];
 if($pt==0 or $pt==1 or $pt==""){ 
  $openshow=$db->get_one("select * from ve123_open where is_show>0 and keywords='$wd' and enddatetime>'$time';");
  echo $openshow['content']; 
 ?>
<!--贡献排序-->
<?php
  $rowlink=$db->get_one("select * from ve123_member m left join ve123_webunion web on m.user_id=web.mid  where m.scores>0 and web.arcrank>0 ORDER BY RAND() LIMIT 1 ");
  if(!empty($rowlink)){
	$weburls=$rowlink['weburl'];
    $query=$db->query("SELECT t1.* FROM `ve123_links` AS t1 
                  JOIN (SELECT ROUND(RAND() *((SELECT MAX(link_id) FROM `ve123_links`)-(SELECT MIN(link_id) FROM `ve123_links`))+(SELECT MIN(link_id) FROM `ve123_links`)) AS link_id) AS t2 WHERE t1.link_id >=t2.link_id and t1.title<>'' and  t1.url like '%$weburls%'  ORDER BY t1.link_id LIMIT 2;");
  while($links=$db->fetch_array($query)){
  ?>
<div class="rb"  style="background:#f1f1f1">
  <div align="right"><span class="STYLE2">- - <A class="STYLE2" href="/user/">网站联盟</A></span>  </div>
  <h3 class="pt"><a href="<?php echo "/s/go.php?".base64_encode("link_id=".$links["link_id"]."&t=".$wd_en."&urlid=".$rowlink['id']);?>" target="_blank" style="color:#0D00D3"><?php echo $links["title"];?></a></h3>
    <div class="ft"><?php echo $links["description"];?></div>
    <div class="fb">
      <cite><?php echo str_cut(str_replace("http://","",$links["url"]),40);?> - <?php echo date("Y-m-d",$links["updatetime"]);?></cite>
     </div>
</div>
<?php
	 }
  }
}?>
<!--贡献排序end-->
<?php
if($total>0){
	
  foreach($data as $link)
  { 
   if($link["is_tg"]>0){
?>
<div class="rb" style="background:#e1e1e1">
    <h3 class="pt"><a href="<?php echo "click.php?".base64_encode("url=".$link["url"]."&link_id=".$link["link_id"]);?>" target="_blank"><?php echo $link["title"];?></a></h3>
    <div class="ft"><?php if(empty($link["txt"])) { echo $link["description"];}else{  echo $link["txt"];} ?></div>
    <div class="fb">
      <cite><?php echo str_cut(str_replace("http://","",$link["url"]),40);?> - <?php echo $link["updatetime"];?></cite> - <a href="../zhandian.php?<?php echo $link["link_id"];?>.html" target=\"_blank\" class=view STYLE14>信息</a>-<?php echo file_get_contents("../open/html/$wd.html");?></a></div>
     </div>
</div>
<?php }else{  ?>
<div class="rb">
    <h3 class="pt"><IMG border=0 
            onerror="javascript:this.style.display='none'" 
            <IMG src="/favicon.ico" width=18 height=18><a href="<?php echo $link["url"]?>" target="_blank"style="color:#0D00D3"><?php echo $link["title"];?></a></h3>
    <div class="ft"><?php if(empty($link["txt"])) { echo $link["description"];}else{  echo $link["txt"];} ?></div>
    <div class="fb">
      <cite><?php echo str_cut(str_replace("http://","",$link["url"]),40);?> - <?php echo $link["updatetime"];?></cite> - <a href="../zhandian.php?<?php echo $link["link_id"];?>.html" target=\"_blank\" class=view STYLE14>信息</a> - <a name="sogou_preview_links" href="javascript:void(null);" id="sogou_preview_<?php echo $link["link_id"];?>" onMouseOver="sogou_preview('sogou_preview_<?php echo $link["link_id"];?>', 'link_<?php echo $link["link_id"];?>');return false;" onclick="sogou_preview('sogou_preview_<?php echo $link["link_id"];?>', 'link_<?php echo $link["link_id"];?>');return false;" sogou_preview_title="<?php echo $link["title"];?>" sogou_preview_link="<?php echo $link["url"];?>" url="<?php echo $link["url"];?>" class="yld">预览</a>
     </div>
</div>
<?php
      }
   }  
?>	
<div class="page">
<?php
   $page = new Page($totalpage,"?wd=".$wd_en."&stime=".$stime."&p=");
   echo $page->show();
?>
</div>
<br>
<?php
}
else
{
?>

<div style="margin:0 0 0 15px;font-size:14px;line-height:20px;">
<?php
if(substr($wd,0,7)=="http://")
{
?>
您可以直接访问：<?php echo "<a target=\"_blank\" href=\"".$wd."\">".$wd."</a>";?><br>
<?php
}
else
{
?>
抱歉，没有找到与"<font color="#C60A00"><?php echo $wd;?></font>" 相关的网页。
<?php 
}
?>
<br><br>
<font class="fB"><?php echo $config["name"];?>建议您：</font>
  <div style="margin-top:0px;margin-left:15px;">
   <li>看看输入的文字是否有误</li>
   <li>去掉可能不必要的字词，如"的"、"什么"等</li>
   <li>阅读<a href="../search/noresult.php" target="_blank"><font color=\"#3366CC\">帮助</font></a></li>
   <li><a href="../search/tijiao.html" target="_blank"><font color=\"#3366CC\">网站登录入口</font></a></li>
  </div>
</div>
<div style="margin-top:0px;margin-left:15px;" id="DivPost"></div>
<?php
 }
}
?>	
</div>


   
   </div>
  <!--中侧 -->
 </div>
 <!--右侧 -->
 <div class="right">
 <div class="ad">
     <span><script src="http://js.centenr.net/page/s.php?s=409628&w=468&h=60"></script></span><br>
     <span>推广电话:15884574797</div>收录网站请发送邮箱zxyt@foxmail.com</span>
   <?php
   $openshow_r=$db->get_one("select * from ve123_open_rightad where is_show>0 and keywords='$wd' and enddatetime>'$time';");
    echo $openshow_r['content'];
	
    $query_ad=$db->query("select * from ve123_ad where title like '%".$wd."%' and type='2' and is_show limit 5");
    $num=$db->num_rows($query_ad);
    if($num<1)
    {
     $query_ad=$db->query("select * from ve123_ad where type='2' and is_show limit 5");
    }
    while($row_ad=$db->fetch_array($query_ad))
    {
  ?>
   </div>
  <?php } ?>
 </div>
  <!--右侧 -->
</div>

<div class="xg">
  <div class="biaot"><strong>相关搜索：</strong></div>
  <div class="neirong">
<table border="0" cellpadding="0" cellspacing="0"><tr>
<?php
	    $sql="select * from ve123_keywords where";
	    for($i=0;$i<$wd_count;$i++)
		{
		      if($i==($wd_count-1))
			  {
			       $sql=$sql." keyword like '%".$wd_array[$i]."%'";
			  }
			  else
			  {
			       $sql=$sql." keyword like '%".$wd_array[$i]."%' or ";
			  }
		        
		}

$query=$db->query($sql." order by hits desc limit 10");
$j=0;
while($row_kw=$db->fetch_array($query))
{$j++;
?>
<td nowrap class="f14"><a href="?wd=<?php echo urlencode($row_kw["keyword"]);?>"><font color=\"#3366CC\"><?php echo str_cut($row_kw["keyword"],20,"");?></font></a></td>
<?php
    if($j%5==0)
	{
	   echo "</tr>";
	}
}
?>
</tr></table>
   </div>
 </div>
<!--尾部 -->
<div class="foot">
  <div class="searchHome" style="margin:0px;">
      <form method="get" name=f id="frm" onsubmit="return makeSearchUrl();">
        <input type="text" name="wd" class="searchInputBot" id="keyword" autocomplete="off" disableautocomplete maxlength="25" onkeydown="if(event.keyCode==32) return false" value="<?php echo $wd;?>"/>
        <input type="hidden" name=s value="0">
        <input type="submit" value="搜 索" class="searchBUtton"/>
      </form>
  </div>
</div> 
</div>
 <div class="cr" id="s_footer">
   <?php echo $config["copyright"];?> <span>此内容系<?php echo $config["name"];?>根据您的指令自动搜索的结果，不代表<?php echo $config["name"];?>赞成被搜索网站的内容或立场</span> <?php echo $config["statcode"];?>
 </div> 
 在线申请收录<a target="_blank" href="http://sighttp.qq.com/authd?IDKEY=a4cd97ebd86d03be8726d40d21cf92fd9709df1e9b237b75"><img border="0"  src="http://wpa.qq.com/imgd?IDKEY=a4cd97ebd86d03be8726d40d21cf92fd9709df1e9b237b75&pic=50" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>有事Q我</a>
</div>
 <?php
require PATH."user/login_ajaxcss.php";
 ?>
</body>
</html>
