Exemplo n.º 1
0
<blockquote>Welcome to the TestSwarm Alpha! Please be aware that TestSwarm is still under heavy testing and during this alpha period data may be lost or corrupted and clients may be unexpectedly disconnected. More information about TestSwarm can be found <a href="http://wiki.github.com/jquery/testswarm">on the TestSwarm wiki</a>.</blockquote>
<?php
  $found = 0;

  loadBrowsers("Desktop Browsers", 0);
  loadBrowsers("Mobile Browsers", 1);

if ( false ) {

	echo '<br style="clear: both;"><div class="scores"><h3>High Score Board</h3><table class="scores">';

	$result = mysql_queryf("SELECT users.name, SUM(total) as alltotal FROM clients, run_client, users WHERE clients.id=run_client.client_id AND clients.user_id=users.id  GROUP BY user_id ORDER by alltotal DESC LIMIT 10;");

	$num = 1;

	while ( $row = mysql_fetch_array($result) ) {
		$user = $row[0];
		$total = $row[1];

		echo '<tr><td class="num">' . $num . '</td><td><a href="' . swarmpath( "user/$user/" ) . '">' . $user . '</a></td><td class="num">' . $total . '</td></tr>';
		$num++;
	}

	echo '</table><p class="right"><a href="' . swarmpath( "scores/" ) . '">All Scores...</a></p><h3>Rarest Browsers</h3><table class="scores">';

	$result = mysql_queryf("SELECT name, SUM(runs) as allruns FROM run_useragent, useragents WHERE run_useragent.useragent_id=useragents.id GROUP BY name ORDER BY allruns LIMIT 10;");

	$num = 1;

	while ( $row = mysql_fetch_array($result) ) {
		$name = $row[0];
Exemplo n.º 2
0
<blockquote>Welcome to the TestSwarm Alpha! Please be aware that TestSwarm is still under heavy testing and during this alpha period data may be lost or corrupted and clients may be unexpectedly disconnected. More information about TestSwarm can be found <a href="http://wiki.github.com/jeresig/testswarm">on the TestSwarm wiki</a>.</blockquote>
<?php 
$found = 0;
loadBrowsers("xp");
loadBrowsers("vista");
loadBrowsers("win7");
loadBrowsers("osx10.4");
loadBrowsers("osx10.5");
echo "<br style='clear:both;'/>";
loadBrowsers("osx10.6");
loadBrowsers("osx");
loadBrowsers("linux");
loadBrowsers("2000");
loadBrowsers("2003");
echo "<br style='clear:both;'><div class='scores'><h3>High Score Board</h3><table class='scores'>";
$result = mysql_queryf("SELECT users.name, SUM(total) as alltotal FROM clients, run_client, users WHERE clients.id=run_client.client_id AND clients.user_id=users.id  GROUP BY user_id ORDER by alltotal DESC LIMIT 10;");
$num = 1;
while ($row = mysql_fetch_array($result)) {
    $user = $row[0];
    $total = $row[1];
    echo "<tr><td class='num'>{$num}</td><td><a href='" . $GLOBALS['contextpath'] . "/user/{$user}/'>{$user}</a></td><td class='num'>{$total}</td></tr>";
    $num++;
}
echo "</table><p class='right'><a href='" . $GLOBALS['contextpath'] . "/scores/'>All Scores...</a></p><h3>Rarest Browsers</h3><table class='scores'>";
$result = mysql_queryf("SELECT name, SUM(runs) as allruns FROM run_useragent, useragents WHERE run_useragent.useragent_id=useragents.id GROUP BY name ORDER BY allruns LIMIT 10;");
$num = 1;
while ($row = mysql_fetch_array($result)) {
    $name = $row[0];
    echo "<tr><td class='num'>{$num}</td><td>{$name}</td></tr>";
    $num++;
}
Exemplo n.º 3
0
/**
 * @author Sebastien Piraux <*****@*****.**>
 * @desc uses $TABLETRACK_OPEN to split recorded
     information, to count occurences (for os, provider,...)
     and to increment the number of occurrences of each
     different element into the corresponding tables
 */
function decodeOpenInfos() {
    global $TABLETRACK_OPEN;
    // record initial value of ignore_user_abort
    $ignore = ignore_user_abort();
    // prevent script from being stopped while executing, the following can be considered
    // as a transaction
    ignore_user_abort(1) ;
    // we take the last event id to prevent miss of some recorded event
    // only processed record have to be cleaned

    $sql = "SELECT open_id
                FROM $TABLETRACK_OPEN
                WHERE open_date <= NOW()
                ORDER BY open_id DESC
                LIMIT 1";
    //$processBegin = getOneResult($sql);
    $query = Database::query($sql);
    $res = @Database::fetch_array($query);
    $processBegin = $res[0];
    // process

    //--Providers And Countries-------------------------------------------//

     $sql = "SELECT open_remote_host
                FROM $TABLETRACK_OPEN
                WHERE   open_remote_host != ''
                AND     open_id <= '".$processBegin."' ";
    $query = Database::query($sql);

    if(Database::num_rows($query) != 0) {
    	// load list of countries
    	$list_countries = loadCountries();

       	while ($row = Database::fetch_row ($query)) {
            $remote_host = $row[0];
            /*****Provider*****/
            //extract provider
            $provider = extractProvider( $remote_host );
            // add or increment provider in the providers array
            $providers_array = addProvider( $provider,$providers_array );

            /*****Countries*****/
            // extract country
            $country = extractCountry( $remote_host, $list_countries );
            // increment country in the countries table
            $countries_array = addCountry( $country, $countries_array );
        }
        // update tables
    	fillProvidersTable( $providers_array );
    	fillCountriesTable( $countries_array );
    }
    // provider and countries done
    //--Browsers and OS---------------------------------------------------//
    $sql = "SELECT open_agent
                FROM $TABLETRACK_OPEN
                WHERE   open_remote_host != ''
                AND     open_id <= '".$processBegin."' ";
    $query =Database::query( $sql );
    if(Database::num_rows($query) != 0) {
    	// load lists
        // of browsers
        $list_browsers = loadBrowsers();
        // of OS
        $list_os = loadOs();
        while ($row = Database::fetch_row ($query)) {
            $agent = $row[0];
            /*****Browser and OS*****/
            // extract browser and OS
            list( $browser,$os ) = split( "[|]",extractAgent( $agent , $list_browsers , $list_os ) );
            // increment browser and OS in the corresponding arrays
            $browsers_array = addBrowser( $browser , $browsers_array );
            $os_array = addOs( $os , $os_array );
        }
        fillBrowsersTable( $browsers_array );
    	fillOsTable( $os_array );
    }
    // browsers and OS done

    //--Referers----------------------------------------------------------//

    $sql = "SELECT open_referer
                FROM $TABLETRACK_OPEN
                WHERE	open_referer != ''
                AND 	open_id <= '".$processBegin."' ";
    $query = Database::query( $sql );

    if(Database::num_rows($query) != 0) {
    	$i=0;
    	while ($row = Database::fetch_row ($query)) {
    		$ref = $row[0];
    		$referers_array = addReferer( $ref , $referers_array );
    	}
    	fillReferersTable( $referers_array );
    }
    // referers done
    //-------------------------------------------------------------------//
    // end of process
    // cleaning of $TABLETRACK_OPEN table
    cleanProcessedRecords($processBegin);
    // reset to the initial value
    ignore_user_abort($ignore);
}