PageRenderTime 148ms CodeModel.GetById 34ms app.highlight 61ms RepoModel.GetById 29ms app.codeStats 1ms

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