Tiles@home stats

Cached, age %d sec

\n", $Age); return; } print "

Regenerating stats, this will take a while...

\n"; flush(); ob_start(); include("../connect/connect.php"); TileStats(); InterestingTiles(); PeopleStats(); $Data = ob_get_contents(); ob_end_clean(); $fp = fopen($Filename, "w"); if($fp){ fputs($fp, $Data); fclose($fp); } else { print "

error writing to cache file

\n"; } } function PeopleStats(){ $SQL = "SELECT user, count(*) as count FROM tiles WHERE `exists`=1 GROUP BY user ORDER BY count desc;"; $Result = mysql_query($SQL); if(mysql_error()){ printf("

%s

\n", htmlentities(mysql_error())); return; } print "

Uploaders

\n"; if(mysql_num_rows($Result) < 1) { print "

None

\n"; return; } print ""; $Count = 1; while($Data = mysql_fetch_assoc($Result)){ printf("", $Count++, $Data["user"], $Data["count"]); } print "
%d%s%d tiles
\n"; } function TileStats(){ $SQL = "SELECT z, count(*) as count FROM tiles WHERE `exists`=1 GROUP BY z ORDER BY z;"; $Result = mysql_query($SQL); if(mysql_error()){ printf("

%s

\n", htmlentities(mysql_error())); return; } print "

Tiles available

\n"; if(mysql_num_rows($Result) < 1) { print "

None

\n"; return; } print "\n"; while($Data = mysql_fetch_assoc($Result)){ $Z = $Data["z"]; if($Z > 0 && $Z < 20){ $MaxTiles = pow(4, $Z); if($MaxTiles>0) $PercentDone = 100 * $Data["count"] / $MaxTiles; else $PercentDone = 0; printf("\n", $Z, $Data["count"], $PercentDone); } } print "
Zoom-%d:%d tiles%1.3f%%
\n"; } function InterestingTiles(){ print "

Interesting tilesets

\n"; $SQL = "select `x`,`y`,`z`,`size` from `tiles` where `exists`=1 and `z`=12 and `size`>50000 order by `size` desc limit 30;"; $Results = mysql_query($SQL); if(mysql_num_rows($Results)){ print ""; while($Data = mysql_fetch_assoc($Results)){ $Link = sprintf("../Browse/?x=%d&y=%d&z=%d", $Data["x"], $Data["y"], $Data["z"]); printf("\n", $Link, $Data["x"], $Data["y"], $Data["z"], $Data["size"] / 1024); } print "
%d,%d,%d%1.1fK
\n"; } } ?>