<!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 name="robots" content="noindex,nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $cfg_soft_enname; ?> Home</title>
<script src="js/common.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>
<script src="js/drag.js" type="text/javascript"></script>
<link type="text/css" href="img/alerts.css" rel="stylesheet" media="screen">
<link  href="img/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.mtop{margin-top:10px; margin-bottom:10px;clear:both;}
.mtop li{width:80px; margin-right:5px;float:left;list-style-type:none;}
</style>
</head>
<body>
<?php
$t = time();
?>
<!--当前导航-->
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='后台首页&nbsp;&raquo;&nbsp;访客搜索关键词统计';</script>
<div class="r_main">
<div class="r_content">
<div class="S_info" >&nbsp;搜索关键词统计&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:if(confirm('确实要清空所有搜索记录吗?该操作不可恢复！'))location='?action=delall'">清空搜索记录</a></div>	

<?php
	$whereStr=" ";
    if ($tid !="" or !empty($tid)) {$whereStr=" where tid=$tid";}
	$csqlStr="select count(*) as dd from sea_search_keywords " .$whereStr;
    $row = $dsql->GetOne($csqlStr);
    if(is_array($row)){
        $TotalResult = $row['dd'];
    }else{
        $TotalResult = 0;
    }
	if($TotalResult == 0){echo '<br><br>&nbsp;&nbsp;<font style="color:red">没有搜索记录，请检查该功能是否开启 (系统 - 网站设置 - 性能效率设置 - 搜索关键词记录)</font><br><br>';}
?>


<table width="100%" border="0" cellpadding="0" cellspacing="0"  class="tb_style" bgcolor="#f5fafe">
<tr height="30" >
<td class="td_border">ID</td>
<td class="td_border">关键词</td>
<td class="td_border">搜索次数</td>
<td class="td_border">末次搜索结果数</td>
<td class="td_border">末次搜索类型</td>
<td class="td_border">末次搜索时间</td>
</tr>

<?php

$numPerPage=20;
$page = isset($page) ? intval($page) : 1;
$order = isset($order) ? intval($order) : 1;

switch ($order)
{
case 1:
    $orderstr=" aid DESC ";  
    break;
case 2:
    $orderstr=" aid ASC ";
    break;
case 3:
    $orderstr=" lasttime DESC ";
    break;
case 4:
    $orderstr=" lasttime ASC ";
    break;
case 5:
    $orderstr=" count DESC ";
    break;
case 6:
    $orderstr=" count ASC ";
    break;
case 7:
    $orderstr=" result DESC ";
    break;
case 8:
    $orderstr=" result ASC ";
    break;	
default:
    $orderstr=" aid DESC ";
}

if($page==0) $page=1;
?>
<div style="margin:5px 5px 5px 5px;">
类型：
<input type="button" value="全部关键词" class="btn" onclick="location.href='?page=1';"/>&nbsp;&nbsp;
<input type="button" value="视频关键词" class="btn" onclick="location.href='?page=1&tid=0&order=1';"/>&nbsp;&nbsp;
<input type="button" value="新闻关键词" class="btn" onclick="location.href='?page=1&tid=1&order=1';"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
排序：
<input type="button" value="搜索次数 ∧" class="btn" onclick="location.href='?page=1&tid=<?php echo $tid; ?>&order=5';"/>&nbsp;&nbsp;
<input type="button" value="搜索次数 ∨" class="btn" onclick="location.href='?page=1&tid=<?php echo $tid; ?>&order=6';"/>&nbsp;&nbsp;
<input type="button" value="结果数 ∧" class="btn" onclick="location.href='?page=1&tid=<?php echo $tid; ?>&order=7';"/>&nbsp;&nbsp;
<input type="button" value="结果数 ∨" class="btn" onclick="location.href='?page=1&tid=<?php echo $tid; ?>&order=8';"/>&nbsp;&nbsp;
<input type="button" value="时间 ∧" class="btn" onclick="location.href='?page=1&tid=<?php echo $tid; ?>&order=3';"/>&nbsp;&nbsp;
<input type="button" value="时间 ∨" class="btn" onclick="location.href='?page=1&tid=<?php echo $tid; ?>&order=4';"/>&nbsp;&nbsp;
<input type="button" value="ID ∧" class="btn" onclick="location.href='?page=1&tid=<?php echo $tid; ?>&order=1';"/>&nbsp;&nbsp;
<input type="button" value="ID ∨" class="btn" onclick="location.href='?page=1&tid=<?php echo $tid; ?>&order=2';"/>&nbsp;&nbsp;
</div>

<?php
    $TotalPage = ceil($TotalResult/$numPerPage);
    if ($page>$TotalPage) $page=$TotalPage;
    $limitstart = ($page-1) * $numPerPage;
    if($limitstart<0) $limitstart=0;
	
    $sql="select * from sea_search_keywords $whereStr ORDER BY  $orderstr limit $limitstart,$numPerPage";

	$dsql->SetQuery($sql);
	$dsql->Execute('al');
	while($row=$dsql->GetObject('al'))
	{

?>  
     <TR  bgcolor="#FFF" style="background-color:#FFF;" onmouseover="style.backgroundColor='#E6F2FB'" onmouseout="style.backgroundColor='#FFF'" >
            <td class="td_border" height="30" ><?php echo $row->aid;?></td>
            <td class="td_border" height="30" ><?php echo $row->keyword;?></td>                     
            <td class="td_border" height="30" ><?php echo $row->count;?></td>
			<td class="td_border" height="30" ><?php echo $row->result;?></td>
            <td class="td_border" height="30" ><?php if($row->tid=="0"){echo '视频';}elseif($row->tid =="1"){echo '新闻';}else{echo '';}?></td>
			<td class="td_border" height="30" ><?php echo date('Y-m-d H:i:s',$row->lasttime);?></td>
            
	  
	  
    </TR>
<?php }?>
							

<tr bgcolor="#FFF" style="background-color:#FFF;">
          <td height="30" colspan="11" class="td_border" >
            <div class="cuspages">
			<?php $jumpurl='&tid='.$tid.'&order='.$order ;?>
              <div class="pages"> &nbsp;页次：<?php echo $page;?>/<?php echo $TotalPage;?> 每页<?php echo $numPerPage;?> 总收录数据<?php echo $TotalResult;?>条 <a href="?page=1<?php echo $jumpurl ?>">首页</a> <a href="?page=<?php echo ($page-1);?><?php echo $jumpurl ?>">上一页</a> <?php echo makePageNumber($page, 10, $TotalPage, "videolist");?> <a href="?page=<?php echo ($page+1);?><?php echo $jumpurl ?>">下一页</a> <a href="?page=<?php echo $TotalPage;?><?php echo $jumpurl ?>">尾页</a>&nbsp;&nbsp;跳转
                <input type="text" id="skip" value="" onkeyup="this.value=this.value.replace(/[^\d]+/,'')" style="width:40px"/>
                &nbsp;&nbsp;
                <input type="button" value="确 定" class="btn" onclick="location.href='?page='+ document.getElementById('skip').value +'&tid=<?php echo $tid;?>'+'&order=<?php echo $order;?>';"/>
              </div>
            </div>
 </td>
        </tr>	 
</table>








</div>
</div>


<?php
viewFoot();
?>
</body>

</html>