All pastes #983112 Raw Edit

Miscellany

public php v1 · immutable
·published 2008-04-13 01:34 UTC
rendered paste body
<?phpif (!defined('in_tt-admin')) {	die ("Hacking Attempt!");}?>				<div class="page-block">					<div class="header">						<h2>Site Analytics</h2>					</div>					<div class="contents">						<?php						$result = $db->query("SELECT * FROM `".$config->database['prefix']."browsers` ORDER BY id"); // Query.						$total = mysql_num_rows($result); // Total rows.												/******************************						 Browser Statistics						******************************/												// Define some variables that will do a lot of the math.						$msie = 0;						$firefox = 0;						$opera = 0;						$other = 0;												// Other string variables						$msie7_string = "MSIE 7";						$msie6_string = "MSIE 6";						$msie5_string = "MSIE 5";						$firefox_string = "Firefox";						$opera_string = "Opera";												/******************************						 Operating System Statistics						******************************/						// Define some variables that will do a lot of the math.						$windows = 0;						$linux = 0;						$bsd = 0;						$otheros = 0;												// Other string variables						$windows_string = "Windows";						$linux_string = "Linux";						$bsd_string = "BSD";												// Here we go ... gotta count up the tally!						while($user = mysql_fetch_array($result)) {							$check = strpos($user['agent'], $msie7_string);							$check = strpos($user['agent'], $msie6_string);							$check = strpos($user['agent'], $msie5_string);							if ($check !== false) {								$msie++;							} else {								$check = strpos($user['agent'], $firefox_string);								if ($check !== false) {									$firefox++;								} else {									$check = strpos($user['agent'], $opera_string);									if ($check !== false){										$opera++;									} else {										$other++;									}								}							}														//browser tally							$check = strpos($user['agent'], $windows_string);							if ($check !== false) {								$windows++;							} else {								$check = strpos($user['agent'], $linux_string);								if ($check !== false) {									$linux++;								} else {									$check = strpos($user['agent'], $bsd_string);									if ($check !== false){										$bsd++;									} else {										$otheros++;									}								}							}						}												// Now we do some tough mathmatical calculations.						$msiefinal = ceil($msie/$total*100);						$firefoxfinal = ceil($firefox/$total*100);						$operafinal = ceil($opera/$total*100);						$otherfinal = ceil($other/$total*100);												// Now we echo the data!						echo "<b>".$msiefinal."%</b> of visitors are using Microsoft Internet Explorer&nbsp;&nbsp;&nbsp;&nbsp;<i>(".$msie." out of ".$total." visitors)</i><br />";						echo "<b>".$firefoxfinal."%</b> of visitors are using Mozilla Firefox&nbsp;&nbsp;&nbsp;&nbsp;<i>(".$firefox." out of ".$total." visitors)</i><br />";						echo "<b>".$operafinal."%</b> of visitors are using Opera&nbsp;&nbsp;&nbsp;&nbsp;<i>(".$opera." out of ".$total." visitors)</i><br />";						echo "<b>".$otherfinal."%</b> of visitors are using other browsers&nbsp;&nbsp;&nbsp;&nbsp;<i>(".$other." out of ".$total." visitors)</i>";												echo "<br /><br />";																		// Now we do some tough mathmatical calculations.						$windowsfinal = ceil($windows/$total*100);						$linuxfinal = ceil($linux/$total*100);						$bsdfinal = ceil($bsd/$total*100);						$otherosfinal = ceil($otheros/$total*100);												// Now we echo the data!						echo "<b>".$windowsfinal."%</b> of visitors are using Microsoft Windows&nbsp;&nbsp;&nbsp;&nbsp;<i>(".$windows." out of ".$total." visitors)</i><br />";						echo "<b>".$linuxfinal."%</b> of visitors are using Linux&nbsp;&nbsp;&nbsp;&nbsp;<i>(".$linux." out of ".$total." visitors)</i><br />";						echo "<b>".$bsdfinal."%</b> of visitors are using BSD/Unix&nbsp;&nbsp;&nbsp;&nbsp;<i>(".$bsd." out of ".$total." visitors)</i><br />";						echo "<b>".$otherosfinal."%</b> of visitors are using other operating systems&nbsp;&nbsp;&nbsp;&nbsp;<i>(".$otheros." out of ".$total." visitors)</i>";																								?>					</div>				</div>