All pastes #984139 Raw Edit

Mine

public text v1 · immutable
·published 2008-04-13 23:18 UTC
rendered paste body
<?php

if (!defined('in_tt-admin')) {

	die ("Hacking Attempt!");

}

?>
				<div class="page-block">

					<div class="header">

						<h2>Site Analytics</h2>

					</div>

					<div class="contents">
<?php


    $total = 0;
    $os = array( 'Linux' => 0, 'Windows' => 0, 'BSD' => 0 );
    $ua = array( 'MSIE 7' => 0, 'MSIE 6' => 0, 'MSIE 5' => 0, 'Firefox' => 0, 'Opera' => 0, 'Konqueror' => 0, 'Safari'  => 0 );
    
    // Acquire the total
    if( $r = $db->query( "SELECT COUNT(*) AS num FROM `" . $config->database[ 'prefix' ] . "browsers`" ) ) {
        $r = mysql_fetch_array( $r );
        $total = intval( $r[0] );
    }
    
    foreach( $os as $k => $v ) {
        if( $r = $db->query( "SELECT COUNT(*) AS num FROM `" . $config->database[ 'prefix' ] . "browsers` WHERE agent LIKE '%" . $k . "%'" ) ) {
            $r = mysql_fetch_array( $r );
            $os[ $k ] = intval( $r[0] );
        }
    }

    foreach( $ua as $k => $v ) {
        if( $r = $db->query( "SELECT COUNT(*) AS num FROM `" . $config->database[ 'prefix' ] . "browsers` WHERE agent LIKE '%" . $k . "%'" ) ) {
            $r = mysql_fetch_array( $r );
            $ua[ $k ] = intval( $r[0] );
        }
    }
    

    // Print the above statistics.
    print( $total.'<br />' );

    ?>
<?php print ceil($os['Linux']/$total*100); ?>% of users are using Linux<br />
<?php print ceil($os['Windows']/$total*100); ?>% of users are using Windows<br />
<?php print ceil($os['BSD']/$total*100); ?>% of users are using BSD<br />
<br />
<?php print ceil($ua['MSIE 7']+$ua['MSIE 6']+$ua['MSIE 5']/$total*100); ?>% of users are using Microsoft Internet Explorer<br />
<?php print ceil($ua['Firefox']/$total*100); ?>% of users are running Mozilla Firefox<br />
<?php print ceil($ua['Opera']/$total*100); ?>% of users are using Opera<br />
<?php print ceil($ua['Konqueror']/$total*100); ?>% of users are running Konqueror<br />
<?php print ceil($ua['Safari']/$total*100); ?>% of users are running Safari<br />
    <?php
    //print_r( $os );
    
   // print_r( $ua );
?>
					</div>
				</div>