check search engine bot


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //first example
  2.  
  3. $moteurs = array("bot", "search", "google", "msn, "yahoo", "slirp", "aol");
  4.  
  5. foreach ($moteurs as $moteur){
  6.  
  7. if (strstr(strtolower($_SERVER['USER_AGENT']), $moteur)){
  8. $refisbot = 1;
  9. break;
  10. }
  11. }
  12.  
  13. if (!$refisbot) session_start();
  14.  
  15.  
  16. //second example
  17.  
  18. $UA=$_SERVER["HTTP_USER_AGENT"];
  19. $brow = strtolower($UA);//en minuscules pour toutes les versions
  20. $bots = array ("antibot","appie1.1","archive","ask","askjeeves","baiduspider","converacrawler","deepIndex","dloader","exabot","fast","fluffy","gigabot","girafabot","google","google adsence","googlebot","googlebot-image","grub.org","henrilerobotmirago","heritrix","holmes","httrack","ia_archiver","ichiro","inktomi slurp","java","larbin","lwp-trivial","mediapartners-google","mj12bot","msnbot","msnbot-media","msiecrawler","msrbot","netresearchserver","nimblecrawler","nutch","nutchcvs","openbot","openfind","picsearch","pompos","psbot","python-urllib","sbider","seekbot","scooter","shinchakubin","slurp","spider","stackramber","surveybot","szukacz","teoma","voila","voilabot","voyager","webcrawler","xenu link sleuth","yandex","yahoo","yahoo!","yahoo-mmcrawler","yahooseeker","zyborg");//on ajoute ici les noms des autres robots en minuscules
  21. $n=0;$robotstat="vide";$robot="";

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.