Fridge magnets
On one fridge in the north part of Ljubljana, there were these magnets of "Little number two" (Pikku kakkonen), which is a TV program for children in Finland, coming from the channel two.

Flash version fetcher

Many times webmasters want to have a log of the visitors. Often this log should have

details of the browsers capabilities. For those who work with Flash, it might be important to

know the Flash player version of the visitor. This information could be used as a basis for

the future development, to give suitable content for the visitor or for any other reason.

In server side, it is possible to fetch information of certain browsers, but unfortunately this information is based on a list which has all the details of those browser. Although the server side script can be aware of the browser which the visitor is using, it is usually not enough. As you know, user has the power to choose which plugins to use and which not.

One approach to know which version of Flash player the visitor has, is defined in this document. This is done after the user has loaded the Flash file and thus have a Flash player plugin installed.

var url:String = "flashver.php";
var dat:Array = System.capabilities.version.split(" ");
dat = dat[dat.length - 1].split(",");
var ver:String = dat.join(".");
if (System.capabilities.isDebugger) {
    ver += " debug";
}
trace(ver);
var receiver:LoadVars = new LoadVars();
receiver.onLoad = function(success:Boolean) {
    if (success) {
        // Succeeded
        trace(this.result);
    }
    else {
        // Failed
    }
};
var sender:LoadVars = new LoadVars();'

In this example PHP script, it is assumed that you have MySQL database where is table

called “visitors” having at least columns “id” and “flash”.

<?php
header('Content-type: text/plain; charset=UTF-8');
if (isset($_POST['version']) && $_POST['version'] != '') {
    // Open a connection to the database server
    $link = mysql_connect('localhost', 'username', 'password');
    if (!$link) die('result=0');
    // Choose database
    $datab = mysql_select_db('database', $link);
    if (!$datab) die('result=1');
    $sql = 'UPDATE visitors
        SET flash = \''.$_POST['version'].'\'
        WHERE id = \''.session_id().'\' LIMIT 1';
    $run = mysql_query($sql, $link);
    if ($run) {
        echo 'result=2';
    }
    else {
        echo 'result=3';
    }
}
else {
    echo 'result=4';
}
?>

Result values:

  • 0 Could not connect to the database
  • 1 Unable to use the database
  • 2 Version received and row updated
  • 3 Version received, but no row updated
  • 4 Version info not received