/* Short and sweet */
session_start();
function alexa($url)
{
$url="http://".$url;
$domain = "http://data.alexa.com";
$keylength = 14; // the resulting length of the keyid. 14 and 15 were seen in the wild.
if (isset($_SESSION['alexa_keyid'])) $keyid = $_SESSION['alexa_keyid'];
else
{
$keyid = substr(str_shuffle("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"),0,$keylength);
$_SESSION['alexa_keyid'] = $keyid;
}
$cli = "10"; // ???
$dat = "snba"; // ???
$ver = "7.2"; // version number of toolbar?
$cdt = "alx_vw"; // ???
$wid = rand(0,32767); // appears to be a random integer initiated when the browser starts.
$act = "00000000000"; // ???
if(isset($_SESSION['screen_size'])) $ss=$_SESSION['screen_size'];
else
{
$ssarray = array ("800x800", "1024x768", "1280x768", "1280x800","1280x1024", "1600x1200", "1680x1050", "1920x1200");
shuffle($ssarray);
$ss = $ssarray[0]; // browser screensize. Resulting value is chosen at random from an array of values.
$_SESSION['screen_size']=$ss;
}
$bw = "1523"; // bandwidth? probably used in calculating metrics related to visitor connection speeds (noted values are close to common
// connection speeds like 768k, 1mb, 1.5mb, etc.)
$t = "0"; // ???
$ttl = rand(200,1000); // time-to-live? probably used in calculating average load times
$vis = "1"; // ???
if(isset($_SESSION['tb_request']))
{
$rq=$_SESSION['tb_request']+1;
$_SESSION['tb_request']=$rq;
}
else
{
$rq = rand(15,80); // appears to increment with each toolbar request
$_SESSION['tb_request']=$rq;
}
$params="/data/".$keyid."?cli=".$cli."&dat=".$dat."&ver=".$ver."&cdt=".$cdt."&wid=".$wid."&act=".$act."&ss=".$ss."&bw=".$bw."&t=".$t."&ttl=".$ttl."&vis=".$vis."&rq=".$rq."&url=".$url;
return $domain.$params;
}
======================================================================================
Footer
<?="<img src='".alexa($_SERVER['HTTP_HOST'])."' height='0' width='0'>";?>