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

于是昨天便认真的做了一下,功能多一点,可以对各种搜索引擎统计分析。可以在多个时间段进行查看。其实代码很简单,为了更简洁些,代码压缩到6k.分为6个文件
1.安装程序 spilder_install.php 

 
 
 
 
安装插件 
 
"; 
} 
else 
{ 
echo ""; 
} 
if(mysql_select_db($mysql_db,$link)) 
{ 
echo "连接数据库成功!.............
正在创建表................
"; } $sql="CREATE TABLE `spilder_sp_count` ( `id` bigint(20) NOT NULL auto_increment, `r_time` int(11) NOT NULL, `r_name` varchar(50) NOT NULL, `r_url` varchar(200) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=gb2312 AUTO_INCREMENT=4 ; "; mysql_query("DROP TABLE IF EXISTS `".$table_prefix."sp_count`;");//删除已存在 $sql=str_replace("spilder_",$table_prefix,$sql);//替换前缀 if(mysql_query($sql)) { echo "表创建成功!正在写入文件"; } $f=file_get_contents("spilder_config.php");//获取配置内容 $f=str_replace(" ","",$f);//去除空格 $f=preg_replace("/mysql_host=.*;/iUs","mysql_host='{$mysql_host}';",$f); $f=preg_replace("/mysql_user=.*;/iUs","mysql_user='{$mysql_user}';",$f); $f=preg_replace("/mysql_pwd=.*;/iUs","mysql_pwd='{$mysql_pwd}';",$f); $f=preg_replace("/mysql_db=.*;/iUs","mysql_db='{$mysql_db}';",$f); $f=preg_replace("/table_prefix=.*;/iUs","table_prefix='{$table_prefix}';",$f); $f=preg_replace("/sp_admin=.*;/iUs","sp_admin='{$sp_admin}';",$f); file_put_contents("spilder_config.php",$f); file_put_contents("isinstall.txt","OK"); echo "恭喜!荐礼啦蜘蛛统计程序安装成功 查看"; exit(); } ?>
荐礼啦 蜘蛛统计查看器
  开始安装
服务器: (一般不用改)
用户名:
密码:
数据库:
表前缀:
管理密码:
 


2.蜘蛛记录文件

db_query("insert into {$table_prefix}sp_count(r_time,r_name,r_url) values('$r_time','$searchbot','$url')"); 
} 
function get_naps_bot() 
{ 
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']); 
if (strpos($useragent, 'googlebot') !== false){ 
return 'Googlebot'; 
}elseif (strpos($useragent, 'msnbot') !== false){ 
return 'MSNbot'; 
}elseif (strpos($useragent, 'slurp') !== false){ 
return 'Yahoobot'; 
}elseif (strpos($useragent, 'baiduspider') !== false){ 
return 'Baiduspider'; 
}elseif (strpos($useragent, 'sogou') !== false){ 
return 'Sogoubot'; 
}elseif (strpos($useragent,'soso') !== false){ 
return 'Sosobot'; 
}elseif(strpos($useragent,'youdao')!==false) 
{ 
return 'Youdao'; 
} 
else 
{ 
return false; 
} 
} 
?> 

3.蜘蛛统计查看文件

'') 
{ 
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 .=" 首页  上一页"; 
} 
if($page>=$pagecount) 
{ 
$page=$pagecount; 
$pageurl .=" 下一页  尾页"; 
}else 
{ 
$pageurl .=" 下一页  尾页"; 
} 
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("请先安装程序安装"); 
?> 
 
 
 
显示蜘蛛记录情况 
 
 
 

荐礼啦 蜘蛛查看器

分类查看   所有的  百度   谷歌   必应  雅虎  搜狗   搜搜  有道   时时   今天  昨天  前天  七天  30天  90天 
管理  退出    清空   30天前   60天前   90天前    180天前   360天前
蜘蛛 时间 地址
蜘蛛 统计

你可能感兴趣的:(发款php蜘蛛统计插件只要有mysql就可用)