搜索引擎的蜘蛛访问网站是通过远程抓取页面来进行的,我们不能使用JS代码来取得蜘蛛的Agent信息,但是我们可以通过image标签,这样我们就可以得到蜘蛛的agent资料了,通过对agent资料的分析,就可以确定蜘蛛的种类、性别等因素,我们在通过数据库或者文本来记录就可以进行统计了。
数据库结构:
- #
- # 表的结构 `naps_stats_bot`
- #
- CREATE TABLE `naps_stats_bot` (
- `botid` int(10) unsigned NOT NULL auto_increment,
- `botname` varchar(100) NOT NULL default '',
- `botagent` varchar(200) NOT NULL default '',
- `bottag` varchar(100) NOT NULL default '',
- `botcount` int(11) NOT NULL default '0',
- `botlast` datetime NOT NULL default '0000-00-00 00:00:00',
- `botlasturl` varchar(250) NOT NULL default '',
- UNIQUE KEY `botid` (`botid`),
- KEY `botname` (`botname`)
- ) TYPE=MyISAM AUTO_INCREMENT=9 ;
- #
- # 导出表中的数据 `naps_stats_bot`
- #
- INSERT INTO `naps_stats_bot` VALUES (1, 'Googlebot', 'Googlebot/2.X ( http://www.googlebot.com/bot.html)', 'googlebot', 0, '0000-00-00 00:00:00', '');
- INSERT INTO `naps_stats_bot` VALUES (2, 'MSNbot', 'MSNBOT/0.1 (http://search.msn.com/msnbot.htm)', 'msnbot', 0, '0000-00-00 00:00:00', '');
- INSERT INTO `naps_stats_bot` VALUES (3, 'Inktomi Slurp', 'Slurp/2.0', 'slurp', 0, '0000-00-00 00:00:00', '');
- INSERT INTO `naps_stats_bot` VALUES (4, 'Baiduspider', 'Baiduspider ( http://www.baidu.com/search/spider.htm)', 'baiduspider', 0, '0000-00-00 00:00:00', '');
- INSERT INTO `naps_stats_bot` VALUES (5, 'Yahoobot', 'Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)', 'slurp', 0, '0000-00-00 00:00:00', '');
- INSERT INTO `naps_stats_bot` VALUES (6, 'Sohubot', 'sohu-search', 'sohu-search', 0, '0000-00-00 00:00:00', '');
- INSERT INTO `naps_stats_bot` VALUES (7, 'Lycos', 'Lycos/x.x', 'lycos', 0, '0000-00-00 00:00:00', '');
- INSERT INTO `naps_stats_bot` VALUES (8, 'Robozilla', 'Robozilla/1.0', 'robozilla', 0, '0000-00-00 00:00:00', '');
PHP程序:
- error_reporting(E_ALL & ~E_NOTICE);
- function get_naps_bot()
- {
- $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
- if (strpos($useragent, 'googlebot') !== false){
- return 'Googlebot';
- }
- if (strpos($useragent, 'msnbot') !== false){
- return 'MSNbot';
- }
- if (strpos($useragent, 'slurp') !== false){
- return 'Yahoobot';
- }
- if (strpos($useragent, 'baiduspider') !== false){
- return 'Baiduspider';
- }
- if (strpos($useragent, 'sohu-search') !== false){
- return 'Sohubot';
- }
- if (strpos($useragent, 'lycos') !== false){
- return 'Lycos';
- }
- if (strpos($useragent, 'robozilla') !== false){
- return 'Robozilla';
- }
- return false;
- }
- $tlc_thispage = addslashes($_SERVER['HTTP_USER_AGENT']);
- //添加蜘蛛的抓取记录
- $searchbot = get_naps_bot();
- if ($searchbot) {
- $DB_naps->query("UPDATE naps_stats_bot SET botcount=botcount 1, botlast=NOW(), botlasturl='$tlc_thispage' WHERE botname='$searchbot'");
- }
- ?>
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » 通过PHP程序知道蜘蛛是否访问你的网站(附代码)
波比源码 » 通过PHP程序知道蜘蛛是否访问你的网站(附代码)
buy levofloxacin without prescription cost levaquin
buy tadalafil for sale order voltaren sale buy voltaren sale
generic isotretinoin 40mg accutane 20mg drug azithromycin 250mg oral
prednisone uk tadalafil drug brand sildenafil 100mg
buy buspirone 10mg online dilantin over the counter brand ditropan
alendronate brand alendronate medication buy famotidine sale
purchase isosorbide pill cheap digoxin 250 mg generic micardis 20mg
salbutamol us imuran 100mcg cheap purchase viagra online
nootropil price sildenafil 50 mg buy viagra 50mg for sale
amlodipine usa us cialis sales buy tadalafil 20mg for sale
order cialis 5mg for sale inderal 10mg over the counter oral clopidogrel 150mg
buy baclofen generic toradol 10mg pill buy toradol 10mg online cheap
flomax 0.2mg ca buy tamsulosin 0.2mg online cheap purchase aldactone without prescription
ceftin 250mg drug robaxin 500mg uk purchase methocarbamol sale
casino games real money cheap tadalafil generic order generic cialis 10mg
pay essay writing where can i buy a research paper cost of stromectol medication
sildenafil 100mg pills for sale cialis pills 20mg order tadalafil 20mg generic
brand deltasone 10mg order mebendazole generic order vermox 100mg generic
buy fildena 100mg pills order rhinocort online purchase budesonide without prescription
tadalafil 10mg us order generic indomethacin 50mg buy indocin generic
terbinafine 250mg pill suprax price amoxicillin drug
actos 30mg uk buy viagra 50mg online cheap order viagra 100mg
buy singulair generic cheap viagra sale order viagra online cheap
cheap cialis for sale online gambling sites online blackjack gambling
online blackjack for real money rivers casino free roulette
free casino online casino no deposit bonus slot casino
free spins fda approved canadian online pharmacies pay for essay
buy altace 5mg for sale buy arcoxia 120mg online etoricoxib sale
pay for a research paper arava for sale purchase azulfidine online
generic amoxil order stromectol 12mg for sale ivermectin uk coronavirus
dapoxetine price priligy 30mg without prescription order domperidone
fosamax 35mg cheap alendronate 35mg cost ibuprofen cost
nortriptyline for sale online buy paroxetine online order paxil pills
doxycycline 100mg drug buy aralen pills buy methylprednisolone 16 mg online
ropinirole 1mg cheap calcitriol 0.25mg cost trandate 100mg pill
order tricor pill order fenofibrate 160mg for sale sildenafil 50mg canada
female cialis cvs buy pills for erectile dysfunction best ed medications
buy serophene generic buy clomid 50mg without prescription order generic prednisolone 10mg
provigil 200mg cheap buy phenergan phenergan buy online
stromectol uk buy prednisone 5mg online prednisone 10mg usa
sildenafil buy online buy lyrica online order finasteride 5mg online
buy accutane 10mg online isotretinoin 40mg cheap azithromycin price
ondansetron 8mg pills oral zofran 4mg purchase bactrim generic