发款php蜘蛛统计插件只要有mysql就可用(2)


<?php
session_start();
require("spilder_config.php");
if($_GET['act']=='logout')
{
$_SESSION['ss_sp_admin']='';//清空
}
if($_GET['sp_admin_login'])
{
if($_GET['sp_admin_login']==$sp_admin)
{
$_SESSION['ss_sp_admin']=$sp_admin;
}
}
date_default_timezone_set('PRC'); //设置默认时区
$day_start=strtotime(date("Ymd")."000001");//一天的开始时间
$day_out=strtotime(date("Ymd")."235959");//一天的结束时间
$day=3600*24;//一天的时间
$link=mysql_connect($mysql_host,$mysql_user,$mysql_pwd) or die("服务器连接出错");
mysql_select_db($mysql_db,$link) or die('链接数据库出错');//连接数据库
if($_GET['act']=='del')
{
if($_SESSION['ss_sp_admin']<>'')
{
if($_GET['dt']==0)//清空
{
mysql_query("delete from {$table_prefix}sp_count ");
}
$d_time=0;
if($_GET['dt']==1)//删除30天前
{
$d_time=$day_out-$day*30;
}elseif($_GET['dt']==2)//删除60天前
{
$d_time=$day_out-$day*60;
}elseif($_GET['dt']==3)//删除90天前
{
$d_time=$day_out-$day*90;
}elseif($_GET['dt']==4)//删除180天前
{
$d_time=$day_out-$day*180;
}elseif($_GET['dt']==5)//删除360天前
{
$d_time=$day_out-$day*360;
}
if($d_time>0)
{
mysql_query("delete from {$table_prefix}sp_count where r_time<'$d_time'");//删除数据
}
}
}
$ss=intval($_GET['ss']);
if($ss>0)//查看分类统计
{
if($ss==999)//清空分类
{
$_SESSION['ss_ss']='';
}else
{
$_SESSION['ss_ss']=$ss;
}
}
$ss=$_SESSION['ss_ss'];
if($ss==1)
{
$ss='Baiduspider';
}elseif($ss==2)
{
$ss='Googlebot';
}elseif($ss==3)
{
$ss="MSNbot";
}elseif($ss==4)
{
$ss="Yahoobot";
}elseif($ss==5)
{
$ss="Sogoubot";
}elseif($ss==6)
{
$ss="Sosobot";
}elseif($ss==7)
{
$ss=7;
}
$t=intval($_GET['t']);//查看时间分类统计
if($t==0)//时时情况
{
if(empty($_SESSION['ss_ss']))
{
$sql =" select * from {$table_prefix}sp_count order by id desc ";//最新情况
$sql2="select count(*) from {$table_prefix}sp_count ";
}else
{
$sql="select * from {$table_prefix}sp_count where r_name='$ss' order by id desc ";
$sql2="select count(*) from {$table_prefix}sp_count where r_name='$ss' ";
}
$rscount=mysql_query($sql2);
$rscount=@mysql_fetch_array($rscount);
$rscount=$rscount[0];//获取总记录数
$page=intval(trim($_GET['page']));//当前页数
$pagesize=30;//每页记录数
$pagecount=ceil($rscount/$pagesize);//获取总页数
$pageurl="";
if($page<=1)
{
$page=1;
$pageurl.=" 首页 上一页";
}else
{
$pageurl .=" <a href='?page=1&ss=".$ss."'>首页</a> &nbsp;<a href='?ss=".$ss."&page=".($page-1)."'>上一页</a>";
}
if($page>=$pagecount)
{
$page=$pagecount;
$pageurl .=" 下一页&nbsp; 尾页";
}else
{
$pageurl .=" <a href='?ss=".$ss."&page=".($page+1)."'>下一页</a> &nbsp;<a href='?ss=".$ss."&page=".$pagecount."'>尾页</a>";
}
if($page<=1)
{
$page=1;
}
$start_rs=intval(($page-1)*$pagesize);//开始
$end_rs=intval($page*$pagesize);//结束
$sql .=" limit {$start_rs},{$end_rs} ";
}
if($t==1)//查看今天天统计
{
$s_time=$day_start;//开始时间
$e_time=$day_out;//结束时间
$sql="select count(*) as ct,r_name from {$table_prefix}sp_count where r_time between '$s_time' and '$e_time' group by r_name ";
}elseif($t==2)//查看昨天统计
{
$s_time=$day_start-$day;//开始
$e_time=$day_out-$day;//结束
$sql="select count(*) as ct,r_name from {$table_prefix}sp_count where r_time between '$s_time' and '$e_time' group by r_name ";
}elseif($t==3)//查看前天天的统计
{
$s_time=$day_start-$day*2;
$e_time=$day_out-$day*2;
$sql="select count(*) as ct,r_name from {$table_prefix}sp_count where r_time between '$s_time' and '$e_time' group by r_name";
}elseif($t==4)//查看七天的统计
{
$s_time=$day_start-$day*7;
$e_time=$day_out;
$sql="select count(*) as ct,r_name from {$table_prefix}sp_count where r_time between '$s_time' and '$e_time' group by r_name ";
}
elseif($t==5)//查看30天的
{
$s_time=$day_start-$day*30;
$e_time=$day_out;
$sql="select count(*) as ct,r_name from {$table_prefix}sp_count where r_time between '$s_time' and '$e_time' group by r_name ";
}elseif($t==6)//查看90天的统计
{
$s_time=$day_start-$day*90;
$e_time=$day_out;
$sql="select count(*) as ct,r_name from {$table_prefix}sp_count where r_time between '$s_time' and '$e_time' group by r_name ";
}
$res=mysql_query($sql);// or die("请先安装程序<a href='https://www.jb51.net/spilder_install.php'>安装</a>");
?><!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 http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>显示蜘蛛记录情况</title>
<style type="text/css">
td{font-size:14px;}
a,a:link{text-decoration:none; color:#000; }
a:hover{color:#F00;}
</style>
</head>
<body>
<table cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#66CC00"><h1><a href="https://www.jianlila.com" target="_blank">荐礼啦</a> 蜘蛛查看器</h1></td>
</tr>
</table>
<table cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF">分类查看</td>
<td bgcolor="#FFFFFF"> &nbsp;
<a href="https://www.jb51.net/?ss=999">所有的</a>&nbsp;
<a href="https://www.jb51.net/article/?ss=1">百度</a> &nbsp;
<a href="https://www.jb51.net/article/?ss=2">谷歌</a> &nbsp;
<a href="https://www.jb51.net/article/?ss=3">必应</a>&nbsp;
<a href="https://www.jb51.net/article/?ss=4">雅虎</a>&nbsp;
<a href="https://www.jb51.net/article/?ss=5">搜狗</a> &nbsp;
<a href="https://www.jb51.net/article/?ss=6">搜搜</a>&nbsp;
<a href="https://www.jb51.net/article/?ss=7">有道</a></td>
<td bgcolor="#FFFFFF">&nbsp;
<a href="https://www.jb51.net/article/?t=0">时时</a> &nbsp;
<a href="https://www.jb51.net/article/?t=1">今天</a>&nbsp;
<a href="https://www.jb51.net/article/?t=2">昨天</a>&nbsp;
<a href="https://www.jb51.net/article/?t=3">前天</a>&nbsp;
<a href="https://www.jb51.net/article/?t=4">七天</a>&nbsp;
<a href="https://www.jb51.net/article/?t=4">30天</a>&nbsp;
<a href="https://www.jb51.net/article/?t=5">90天</a>&nbsp;
</td>
</tr>
</table>
<?php
if($_SESSION['ss_sp_admin']==$sp_admin)
{
?>
<table cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF">管理&nbsp;&nbsp;<a href="https://www.jb51.net/?act=logout">退出</a> &nbsp;&nbsp;</td>
<td bgcolor="#FFFFFF">
<a href="https://www.jb51.net/?act=del&dt=0">清空</a>&nbsp;&nbsp;
<a href="https://www.jb51.net/?act=del&dt=1">30天前</a>&nbsp;&nbsp;
<a href="https://www.jb51.net/?act=del&dt=2">60天前</a>&nbsp;&nbsp;
<a href="https://www.jb51.net/?act=del&dt=3">90天前</a> &nbsp;&nbsp;
<a href="https://www.jb51.net/?act=del&dt=4">180天前</a>&nbsp;&nbsp;
<a href="https://www.jb51.net/?act=del&dt=5">360天前</a></td>
</tr>
</table>
<?php
}
?>
<?php
if($t==0)
{
?>
<table cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF">蜘蛛</td>
<td bgcolor="#FFFFFF">时间</td>
<td bgcolor="#FFFFFF">地址</td>
</tr>
<?php
while($rs=mysql_fetch_array($res))
{
?>
<tr>
<td bgcolor="#FFFFFF"><?php echo $rs['r_name'];?></td>
<td bgcolor="#FFFFFF"><?php echo date("Y-m-d H:i:s",$rs['r_time']); ?></td>
<td bgcolor="#FFFFFF"><a href="<?php echo $rs['r_url'];?>" target="_blank"> <?php echo $rs['r_url'];?></a></td>
</tr>
<?php
}
?>
</table>
<table cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF"><?php echo $pageurl;?></td>
</tr>
</table>
<?php
}else{
?>
<table cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF">蜘蛛</td>
<td bgcolor="#FFFFFF">统计</td>
</tr>
<?php
while($rs=mysql_fetch_array($res))
{
?>
<tr>
<td bgcolor="#FFFFFF"><?php echo $rs['r_name'] ?></td>
<td bgcolor="#FFFFFF"><?php echo $rs['ct'];?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
<table cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF">友情链接:<a href="https://www.jianlila.com" target="_blank">荐礼啦</a> <a href="https://www.aiwobama.com" target="_blank">爱我爸妈</a> <a href="https://www.heikediguo.net">黑客帝国</a></td>
</tr>
</table>
</body>
</html>

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/7a86b6363e6d4aca7ddfe4700fa25d1a.html