PageRenderTime 68ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/visitstat/tab_os_nav_robots.php

https://bitbucket.org/meianki/voguersurlavague
PHP | 603 lines | 441 code | 74 blank | 88 comment | 67 complexity | 678cfb8552f9d6adccccf05c2312c9e0 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0
  1. <?
  2. /*
  3. -------------------------------------------------------------------------
  4. AllMyStats V1.32 - Statistiques de fréquentation visiteurs et robots
  5. -------------------------------------------------------------------------
  6. Copyright (C) 2000 - Cédric TATANGELO (Cedstat)
  7. Copyright (C) 2008 - Herve Seywert
  8. -------------------------------------------------------------------------
  9. Web: http://www.wertronic.com
  10. -------------------------------------------------------------------------
  11. Ce programme est libre, vous pouvez le redistribuer et/ou le modifier
  12. selon les termes de la Licence Publique Génrale GNU publiée par la Free
  13. Software Foundation .
  14. -------------------------------------------------------------------------
  15. $when sert pour by day - $mois pour by month
  16. */
  17. include_once('application_top.php');
  18. //-- initialisatio des variables des naviguateurs
  19. $MSIE7=0;
  20. $MSIE6=0;
  21. $MSIE55=0;
  22. $MSIE5=0;
  23. $Lynx=0;
  24. $Opera=0;
  25. $WebTV=0;
  26. $Konqueror=0;
  27. $Netscape=0;
  28. $Bot=0;
  29. $Other=0;
  30. $total=0;
  31. //Pour moteurs recherche
  32. $bot=0;
  33. $Googlebot=0;
  34. $YahooSlurp=0;
  35. $Total_page_visites_bot=0;
  36. //-- initialisation des variables des OS
  37. $WindowsNT=0;
  38. $WindowsXP=0;
  39. $Windows2000=0;
  40. $Windows98=0;
  41. $Windows95=0;
  42. $Mac=0;
  43. $Linux=0;
  44. $FreeBSD=0;
  45. $SunOS=0;
  46. $IRIX=0;
  47. $BeOS=0;
  48. $OS2=0;
  49. $AIX=0;
  50. $AOL=0;
  51. $OtherOS=0;
  52. $totalOS=0;
  53. /*
  54. // Est déj? effectué dans normal.php
  55. //------------------------ Mise en tableau de la table bad user agent ----------------
  56. $Bad_User_Agent=mysql_query("select * from bad_user_agent"); //
  57. while($bad_agents=mysql_fetch_array($Bad_User_Agent)){ // Mise en tableau des bad agents
  58. $Matrice_bad_user_agent[] = array($bad_agents['user_agent'], $bad_agents['info'],$bad_agents['type']);
  59. }
  60. //-----------------------------------------------------------------------------
  61. */
  62. if (!$_SESSION['Autres_robots'] || $affiche_only_other_bots<>true) { //Pour accelerer lors de l'ajout des robots
  63. //$_SESSION['Autres_robots'] = "";
  64. unset($_SESSION['Autres_robots']);
  65. //-----------------------------------------------------------
  66. //Mise en tableau et en forme ($AllBots) pour preg_match des bot connus (dans la table + bot en générale (bot, spider , etc)
  67. //Attention est répété si est en include de normal.php, details_robot.php, cumulpage.php
  68. //Mais pas include de add_crawler. De plus il faut mettre ici des \ pour $Tab_crawlers[]
  69. $result1=mysql_query("select bot_name, org_name, crawler_url, crawler_info from ".TABLE_CRAWLER."");
  70. $AllBots = '/Bot|Slurp|Scooter|Spider|crawl|';
  71. while($row=mysql_fetch_array($result1)){
  72. $Form_chaine = str_replace('/','\/',$row['bot_name']);
  73. $Form_chaine = str_replace('+','\+',$Form_chaine);
  74. $Form_chaine = str_replace('(','\(',$Form_chaine);
  75. $Form_chaine = str_replace(')','\)',$Form_chaine);
  76. $AllBots .= $Form_chaine.'|';
  77. $Tab_crawlers[] = array($Form_chaine,$row['org_name'],$row['crawler_url'],$row['crawler_info']);
  78. }
  79. $AllBots = substr($AllBots,0,strlen($AllBots)-1); //supp last |
  80. $AllBots .= '/i';
  81. //-----------------------------------------------------------
  82. //Important pour le test suivant car par exemple Googlebot-Image doit se trouvé avant Googlebot
  83. array_multisort ($Tab_crawlers, SORT_DESC);
  84. // ------------------------------------------------------------------------- //
  85. //#################################################################################################
  86. //$result = mysql_query("select * from ".TABLE_VISITEUR." where date like '%$mois'");
  87. //$nbr_result = mysql_num_rows($result);
  88. for($i=0;$i<$nbr_result;$i++) {
  89. $us_agt = mysql_result($result,$i,"agent");
  90. $Nbvisites = mysql_result($result,$i,"nb_visite");
  91. //------- Mise en tableau des Bad user agent reconnus (non compté comme visiteur) -----
  92. $trash=false;
  93. if (strlen(trim($us_agt))<=1){ $trash=true; }
  94. for($nb_bad_user_agent=0;$nb_bad_user_agent<count($Matrice_bad_user_agent);$nb_bad_user_agent++){
  95. //On n'exclus et on ne compte dans cette liste que les user agent déterminés comme Spammer
  96. if ($Matrice_bad_user_agent[$nb_bad_user_agent][0] == $us_agt && $Matrice_bad_user_agent[$nb_bad_user_agent][2]=='S') {
  97. $bad_and_inconnu = "Nb_".$nb_bad_user_agent;
  98. $$bad_and_inconnu =$$bad_and_inconnu+$Nbvisites;
  99. $Bad_Nb_distinct_Ip = "NbIp_".$nb_bad_user_agent;
  100. $$Bad_Nb_distinct_Ip = $$Bad_Nb_distinct_Ip + 1;
  101. $bad_user_agent[$nb_bad_user_agent] = array($Matrice_bad_user_agent[$nb_bad_user_agent][0], $$bad_and_inconnu, $$Bad_Nb_distinct_Ip,$Matrice_bad_user_agent[$nb_bad_user_agent][1],$Matrice_bad_user_agent[$nb_bad_user_agent][2]);
  102. $trash=true;
  103. }
  104. }
  105. //--------------------------------------------------------------------------------------
  106. if ($trash==false) {
  107. for($nb_crawlers=0;$nb_crawlers<count($Tab_crawlers);$nb_crawlers++){
  108. $FindCrawler = false;
  109. if($Tab_crawlers[$nb_crawlers] && eregi($Tab_crawlers[$nb_crawlers][0], $us_agt)) {
  110. $robots = str_replace(' ','',$Tab_crawlers[$nb_crawlers][0]);
  111. $robots = str_replace('-','',$robots);
  112. $robots = str_replace('!','',$robots);
  113. $$robots=$$robots+$Nbvisites;
  114. $Nb_distinct_Ip = "Nb_".$robots;
  115. $$Nb_distinct_Ip = $$Nb_distinct_Ip + 1;
  116. $Total_page_visites_bot = $Total_page_visites_bot + $Nbvisites;
  117. //le calcul de $class_robots[$nb_crawlers][3] (%) est fait juste avant l'affichage car total_bot est en cours de calcul.
  118. if ($Tab_crawlers[$nb_crawlers][2]) {
  119. $Lien_url = '<a href="'.$Tab_crawlers[$nb_crawlers][2].'" target="_blank">'.$Tab_crawlers[$nb_crawlers][1].'</a>';
  120. } else {
  121. $Lien_url = $Tab_crawlers[$nb_crawlers][1];
  122. }
  123. $crawler_info = '<br>'.$Tab_crawlers[$nb_crawlers][3];
  124. $class_robots[$nb_crawlers]=array($Lien_url.$crawler_info,$$robots,$$Nb_distinct_Ip,'',$Tab_crawlers[$nb_crawlers][0]);
  125. $FindCrawler = true; break;
  126. }
  127. }
  128. if ($FindCrawler == false ) {
  129. // Autres robots
  130. if(preg_match($AllBots, $us_agt)) {
  131. $Autres_robots[] = $us_agt;
  132. $robots = $MSG_ROBOTS_AUTRES;
  133. $$robots=$$robots+$Nbvisites;
  134. $Nb_distinct_IpA = "Nb_".$robots;
  135. $$Nb_distinct_Ip = $$Nb_distinct_Ip+1;
  136. $Total_page_visites_bot = $Total_page_visites_bot + $Nbvisites;
  137. $class_robots[$nb_crawlers]=array($MSG_ROBOTS_AUTRES,$$robots,$$Nb_distinct_Ip,'','-');
  138. }
  139. //--------------------------------------------------------------------------------------------------------
  140. if(!preg_match($AllBots, $us_agt)) {
  141. //TODO Netscape 7.0 et + (pas fait car la table user agent était varchar(100) et il n'y avait pas de netscape
  142. //if (eregi("Netscape", $us_agt)) {
  143. //$tmp = explode('Netscape', $us_agt);
  144. //echo '<div align="left">test: '.$tmp .'</div><br>';
  145. //} et voir si apr?s on peut extraire la version
  146. /* Get the Browser data */
  147. if((ereg("Nav", $us_agt)) || (ereg("Gold", $us_agt)) || (ereg("X11", $us_agt)) || (ereg("Mozilla", $us_agt)) || (ereg("Netscape", $us_agt)) AND (!ereg("MSIE", $us_agt))) {
  148. if (eregi("Netscape", $us_agt)) {
  149. if(ereg("Netscape6/6.0", $us_agt)) { $browser = "Netscape60"; $total=$total+1; $$browser=$$browser+1;
  150. } elseif (ereg("Netscape6/6.1", $us_agt)) { $browser = "Netscape61"; $total=$total+1; $$browser=$$browser+1;
  151. } elseif (ereg("Netscape6/6.2", $us_agt)) { $browser = "Netscape62"; $total=$total+1; $$browser=$$browser+1;
  152. } else { $browser = "Netscape" ; $total=$total+1; $$browser=$$browser+1;}
  153. }elseif (eregi("Firefox", $us_agt)) {
  154. if(ereg("Firefox/1.0", $us_agt)) { $browser = "MozillaFirefox10"; $total=$total+1; $$browser=$$browser+1;
  155. } elseif (ereg("Firefox/1.4", $us_agt)) { $browser = "MozillaFirefox14"; $total=$total+1; $$browser=$$browser+1;
  156. } elseif (ereg("Firefox/1.5", $us_agt)) { $browser = "MozillaFirefox15"; $total=$total+1; $$browser=$$browser+1;
  157. } elseif (ereg("Firefox/2.0", $us_agt)) { $browser = "MozillaFirefox20"; $total=$total+1; $$browser=$$browser+1;
  158. } elseif (ereg("Firefox/3.0", $us_agt)) { $browser = "MozillaFirefox30"; $total=$total+1; $$browser=$$browser+1;
  159. } else { $browser = "Firefox" ; $total=$total+1; $$browser=$$browser+1;}
  160. } elseif (ereg("Safari", $us_agt)) {
  161. $browser = "Safari"; $total=$total+1; $$browser=$$browser+1;
  162. } else { $browser = "Other";$total=$total+1; $$browser=$$browser+1;}
  163. } elseif (ereg("MSIE 7.0", $us_agt) && !ereg("AOL", $us_agt)) { $browser = "MSIE7"; $total=$total+1; $$browser=$$browser+1;
  164. } elseif (ereg("MSIE 6.0", $us_agt) && !ereg("AOL", $us_agt)) { $browser = "MSIE6"; $total=$total+1; $$browser=$$browser+1;
  165. } elseif (ereg("MSIE 5.5", $us_agt) && !ereg("AOL", $us_agt)) { $browser = "MSIE55"; $total=$total+1; $$browser=$$browser+1;
  166. } elseif (ereg("MSIE 5.0", $us_agt) && !ereg("AOL", $us_agt)) { $browser = "MSIE5"; $total=$total+1; $$browser=$$browser+1;
  167. } elseif (ereg("AOL", $us_agt)) { $browser = "AOL"; $total=$total+1;$$browser=$$browser+1;
  168. } elseif (ereg("Lynx", $us_agt)) { $browser = "Lynx"; $total=$total+1; $$browser=$$browser+1;
  169. } elseif (ereg("Opera", $us_agt)) { $browser = "Opera"; $total=$total+1; $$browser=$$browser+1;
  170. } elseif (ereg("WebTV", $us_agt)) { $browser = "WebTV"; $total=$total+1; $$browser=$$browser+1;
  171. } elseif (ereg("Konqueror", $us_agt)) { $browser = "Konqueror"; $total=$total+1; $$browser=$$browser+1;
  172. /*
  173. } else {
  174. $browser = "Other";
  175. $total=$total+1;
  176. $$browser=$$browser+1;
  177. echo '<div align="left">Autres Browser ='.$us_agt.'</div>';
  178. */
  179. }
  180. //Get the Operating System data
  181. //07/2008 wertronic.com mise ? jour
  182. if(ereg("Windows NT 6.0", $us_agt)) { $os = "WindowsVista"; $totalOS=$totalOS+1; $$os=$$os+1;}
  183. elseif(ereg("Windows NT 5.2", $us_agt)){ $os = "WindowsServer2003"; $totalOS=$totalOS+1; $$os=$$os+1;}
  184. elseif(ereg("Windows NT 5.1", $us_agt)) { $os = "WindowsXP"; $totalOS=$totalOS+1; $$os=$$os+1;}
  185. elseif(ereg("Windows NT 5.0", $us_agt)) { $os = "Windows2000"; $totalOS=$totalOS+1; $$os=$$os+1;}
  186. elseif(ereg("Windows NT 4", $us_agt)) { $os = "WindowsNT"; $totalOS=$totalOS+1; $$os=$$os+1;}
  187. //DigExt extension in certain versions of MSIE Grabs content to make it available offline
  188. elseif(eregi("Windows NT", $us_agt) && eregi("DigExt", $us_agt)) { $os = "WindowsNT"; $totalOS=$totalOS+1; $$os=$$os+1;}
  189. elseif(ereg("Windows 98", $us_agt) || ereg("Win98", $us_agt) || ereg("Windows ME", $us_agt) || ereg("Win 9x 4.90", $us_agt)) { $os = "Windows98";$totalOS=$totalOS+1; $$os=$$os+1;}
  190. elseif(ereg("Windows 95", $us_agt)) { $os = "Windows95"; $totalOS=$totalOS+1; $$os=$$os+1;}
  191. elseif((ereg("Mac", $us_agt)) || (ereg("PPC", $us_agt))) { $os = "Mac"; $totalOS=$totalOS+1; $$os=$$os+1;}
  192. elseif(ereg("Linux", $us_agt)) { $os = "Linux"; $totalOS=$totalOS+1; $$os=$$os+1;}
  193. elseif(ereg("FreeBSD", $us_agt)) { $os = "FreeBSD"; $totalOS=$totalOS+1; $$os=$$os+1;}
  194. elseif(ereg("Unix", $us_agt)) { $os = "Unix"; $totalOS=$totalOS+1; $$os=$$os+1;}
  195. elseif(ereg("SunOS", $us_agt)) { $os = "SunOS"; $totalOS=$totalOS+1; $$os=$$os+1;}
  196. elseif(ereg("IRIX", $us_agt)) { $os = "IRIX"; $totalOS=$totalOS+1; $$os=$$os+1;}
  197. elseif(ereg("BeOS", $us_agt)) { $os = "BeOS"; $totalOS=$totalOS+1; $$os=$$os+1; }
  198. elseif(ereg("OS/2", $us_agt)) { $os = "OS2"; $totalOS=$totalOS+1; $$os=$$os+1;}
  199. elseif(ereg("AIX", $us_agt)) { $os = "AIX"; $totalOS=$totalOS+1; $$os=$$os+1;
  200. } else {
  201. //$os = "OtherOS";
  202. //echo '<div align="left">Autres OS ou Browser ='.$us_agt.'</div>';
  203. $Autres_OS_brower[] = $us_agt;
  204. }
  205. } // if(!preg_match($AllBots, $us_agt)) {
  206. }//Fin if ($FindCrawler == false ) {
  207. } //Fin if trash
  208. } // Fin de For
  209. if ($AfficheOS==true) {
  210. $AfficheOS=false;
  211. // <!-- ############################## Liste OS ################################### -->
  212. $show_page_os_nav_robots = "";
  213. $show_page_os_nav_robots = '
  214. <TABLE CELLPADDING=1 CELLSPACING=0 class=TABLEBORDER>
  215. <TBODY>
  216. <TR>
  217. <TD><!-- Data BEGIN -->
  218. <TABLE CELLPADDING=5 CELLSPACING=0 class=TABLEFRAME><!-- header -->
  219. <TBODY>
  220. <TR>
  221. <TH class=TABLETITLE>'.$MSG_OS_TITRE.'</TH>
  222. </TR>
  223. <TR>
  224. <TD colSpan=2><!-- Rows BEGIN -->
  225. <TABLE border=1 CELLPADDING=2 CELLSPACING=0 class=TABLEDATA>
  226. <TBODY>
  227. <TR>
  228. <TH WIDTH=33%>'.$MSG_OS.'</TH>
  229. <TH WIDTH=33%>'.$MSG_VISITEURS.'</TH>
  230. <TH>'.$MSG_VISITEURS_POURCENTAGE.'</TH></TR>
  231. ';
  232. // pour eviter l'erreur de la division par 0
  233. if($totalOS==0){
  234. $totalOS=1;
  235. }
  236. else{
  237. $class_os[]=array("Windows Vista",$WindowsVista,(bcdiv($WindowsVista,$totalOS,4)*100));
  238. $class_os[]=array("Windows Server 2003",$WindowsServer2003,(bcdiv($WindowsServer2003,$totalOS,4)*100));
  239. $class_os[]=array("Windows XP",$WindowsXP,(bcdiv($WindowsXP,$totalOS,4)*100));
  240. $class_os[]=array("Windows 2000",$Windows2000,(bcdiv($Windows2000,$totalOS,4)*100));
  241. $class_os[]=array("Windows NT 4",$WindowsNT,(bcdiv($WindowsNT,$totalOS,4)*100));
  242. $class_os[]=array("Windows 98/Me",$Windows98,(bcdiv($Windows98,$totalOS,4)*100));
  243. $class_os[]=array("Windows 95",$Windows95,(bcdiv($Windows95,$totalOS,4)*100));
  244. $class_os[]=array("Mac",$Mac,(bcdiv($Mac,$totalOS,4)*100));
  245. $class_os[]=array("Linux",$Linux,(bcdiv($Linux,$totalOS,4)*100));
  246. $class_os[]=array("FreeBSD",$FreeBSD,(bcdiv($FreeBSD,$totalOS,4)*100));
  247. $class_os[]=array("Unix",$Unix,(bcdiv($Unix,$totalOS,4)*100));
  248. $class_os[]=array("SunOS",$SunOS,(bcdiv($SunOS,$totalOS,4)*100));
  249. $class_os[]=array("IRIX",$IRIX,(bcdiv($IRIX,$totalOS,4)*100));
  250. $class_os[]=array("BeOS",$BeOS,(bcdiv($BeOS,$totalOS,4)*100));
  251. $class_os[]=array("OS/2",$OS2,(bcdiv($OS2,$totalOS,4)*100));
  252. $class_os[]=array("AIX",$AIX,(bcdiv($AIX,$totalOS,4)*100));
  253. $class_os[]=array("Autres OS",$OtherOS,(bcdiv($OtherOS,$totalOS,4)*100));
  254. }
  255. @usort($class_os,"CompareValeurs");
  256. for($i=0;$i<14;$i++){
  257. if ($class_os[$i][1]!=0) $show_page_os_nav_robots .= "<tr><td>".$class_os[$i][0]."</td><td align=center>".$class_os[$i][1]."</td><td align=center>".$class_os[$i][2]."%</td>";
  258. }
  259. $show_page_os_nav_robots .= '
  260. </TBODY></TABLE><!-- Rows END --></TD></TR><!-- no footer --></TBODY></TABLE><!-- Data END --></TD></TR></TBODY></TABLE><BR>
  261. ';
  262. }
  263. if ($AfficheNav==true) {
  264. $AfficheNav=false;
  265. // <!-- ############################## Liste Navigateurs ################################### -->
  266. $show_page_os_nav_robots .= '
  267. <TABLE CELLPADDING=1 CELLSPACING=0 class=TABLEBORDER>
  268. <TBODY>
  269. <TR>
  270. <TD><!-- Data BEGIN -->
  271. <TABLE CELLPADDING=5 CELLSPACING=0 class=TABLEFRAME><!-- header -->
  272. <TBODY>
  273. <TR>
  274. <TH class=TABLETITLE>'.$MSG_NAV_TITRE.'</TH>
  275. </TR>
  276. <TR>
  277. <TD colSpan=2><!-- Rows BEGIN -->
  278. <TABLE border=1 CELLPADDING=2 CELLSPACING=0 class=TABLEDATA>
  279. <TBODY>
  280. <TR>
  281. <TH WIDTH=33%>'.$MSG_NAV.'</TH>
  282. <TH WIDTH=33%>'.$MSG_VISITEURS.'</TH>
  283. <TH>'.$MSG_VISITEURS_POURCENTAGE.'</TH></TR>
  284. ';
  285. // pour éviter l'erreur de la division par 0
  286. if($total==0){
  287. $total=1;
  288. }
  289. else{
  290. $class_nav[]=array("Internet Exlorer 7",$MSIE7,(bcdiv($MSIE7,$total,4)*100));
  291. $class_nav[]=array("Internet Exlorer 6",$MSIE6,(bcdiv($MSIE6,$total,4)*100));
  292. $class_nav[]=array("Internet Exlorer 5.5",$MSIE55,(bcdiv($MSIE55,$total,4)*100));
  293. $class_nav[]=array("Internet Exlorer 5",$MSIE5,(bcdiv($MSIE5,$total,4)*100));
  294. $class_nav[]=array("Netscape 6.0",$Netscape60,(bcdiv($Netscape60,$total,4)*100));
  295. $class_nav[]=array("Netscape 6.1",$Netscape61,(bcdiv($Netscape61,$total,4)*100));
  296. $class_nav[]=array("Netscape 6.2",$Netscape62,(bcdiv($Netscape62,$total,4)*100));
  297. $class_nav[]=array("Netscape Navigator => 7.0",$Netscape,(bcdiv($Netscape,$total,4)*100));
  298. $class_nav[]=array("Mozilla Firefox 1.0",$MozillaFirefox10,(bcdiv($MozillaFirefox10,$total,4)*100));
  299. $class_nav[]=array("Mozilla Firefox 1.4",$MozillaFirefox14,(bcdiv($MozillaFirefox14,$total,4)*100));
  300. $class_nav[]=array("Mozilla Firefox 1.5",$MozillaFirefox15,(bcdiv($MozillaFirefox15,$total,4)*100));
  301. $class_nav[]=array("Mozilla Firefox 2.0",$MozillaFirefox20,(bcdiv($MozillaFirefox20,$total,4)*100));
  302. $class_nav[]=array("Mozilla Firefox 3.0",$MozillaFirefox30,(bcdiv($MozillaFirefox30,$total,4)*100));
  303. $class_nav[]=array("Mozilla Firefox Navigator",$Firefox,(bcdiv($Firefox,$total,4)*100));
  304. $class_nav[]=array("AOL",$AOL,(bcdiv($AOL,$total,4)*100));
  305. $class_nav[]=array("Lynx",$Lynx,(bcdiv($Lynx,$total,4)*100));
  306. $class_nav[]=array("Opera",$Opera,(bcdiv($Opera,$total,4)*100));
  307. $class_nav[]=array("WebTV",$WebTV,(bcdiv($WebTV,$total,4)*100));
  308. $class_nav[]=array("Konqueror",$Konqueror,(bcdiv($Konqueror,$total,4)*100));
  309. $class_nav[]=array("Safari",$Safari,(bcdiv($Safari,$total,4)*100));
  310. $class_nav[]=array("Autres",$Other,(bcdiv($Other,$total,4)*100));
  311. }
  312. @usort($class_nav,"CompareValeurs");
  313. for($i=0;$i<=count($class_nav);$i++){
  314. if ($class_nav[$i][1]!=0) $show_page_os_nav_robots .= "<tr><td>".$class_nav[$i][0]."</td><td align=center>".$class_nav[$i][1]."</td><td align=center>".$class_nav[$i][2]."%</td>";
  315. }
  316. $show_page_os_nav_robots .= '
  317. </TBODY></TABLE><!-- Rows END --></TD></TR><!-- no footer --></TBODY></TABLE><!-- Data END --></TD></TR></TBODY></TABLE><BR>
  318. ';
  319. }
  320. if ($AfficheRobots==true) {
  321. $AfficheRobots=false;
  322. $affiche_only_other_bots==false;
  323. ############################## Liste Robots ###################################
  324. $show_page_os_nav_robots .= '
  325. <TABLE CELLPADDING=1 CELLSPACING=0 class=TABLEBORDER>
  326. <TBODY>
  327. <TR>
  328. <TD><!-- Data BEGIN -->
  329. <TABLE CELLPADDING=5 CELLSPACING=0 class=TABLEFRAME><!-- header -->
  330. <TBODY>
  331. <TR>
  332. <TH class=TABLETITLE>'.$MSG_ROBOTS_VISITES.'</TH>
  333. </TR>
  334. <TR>
  335. <TD colSpan=2><!-- Rows BEGIN -->
  336. <TABLE border=1 CELLPADDING=2 CELLSPACING=0 class=TABLEDATA>
  337. <TBODY>
  338. <TR>
  339. <TH WIDTH=40%>'.$MSG_ROBOTS_PARENT_NAME.'</TH>
  340. <TH>'.$MSG_ROBOTS_NAME.'</TH>
  341. <TH>'.$MSG_ROBOTS_NB_PAGE_SCAN.'</TH>
  342. <TH>'.$MSG_NB_DISTINCT_IP.'</TH>
  343. <TH>'.$MSG_VISITEURS_POURCENTAGE.'</TH>
  344. </TR>
  345. ';
  346. @usort($class_robots,"CompareValeurs");
  347. $Total_distincts_Ip_bots = 0;
  348. $Total_distinct_robots = 0;
  349. for($i=0;$i< count($class_robots);$i++){
  350. $Total_distincts_Ip_bots = $Total_distincts_Ip_bots + $class_robots[$i][2] ;
  351. //Insertion et calcul des % de pages vues par les robots
  352. //(on ne pouvait pas le faire avant puisque $Total_page_visites_bot etait en cours de calcul)
  353. $class_robots[$i][3] = (bcdiv($class_robots[$i][1],$Total_page_visites_bot,4)*100);
  354. if ($class_robots[$i][1]!=0) {
  355. if ($class_robots[$i][0]<>$MSG_ROBOTS_AUTRES) {$Total_distinct_robots = $Total_distinct_robots+1;}
  356. $show_page_os_nav_robots .= "<tr><td>".$class_robots[$i][0]."</td><td align=center>".stripslashes($class_robots[$i][4])."</td><td align=center>".$class_robots[$i][1]."</td><td align=center>".$class_robots[$i][2]."</td><td align=center>".$class_robots[$i][3].
  357. "%</td></tr>";
  358. }
  359. }
  360. $Total_distinct_robots = $Total_distinct_robots;
  361. $show_page_os_nav_robots .= "<tr><td align=right><br><strong>Total: &nbsp;</strong><br><center>".$MSG_ROBOTS_KNOW_IN_DATABASE.$Total_distinct_robots."</center></td><td align=center>-</td><td align=center>".$Total_page_visites_bot."</td><td align=center>".$Total_distincts_Ip_bots."</td><td align=center>&nbsp;</td></tr>";
  362. //############################## Autres robots ########################################
  363. if ($Autres_robots) {
  364. $Autres_robots = array_unique($Autres_robots);
  365. @usort($Autres_robots,"CompareValeurs");
  366. $show_page_os_nav_robots .= '<tr><td nowrap colspan=5><Strong><center><br>'.$MSG_ROBOTS_DETAILS.'</center></strong><br>';
  367. for($i=0;$i<count($Autres_robots);$i++){
  368. $show_page_os_nav_robots .= '['.$Autres_robots[$i].']<br>';
  369. }
  370. $show_page_os_nav_robots .= '</td></tr>';
  371. }
  372. $show_page_os_nav_robots .= '
  373. </TBODY></TABLE>
  374. <tr><td align="center">
  375. <form name="GestionCrawler" method="post" action="index_frame.php">
  376. <input name="type" type="hidden" value="add_crawler">
  377. <input name="when" type="hidden" value="'.$when.'">
  378. <input name="mois" type="hidden" value="'.$mois.'">
  379. <input class="submitDate" name="SubmitGestionCrawler" type="submit" value="'.$MSG_TOOLS_BOTS.'" alt="'.$MSG_TOOLS_BOTS.'" title="'.$MSG_TOOLS_BOTS.'">
  380. </form>
  381. </tr></td>
  382. <!-- Rows END --></TD></TR><!-- no footer --></TBODY></TABLE><!-- Data END --></TD></TR></TBODY></TABLE>
  383. <br>
  384. ';
  385. //####################################################################################
  386. } //Fin de if ($AfficheRobots==true) {
  387. //############################## Affiche seulement les robots non référencés dans la base ########################################
  388. } //End if (!$_SESSION['Autres_robots'] || $affiche_only_other_bots<>true) {
  389. if ($affiche_only_other_bots==true) {
  390. if ($Autres_robots) {
  391. $_SESSION['Autres_robots'] = $Autres_robots;
  392. }
  393. $show_page_os_nav_robots .= '
  394. <a name="focusforminsert"></a>
  395. <TABLE width="" border=1 CELLPADDING=5 CELLSPACING=0 bgcolor="#FFFFFF">
  396. ';
  397. //Note : Obscur fait trés rapidement
  398. //ci-dessous index_frame.php fonctionne mais pas <?PHP_SELF; car dans variable $show_page_os_nav_robots
  399. // if ($_SESSION['Autres_robots']) { //Commenter cette ligne pour insert robot permanent
  400. //------------------------ Insert crawler ----------------------------------
  401. if (isset($InsertCrawler)){
  402. $show_page_os_nav_robots .= '
  403. <tr><td>
  404. <TABLE align="center" CELLPADDING=1 CELLSPACING=0 class=TABLEBORDER>
  405. <TBODY>
  406. <TR>
  407. <TD><!-- Data BEGIN -->
  408. <TABLE CELLPADDING=5 CELLSPACING=0 class=TABLEFRAME><!-- header -->
  409. <TBODY>
  410. <TR>
  411. <TH class=TABLETITLE>
  412. <form name="form1" method="post" action="index_frame.php">
  413. <table border="0" cellspacing="0" cellpadding="3">
  414. <tr>
  415. <td align="center">'.$MSG_TOOLS_BOT_NAME.'</td>
  416. <td align="center">'.$MSG_TOOLS_BOT_PARENT_NAME.'</td>
  417. <td align="center">'.$MSG_TOOLS_BOT_URL.'</td>
  418. <td align="center">'.$MSG_COMMENTS.'</td>
  419. </tr>
  420. <tr>
  421. <td align="center"><input name="BotName" type="text" size="20"></td>
  422. <td align="center"><input name="BotParentName" type="text"></td>
  423. <td align="center"><input name="BotUrl" type="text"></td>
  424. <td align="center"><input name="BotComment" type="text"></td>
  425. </tr>
  426. </table>
  427. <input name="type" type="hidden" value="add_crawler">
  428. <input name="when" type="hidden" value="'.$when.'">
  429. <input name="mois" type="hidden" value="'.$mois.'">
  430. <input class="submitDate" name="DoInsertCrawler" type="submit" value="'.$MSG_ADD.'" alt="'.$MSG_ADD.'" >
  431. <input class="submitDate" name="AnnulerInsertCrawler" type="submit" value="'.$MSG_CANCEL.'" alt="'.$MSG_CANCEL.'" >
  432. </form>
  433. </TH>
  434. </TR>
  435. </TBODY></TABLE><!-- Rows END --></TD></TR><!-- no footer --></TBODY></TABLE><!-- Data END --><BR>
  436. ';
  437. }
  438. //------ Pour formulaire insert robot permanent -------
  439. if ($_SESSION['Autres_robots'] ) { // Ligne déplacée
  440. //-----------------------------------------------------
  441. $_SESSION['Autres_robots'] = array_unique($_SESSION['Autres_robots']);
  442. @usort($_SESSION['Autres_robots'],"CompareValeurs"); //supprime champ vide
  443. $robots =$_SESSION['Autres_robots'] ;
  444. array_multisort ($robots, SORT_ASC); // Ne fonctionne pas sur tableau session
  445. //si jour mois est vide, si mois jour est vide
  446. $show_page_os_nav_robots .= '<tr><td nowrap colspan=5><Strong><center><br>'.$MSG_ROBOTS_DETAILS.' '.$when.$mois.'</center></strong><br>';
  447. for($i=0;$i<count($robots);$i++){
  448. //echo '['.$_SESSION['Autres_robots'][$i].']<br>';
  449. $show_page_os_nav_robots .= '['.$robots[$i].']<br>';
  450. }
  451. $show_page_os_nav_robots .= '</td></tr>';
  452. } else {
  453. $show_page_os_nav_robots .= "<strong><big><font color=#FF0000>Aucun robot inconnu ? ajouter.</font></big></strong>";
  454. }
  455. //-------------------------------------------------------------------------
  456. $show_page_os_nav_robots .= '
  457. </table>
  458. <br>
  459. ';
  460. }
  461. #################################################################################################################################
  462. ############################## OS ou Browser non déterminés ################################### -->
  463. if ($Autres_OS_brower[0] && $AfficheOS==true) {
  464. $show_page_os_nav_robots .= '
  465. <br>
  466. <TABLE CELLPADDING=1 CELLSPACING=0 class=TABLEBORDER>
  467. <TBODY>
  468. <TR>
  469. <TD><!-- Data BEGIN -->
  470. <TABLE CELLPADDING=5 CELLSPACING=0 class=TABLEFRAME><!-- header -->
  471. <TBODY>
  472. <TR>
  473. <TH class=TABLETITLE><'.$MSG_ROBOTS_OS_BROWSER_NOTKNOW.'</TH>
  474. </TR>
  475. <TR>
  476. <TD colSpan=2><!-- Rows BEGIN -->
  477. <TABLE border=1 CELLPADDING=2 CELLSPACING=0 class=TABLEDATA>
  478. <TBODY>
  479. <tr><td nowrap>';
  480. //$Autres_OS_brower = remove_dups($Autres_OS_brower, 0); // Supprime les doublons d'un tab multi
  481. $Autres_OS_brower = array_unique($Autres_OS_brower);
  482. @usort($Autres_OS_brower,"CompareValeurs");
  483. for($i=0;$i<count($Autres_OS_brower);$i++){
  484. $show_page_os_nav_robots .= '['.$Autres_OS_brower[$i].']<br>';
  485. }
  486. $show_page_os_nav_robots .= '</td></tr>
  487. </TBODY></TABLE><!-- Rows END --></TD></TR><!-- no footer --></TBODY></TABLE><!-- Data END --></TD></TR></TBODY></TABLE><br>
  488. ';
  489. }
  490. //<!-- ############################## Bad user agent ################################### -->
  491. if ($bad_user_agent) {
  492. $show_page_os_nav_robots .= '
  493. <TABLE CELLPADDING=1 CELLSPACING=0 class=TABLEBORDER>
  494. <TBODY>
  495. <TR>
  496. <TD><!-- Data BEGIN -->
  497. <TABLE CELLPADDING=5 CELLSPACING=0 class=TABLEFRAME><!-- header -->
  498. <TBODY>
  499. <TR>
  500. <TH class=TABLETITLE>'.$MSG_BAD_USER_AGENT.'</TH>
  501. </TR>
  502. <TR>
  503. <TD colSpan=2><!-- Rows BEGIN -->
  504. <TABLE border=1 CELLPADDING=2 CELLSPACING=0 class=TABLEDATA>
  505. <TBODY>
  506. <TR>
  507. <TH WIDTH=40%>'.$MSG_USER_AGENT.'</TH>
  508. <TH>'.$MSG_ROBOTS_NB_PAGE_SCAN.'</TH>
  509. <TH>'.$MSG_NB_DISTINCT_IP.'</TH>
  510. <TH>'.$MSG_COMMENTS.'</TH>
  511. </TR>
  512. ';
  513. //$bad_user_agent = remove_dups($bad_user_agent, 0); // Supprime les doublons d'un tab multi
  514. @usort($bad_user_agent,"CompareValeurs");
  515. for($i=0;$i<count($bad_user_agent);$i++){
  516. if ($bad_user_agent[$i][4]== 'S') {
  517. $show_page_os_nav_robots .= '<tr><td><font color = #FF0000>'.$bad_user_agent[$i][0].'</font></td><td align=center>'.$bad_user_agent[$i][1].'</td><td align=center>'.$bad_user_agent[$i][2].'</td><td>'.$bad_user_agent[$i][3].'</td></tr>';
  518. } else {
  519. $show_page_os_nav_robots .= '<tr><td>'.$bad_user_agent[$i][0].'</td><td align=center>'.$bad_user_agent[$i][1].'</td><td align=center>'.$bad_user_agent[$i][2].'</td><td>'.$bad_user_agent[$i][3].'</td></tr>';
  520. }
  521. }
  522. $show_page_os_nav_robots .= '
  523. </TBODY></TABLE><!-- Rows END --></TD></TR><!-- no footer --></TBODY></TABLE><!-- Data END --></TD></TR></TBODY></TABLE><BR>
  524. ';
  525. }
  526. echo $show_page_os_nav_robots;
  527. ?>