<?php
include ("inc/function.php");
$this_title="搜索"." ".$_GET[tag]." ";
include ("top.php");
?>
<DIV id="no_index_container">
<div class="index_top">
<div>最新标签</div>
<?php
//程序开发，Axingweb | 阿星 www.axingweb.cn
$sessin_tag=$_GET[tag];
if (!$_SESSION[$sessin_tag])
{
axing_connect();
$sql="update tag set count=count+1 where tag='$_GET[tag]'";
$result=mysql_query($sql);
mysql_close();
$_SESSION[$sessin_tag]=$sessin_tag; 
}


axing_connect();
$sql="select * from tag where able='yes' order by id desc limit 100";
$result=mysql_query($sql);
while ($myrow=mysql_fetch_assoc($result))
{
?>
<a href="search.php?tag=<?echo(urlencode($myrow[tag]));?>"><?echo($myrow[tag]);?></a>
<?PHP
}
mysql_free_result($result);
mysql_close();
?>
</div>


<DIV id="no_index_content">
<div class="left_top" id="no_index_content_z_s_l_t"></div>
<div class="right_top" id="no_index_content_z_s_r_t"></div>
<?php
axing_connect();
//分页代码
$pagesize=$page_num;
$result=mysql_query("select count(*) from base where able='yes' and (title like '%$_GET[tag]%' or content like '%$_GET[tag]%')");
$myrow = mysql_fetch_array($result);
$numrows=$myrow[0];
$pages=intval($numrows/$pagesize);

if ($numrows%$pagesize)
{
$pages++;
}
if (isset($_GET['page']))
{
$page=intval($_GET['page']);
}
else{
$page=1;
}
$offset=$pagesize*($page - 1);
//分页代码
?>
<div id="no_index_content_top">搜索“<?echo($_GET[tag])?>”，共计 <?echo($numrows)?> 条记录</div>
<div id="no_index_content_content">
<div>广告位E</div>

<?php
$sql="select * from base  where able='yes' and (title like '%$_GET[tag]%' or content like '%$_GET[tag]%')  order by cometime desc limit $offset,$pagesize";
$result=mysql_query($sql);
$i=0;
while ($myrow=mysql_fetch_assoc($result))
{
$i=$i+1;
?>
<?php if ($i%2)
{
?>
<div style="height:30px;padding:4px;background-color:F7F7F7;">
            <img src="skin/dis/images/50.jpg">
            &nbsp;&nbsp; <a href="<?echo($myrow[url]);?>" title="标题：<?echo($myrow[title]);?>" target="_blank" style="color:#0000FF;text-decoration:underline;font-size:14px"><?php if ($myrow[title]==''){?><?echo(FSubstr($myrow[url],0,100));?><?php } else {?><?echo(FSubstr($myrow[title],0,80));?><?php }?>...</a>
  <?php if ($myrow[type]=="index")
			 {
			 echo "<a style='color:red'>[首页]</a>";
			 }
			 else
			 {
             echo "<a style='color:green'>[内页]</a>";
			 }
           ?>
  </div>
<div style="font-size:12px;color:#666666;padding-left:30px;padding-right:30px;background-color:F7F7F7">内容预览：
<?echo(str_replace("$_GET[tag]","<a style='color:red;font-size:14px'>".$_GET[tag]."</a>","$myrow[content]"))?></div>
<div style="font-size:12px;color:#666666;padding-left:30px;padding-right:30px;background-color:F7F7F7">
<a style='color:green;font-size:14px' href="<?echo($myrow[url]);?>" target="_blank"><?echo($myrow[url]);?></a></div>
<?php 
}
else
{
?>
<div style="height:30px;padding:4px;background-color:#FFFFFF;">
            <img src="skin/dis/images/50.jpg">
            &nbsp;&nbsp; <a href="<?echo($myrow[url]);?>" title="标题：<?echo($myrow[title]);?>" target="_blank" style="color:#0000FF;text-decoration:underline;font-size:14px"><?php if ($myrow[title]==''){?><?echo(FSubstr($myrow[url],0,100));?><?php } else {?><?echo(FSubstr($myrow[title],0,80));?><?php }?>...</a>
  <?php if ($myrow[type]=="index")
			 {
			 echo "<a style='color:red'>[首页]</a>";
			 }
			 else
			 {
             echo "<a style='color:green'>[内页]</a>";
			 }
           ?>
</div>
<div style="font-size:12px;color:#666666;padding-left:30px;padding-right:30px">内容预览：
<?echo(str_replace("$_GET[tag]","<a style='color:red;font-size:14px'>".$_GET[tag]."</a>","$myrow[content]"))?></div>
<div style="font-size:12px;color:#666666;padding-left:30px;padding-right:30px">
<a style='color:green;font-size:14px' href="<?echo($myrow[url]);?>" target="_blank"><?echo($myrow[url]);?></a></div>
<?PHP
}
}
if ($numrows==0)
{
echo "对不起，没有搜索到相关信息！";
}
//分页代码
$first=1;
$prev=$page-1;
$next=$page+1;
$last=$pages;
echo "<div align='left' style='padding:5px'>共有".$pages."页(".$page."/".$pages.")";
if ($page > 1)
{
echo " <a href='?page=".$first."'>首页</a> ";
echo " <a href='?page=".$prev."'>上一页</a> ";
}

if ($page < $pages)
{
echo " <a href='?page=".$next."'>下一页</a> "; 
echo " <a href='?page=".$last."'>尾页</a> ";
echo "</div>";
}
//分页代码
mysql_free_result($result);
mysql_close();
?>

  </div>
  </DIV>
  </div>
<?php include ("bottom.php");?>

