to http://www.khazgoroth.de/modules/cjayco ... x.php?id=7
Someone over at EU - Khazgoroth has coded up this nice page for his server! Very sharp! Hopefully he'll post here soon so others can possibly use his handiwork!
Nice server specific charts
Nice server specific charts
phpbb:phpinfo()
The creator of this page emailed me the code to share! Here you go:
--------------------------------------------------------------------------------
Realm-Census with graphical output
code by Dan - for questions and suggestions please [email protected]
--------------------------------------------------------------------------------
DEMO: http://www.daniel-cron.de/census/census.php
SCRIPT and FILES: http://www.daniel-cron.de/census/census.zip
First of all, i`m an Flash-Actor an not an PHP-Expert, so this whole thing might be codes much clearer and faster.
But as i`m learning PHP at this time i started coding as i thought i might work.
And it works. *g*
All needed Files are Included in the census.zip.
Simply extract all files to a Folder of your webspace.
FOR GETTING THE UPDATES OF THE SOURCE FILE, YOU NEED TO CHMOD 666 THE FOLLOWING FILES:
--> status.txt
--> kgroster.csv
This Census-Code is for the EU Khaz`goroth Realm, its getting an Update 1 time a Day.
To show the Census of Your Realm, you have to change the Source-Census-File.
You can find it at about line 140 in the census-php, simply look for:
$filename = "http://www.warcraftrealms.com/exports/d ... oth.csv.gz";
and change it to the URL of your census file. You can find a list of all URLS at
http://www.warcraftrealms.com/dataexport.php .
My census shows Race and Class Names in German. If you need it in other languages, search the code for the german
Names - But ONLY in the HTML-ECHO part. Normally its simply to find.
Last but not least, if you find this Script useful and you use it on your page, plase mail me the URL of your Site.
So i can inform you, if i change something on my code or i build an new version.
Greeting,
Dan from EU-Khaz'Goroth,
Admin of www.khazgoroth.de
-----------------------------------------------------------------------------------
The Code - Save it in a single .php file !!!
-----------------------------------------------------------------------------------
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>WoW Server-Census - sponsored by WarcraftRealms.com</title>
<meta name='keywords' content='world of warcraft, warcraft, warcraft census, warcraft realm, warcraft realms, world, wow, wow census, wow realm, wow realms, bloodscalp'>
<meta name='description' content='World of Warcraft Census Information and Data'>
</head>
<style type='text/css'>td.bar0{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg0{ width:40px;}</style>
<style type='text/css'>td.bar1{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg1{ width:40px;}</style>
<style type='text/css'>td.bar2{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg2{ width:40px;}</style>
<style type='text/css'>td.bar3{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg3{ width:40px;}</style>
<style type='text/css'>td.bar4{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg4{ width:40px;}</style>
<style type='text/css'>td.bar5{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg5{ width:40px;}</style>
<style type='text/css'>td.bar6{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg6{ width:40px;}</style>
<style type='text/css'>td.bar7{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg7{ width:40px;}</style>
<style type='text/css'>td.class_bar0{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img0{ width:40px;}</style>
<style type='text/css'>td.class_bar1{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img1{ width:40px;}</style>
<style type='text/css'>td.class_bar2{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img2{ width:40px;}</style>
<style type='text/css'>td.class_bar3{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img3{ width:40px;}</style>
<style type='text/css'>td.class_bar4{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img4{ width:40px;}</style>
<style type='text/css'>td.class_bar5{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img5{ width:40px;}</style>
<style type='text/css'>td.class_bar6{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img6{ width:40px;}</style>
<style type='text/css'>td.class_bar7{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img7{ width:40px;}</style>
<style type='text/css'>td.class_bar8{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img8{ width:40px;}</style>
<style type='text/css'>td.innertopleft{background-image: url(inner-top-left.gif); width: 20px;}</style>
<style type='text/css'>td.innertop{background-image: url(inner-top.gif); height: 20px;}</style>
<style type='text/css'>td.innertopright{background-image: url(inner-top-right.gif); width: 20px;}</style>
<style type='text/css'>td.innerleft{background-image: url(inner-left.gif); width: 20px;}</style>
<style type='text/css'>td.innerright{background-image: url(inner-right.gif); width: 20px;}</style>
<style type='text/css'>td.innerbottomleft{background-image: url(inner-bottom-left.gif); width: 20px;}</style>
<style type='text/css'>td.innerbottom{background-image: url(inner-bottom.gif); height: 20px;}</style>
<style type='text/css'>td.innerbottomright{background-image: url(inner-bottom-right.gif); width: 20px;}</style>
<style type='text/css'>table.censusinfo{background-image: url(newsback.gif);}</style>
<style type='text/css'>td.levelbar{vertical-align: bottom; padding: 1px;}</style>
<style type='text/css'>td.category{font-family: Verdana; color: #000000; font-size: 10px;}</style>
<style type='text/css'>body{ background-image:url(hintergrund.jpg); font-family: Verdana; color: #000000; font-size: 10px; }</style>
<body>
<?php
// -------------------------------------------------------------------------------
// CHECKING STATUS FILE AND GETTING NEW CENSUS DATA, IF NEWER FILE EXISTS
// -------------------------------------------------------------------------------
// Remember to check the status file so that you are not pulling data
// more than once per day
//
$localstatusfile = "status.txt";
$infile = fopen ($localstatusfile, "r");
$current_timestamp = 0;
if (!$infile)
{
echo "<p>No status file available, assuming this is the first run<br>";
}
else
{
// read our status file time
$buffer = fgets($infile, 4096);
$current_timestamp = trim( $buffer );
// Output of last Update on top if the page
echo '<p align="center">Letzte Aktualisierung: ' . strftime("%m/%d/%y %H:%M:%S",$current_timestamp) . '</p><br>';
}
fclose( $infile ); // close our local status file
$filename = "http://www.warcraftrealms.com/exports/status.txt";
$infile = fopen ($filename, "r"); // open remote status file
if (!$infile)
{
echo "<p>Unable to open status file.<br>";
exit;
}
$remote_timestamp = 0;
if(!feof ($infile)) // only 1 read should be needed for the status file
{
$buffer = fgets($infile, 4096);
$remote_timestamp = trim( $buffer );
// Output of last Update of the original Census File. Not needed, if code is working. maybe god for Update-Testing
// echo '<p align="center">Originale Census Datenfile: ' . strftime("%m/%d/%y %H:%M:%S",$remote_timestamp) . '</p><br>';
}
fclose( $infile ); // close the remote status file
if( $remote_timestamp - $current_timestamp > 86400 ) // 1 day = 60*60*24
{
//
// We can do a full get
//
// write our new status file
$outfilename = "status.txt";
$outfile = fopen($outfilename, "w");
if( !$outfile )
{
echo "<p>Unable to open save file => " . $outfilename . "<br>";
exit;
}
fputs($outfile, $buffer);
fclose($outfile);
//
// Now get our guild roster file
//
// -------------------------------------------------------------------------------
// REPLACE THE URL FOR YOUR REALM FILE
$filename = "http://www.warcraftrealms.com/exports/download.php?fname=EU-Khaz'goroth.csv.gz";
// -------------------------------------------------------------------------------
$infile = gzopen ($filename, "r");
if (!$infile)
{
echo "<p>Unable to open remote file.<br>\n";
exit;
}
$outfilename = "kgroster.csv"; // Local filename for downloaded Census Data - Normaly no need to change
$outfile = fopen($outfilename, "w");
if( !$outfile )
{
echo "<p>Unable to open save file => " . $outfilename . "<br>\n";
exit;
}
while (!feof ($infile))
{
$buffer = fgets($infile, 4096);
fputs($outfile, $buffer);
}
fclose($outfile);
fclose($infile);
}
// -------------------------------------------------------------------------------
// Data download and checking is now done. Now the Data-Processing can begin.
// -------------------------------------------------------------------------------
$filename = "kgroster.csv";
$infile = fopen ($filename, "r");
if (!$infile)
{
echo "<p>Unable to open local roster file.<br>";
exit;
}
// do one read to get the header
$buffer = fgets($infile, 4096);
$lines = 0;
// read the entries
while (!feof ($infile))
{
$buffer = fgets($infile, 4096);
list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",",$buffer);
$lines = $lines + 1;
}
//-------------DANS SCRIPT --------------------------------
// declaring main vars
$horde = 0;
$alliance = 0;
$allianceprozent = 0;
$hordeprozent = 0;
$allianceratio = 0;
$horderatio = 0;
$druid = 0;
$hunter = 0;
$mage = 0;
$paladin = 0;
$priest = 0;
$rogue = 0;
$shaman = 0;
$warlock = 0;
$warrior = 0;
// declaring sub-vars and vars with Strings of the Races and classes
$rasse = array(dwarf, gnome, human, nightelf, orc, tauren, troll, undead);
$rassecaps = array("Dwarf", "Gnome", "Human", "Night Elf", "Orc", "Tauren", "Troll", "Undead");
$rassedeutsch = array(Zwergen, Gnomen, Menschen, Nachtelfen, Ork, Tauren, Troll, Untoten);
$klasse = array(druid, hunter, mage, paladin, priest, rogue, shaman, warlock, warrior);
for ($i = 0; $i <= 7; $i++) {
${$rasse[$i]} = 0;
${$rasse[$i].druid} = 0;
${$rasse[$i].hunter} = 0;
${$rasse[$i].mage} = 0;
${$rasse[$i].paladin} = 0;
${$rasse[$i].priest} = 0;
${$rasse[$i].rogue} = 0;
${$rasse[$i].shaman} = 0;
${$rasse[$i].warlock} = 0;
${$rasse[$i].warrior} = 0;
${$rasse[$i].unknown} = 0;
${$rasse[$i].prozent} = 0;
}
$csv = file_get_contents("kgroster.csv");
$csv = explode("\n",$csv);
$count = 0 ; // Z?hlt durch bis Ende Hauptarray
while ($count <= $lines)
{
$csv[$count] = explode(",",$csv[$count]);
//-----------Allianz Horde---------------
if ($csv[$count][1] == "Alliance") {
$alliance = $alliance + $csv[$count][5];
} else {
$horde = $horde + $csv[$count][5];
}
//---------------------------------------
for ($i = 0; $i <= 7; $i++) {
// cycle through all races
if ($csv[$count][2] == $rassecaps[$i]) {
// cycle through all classes of a race and add the number of class-race-chars to the class-racespecific countervar
${$rasse[$i]} = ${$rasse[$i]} + $csv[$count][5];
if ($csv[$count][3] == "Druid") {
${$rasse[$i].druid} = ${$rasse[$i].druid} + $csv[$count][5];
} elseif ($csv[$count][3] == "Hunter") {
${$rasse[$i]."hunter"} = ${$rasse[$i]."hunter"} + $csv[$count][5];
} elseif ($csv[$count][3] == "Mage") {
${$rasse[$i].mage} = ${$rasse[$i].mage} + $csv[$count][5];
} elseif ($csv[$count][3] == "Paladin") {
${$rasse[$i].paladin} = ${$rasse[$i].paladin} + $csv[$count][5];
} elseif ($csv[$count][3] == "Priest") {
${$rasse[$i].priest} = ${$rasse[$i].priest} + $csv[$count][5];
} elseif ($csv[$count][3] == "Rogue") {
${$rasse[$i].rogue} = ${$rasse[$i].rogue} + $csv[$count][5];
} elseif ($csv[$count][3] == "Shaman") {
${$rasse[$i].shaman} = ${$rasse[$i].shaman} + $csv[$count][5];
} elseif ($csv[$count][3] == "Warlock") {
${$rasse[$i].warlock} = ${$rasse[$i].warlock} + $csv[$count][5];
} elseif ($csv[$count][3] == "Warrior") {
${$rasse[$i].warrior} = ${$rasse[$i].warrior} + $csv[$count][5];
} else {
${$rasse[$i].unknown} = ${$rasse[$i].unknown} + $csv[$count][5];
}
// add the levels of a race to a race-level array
$levelhelper = $csv[$count][4];
${$rasse[$i].level}[$levelhelper] = ${$rasse[$i].level}[$levelhelper] + $csv[$count][5];
} else {
}
}
$count = $count + 1;
}
// sum all race-class-chars to a single race variable
for ($i = 0; $i <= 7; $i++) {
$druid = $druid + ${$rasse[$i].druid};
$hunter = $hunter + ${$rasse[$i].hunter};
$mage = $mage + ${$rasse[$i].mage};
$paladin = $paladin + ${$rasse[$i].paladin};
$priest = $priest + ${$rasse[$i].priest};
$rogue = $rogue + ${$rasse[$i].rogue};
$shaman = $shaman + ${$rasse[$i].shaman};
$warlock = $warlock + ${$rasse[$i].warlock};
$warrior = $warrior + ${$rasse[$i].warrior};
}
// End of Data reading and writing main arrays.
// -------------------------------------------------------------------------------
// mathematics
// -------------------------------------------------------------------------------
// count all palyers an get the A-H-Ratio
$player = $alliance + $horde;
$allianceprozent = round($alliance / $player * 100);
$hordeprozent = 100 - $allianceprozent;
$allianceratio = round($allianceprozent / $hordeprozent,1);
$horderatio = 1;
// Get all race-Percantages and make a race-multiplier for adequate Ber-Height in the Output-Table
// z.B. dwarfprozent
$rasseprozentmax = 0;
for ($i = 0; $i <= 7; $i++) {
${$rasse[$i].prozent} = round(${$rasse[$i]} / $player * 100);
if (${$rasse[$i].prozent} > $rasseprozentmax) {
$rasseprozentmax = ${$rasse[$i].prozent};
}
}
$rasseprozentmulti = floor(100 / $rasseprozentmax);
// Sum all Classes from Race-Class-counter
for ($j = 0; $j <= 8; $j++) {
${$klasse[$j].prozent} = 0;
for ($i = 0; $i <= 7; $i++) {
${$klasse[$j]} = ${$klasse[$j]} + ${$rasse[$i].$klasse[$j]};
}
}
// Get all Class-Percantages and make a Class-multiplier for adequate Ber-Height in the Output-Table
// z.B. druidprozent
$klasseprozentmax = 0;
for ($i = 0; $i <= 8; $i++) {
${$klasse[$i].prozent} = round(${$klasse[$i]} / $player * 100);
if (${$klasse[$i].prozent} > $klasseprozentmax) {
$klasseprozentmax = ${$klasse[$i].prozent};
}
}
$klasseprozentmulti = floor(100 / $klasseprozentmax);
// Get all race-class-Percantages and make a race-class-multiplier for adequate Ber-Height in the Output-Table
// z.B. drwarfdruidprozent
for ($i = 0; $i <= 7; $i++) {
${$rasse[$i].klasseprozentmax} = 0;
for ($j = 0; $j <= 8; $j++) {
${$rasse[$i].$klasse[$j].prozent} = round(${$rasse[$i].$klasse[$j]} / ${$rasse[$i]} * 100);
if (${$rasse[$i].$klasse[$j].prozent} > ${$rasse[$i].klasseprozentmax}) {
${$rasse[$i].klasseprozentmax} = ${$rasse[$i].$klasse[$j].prozent};
}
}
${$rasse[$i].klasseprozentmulti} = floor(100 / ${$rasse[$i].klasseprozentmax});
}
// get all Race-level-percentages and its multiplier
// rassenlevelprozent
for ($j = 0; $j <= 7; $j++) {
${$rasse[$j].levelprozentmax} = 0;
for ($i = 10; $i <= 60; $i++) {
${$rasse[$j].levelprozent}[$i] = round(${$rasse[$j].level}[$i] / ${$rasse[$j]} * 100,3);
if (${$rasse[$j].levelprozent}[$i] > ${$rasse[$j].levelprozentmax}) {
${$rasse[$j].levelprozentmax} = ${$rasse[$j].levelprozent}[$i];
}
}
${$rasse[$j].levelprozentmulti} = floor(50 / ${$rasse[$j].levelprozentmax});
}
// get all levels from race-levels
for ($j = 10; $j <= 60; $j++) {
$level[$j] = 0;
for ($i = 0; $i <= 7; $i++) {
$level[$j] = $level[$j] + ${$rasse[$i].level}[$j];
}
// echo " Level " . $j . " = " . $level[$j] . " !";
}
// get all level percentages
$levelprozentmax = 0;
for ($i = 10; $i <= 60; $i++) {
$levelprozent[$i] = round($level[$i] / $player * 100,3);
if ($levelprozent[$i] > $levelprozentmax) {
$levelprozentmax = $levelprozent[$i];
}
}
$levelprozentmulti = floor(50 / $levelprozentmax);
// --------------------------------------------------------------------------------------------
// End of Mathematics part. Now all Vars are written an can be used f?r output
// --------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------
// GRAPHICAL OUTPUT BEGINGS.
// --------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------
// First Table with general Stats and Race and class overview, as well as all-chars-levels
// --------------------------------------------------------------------------------------------
echo "<center>
<p> </p>
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID="Table1">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=2></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
<td> <img src=\"kgcensuslogo.jpg\"> </td>
<td>
<table align=\"right\" cellpadding=0 cellspacing=0 class=\"censusinfo\" ID="Table2">
<tr>
<td class=\"category\">Total Characters:</td>
<td class=\"category\"><b>$player</b></td>
</tr>
<tr>
<td class=\"category\">Total Alliance:</td>
<td class=\"category\"><b>$alliance - $allianceprozent %</b></td>
</tr>
<tr>
<td class=\"category\">Total Horde:</td>
<td class=\"category\"><b>$horde - $hordeprozent %</b></td>
</tr>
<tr>
<td class=\"category\">A to H Ratio:</td>
<td class=\"category\"><b>$allianceratio : $horderatio</b></td>
</tr>
</table>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
<td align=\"center\" colspan=2>
<table class=\"censusinfo\" ID="Table3"><tr><td align=\"center\">
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID="Table4">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=8></td><td class=\"innertopright\"></td>
</tr>
<!-- <tr>
<td class=\"innerleft\"></td>
<td align=\"center\" colspan=4>Alliance</td>
<td align=\"center\" colspan=4>Horde</td>
<td class=\"innerright\"></td>
</tr>
--> <tr>
<td class=\"innerleft\" height=100></td>
";
for ($i = 0; $i <= 7; $i++) {
echo "<td class=\"bar" . $i . "\"><img class=\"raceimg" . $i . "\" src='Census_Bar.jpg' height=\"" . ${$rasse[$i].prozent} * $rasseprozentmulti . "\" alt=\"" . ${$rasse[$i]} . " - " . ${$rasse[$i].prozent} . " %\"></td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
";
for ($i = 0; $i <= 7; $i++) {
echo "<td class=\"bar" . $i . "\">" . ${$rasse[$i]} . "<BR />" . ${$rasse[$i].prozent} . "%</td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=8></td><td class=\"innerbottomright\"></td>
</tr>
<tr>
<td width=20></td>
<td class=\"bar0\" align=\"center\"><img src='Census_Dwarf.jpg' border=0 alt=\"Zwerg\"><br>Zwerg</td>
<td class=\"bar1\" align=\"center\"><img src='Census_Gnome.jpg' border=0 alt=\"Gnom\"><br>Gnom</td>
<td class=\"bar2\" align=\"center\"><img src='Census_Human.jpg' border=0 alt=\"Mensch\"><br>Mensch</td>
<td class=\"bar3\" align=\"center\"><img src='Census_NightElf.jpg' border=0 alt=\"Nacht Elf\"><br>N-Elf</td>
<td class=\"bar4\" align=\"center\"><img src='Census_Orc.jpg' border=0 alt=\"Ork\"><br>Ork</td>
<td class=\"bar5\" align=\"center\"><img src='Census_Tauren.jpg' border=0 alt=\"Taure\"><br>Taure</td>
<td class=\"bar6\" align=\"center\"><img src='Census_Troll.jpg' border=0 alt=\"Troll\"><br>Troll</td>
<td class=\"bar7\" align=\"center\"><img src='Census_Undead.jpg' border=0 alt=\"Untoter\"><br>Untoter</td>
<td width=20></td>
</tr>
<tr><td> </td></tr>
</table>
</td>
<td rowspan='2' height='100%'> </td>
</tr><tr>
<td align=\"center\">
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID="Table5">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=9></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=100></td>
";
for ($i = 0; $i <= 8; $i++) {
echo "<td class=\"class_bar" . $i . "\"><img class=\"class_img" . $i . "\" src='Census_Bar.jpg' height=\"" . ${$klasse[$i].prozent} * $klasseprozentmulti . "\" alt=\"" . ${$klasse[$i]} . " - " . ${$klasse[$i].prozent} . " %\"></td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
";
for ($i = 0; $i <= 8; $i++) {
echo "<td class=\"class_bar" . $i . "\">" . ${$klasse[$i]} . "<BR />" . ${$klasse[$i].prozent} . "%</td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=9></td><td class=\"innerbottomright\"></td>
</tr>
<tr>
<td width=20></td>
<td class=\"class_bar0\" align=\"center\"><img src='Census_Druid.jpg' border=0 alt=\"Druide\"><br>Druide</td>
<td class=\"class_bar1\" align=\"center\"><img src='Census_Hunter.jpg' border=0 alt=\"J?ger\"><br>J?ger</td>
<td class=\"class_bar2\" align=\"center\"><img src='Census_Mage.jpg' border=0 alt=\"Magier\"><br>Magier</td>
<td class=\"class_bar3\" align=\"center\"><img src='Census_Paladin.jpg' border=0 alt=\"Paladin\"><br>Paladin</td>
<td class=\"class_bar4\" align=\"center\"><img src='Census_Priest.jpg' border=0 alt=\"Priester\"><br>Priest</td>
<td class=\"class_bar5\" align=\"center\"><img src='Census_Rogue.jpg' border=0 alt=\"Schurke\"><br>Rogue</td>
<td class=\"class_bar6\" align=\"center\"><img src='Census_Shaman.jpg' border=0 alt=\"Schamane\"><br>Shaman</td>
<td class=\"class_bar7\" align=\"center\"><img src='Census_Warlock.jpg' border=0 alt=\"Hexenmeister\"><br>Warlock</td>
<td class=\"class_bar8\" align=\"center\"><img src='Census_Warrior.jpg' border=0 alt=\"Krieger\"><br>Krieger</td>
<td width=20></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=15></td>
<td colspan=2>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
<td align=\"center\" colspan=2>
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID="Table6">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=51></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=50></td>
";
for ($j = 10; $j <= 60; $j++) {
echo "<td class='levelbar'> <img src='Census_LevelBar.jpg' height=" . $levelprozent[$j] * $levelprozentmulti . " alt=\"" . $level[$j] . "\" width=6 border=0> </td>";
}
echo "
<td class='innerright'></td></tr><tr><td class='innerleft'></td><td class=\"category\" colspan=2 align='left'>10</td><td colspan=2></td><td class='category' colspan=3>15</td><td colspan=2></td><td class='category' colspan=3>20</td><td colspan=2></td><td class='category' colspan=3>25</td><td colspan=2></td><td class='category' colspan=3>30</td><td colspan=2></td><td class='category' colspan=3>35</td><td colspan=2></td><td class='category' colspan=3>40</td><td colspan=2></td><td class='category' colspan=3>45</td><td colspan=2></td><td class='category' colspan=3>50</td><td colspan=2></td><td class='category' colspan=3>55</td><td colspan=2></td><td class='category' colspan=2 align='right'>60</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=51></td><td class=\"innerbottomright\"></td>
</tr>
</table>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=\"2\"></td><td class=\"innerbottomright\"></td>
</tr>
</table>
<p> </p>
</center>";
// --------------------------------------------------------------------------------------------
// The 8 Tables with Race-Specific data. Only 1 Code, but repeated 8 times by the "For"-Code
// --------------------------------------------------------------------------------------------
for ($j = 0; $j <= 7; $j++) {
echo "<center>
<p> </p>
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID="Table7">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=2></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
";
echo "<td> <img src='" . $rasse[$j] . ".jpg '> </td><td> </td>";
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
<td align=\"center\" colspan=2>
<table class=\"censusinfo\" ID="Table8">
<tr>
<td align=\"center\">
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID="Table9">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=9></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=100></td>
";
for ($i = 0; $i <= 8; $i++) {
echo "<td class=\"class_bar" . $i . "\"><img class=\"class_img" . $i . "\" src='Census_Bar.jpg' height=\"" . ${$rasse[$j].$klasse[$i].prozent} * ${$rasse[$j].klasseprozentmulti} . "\" alt=\"" . ${$rasse[$j].$klasse[$i]} . " - " . ${$rasse[$j].$klasse[$i].prozent} . " %\"></td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
";
for ($i = 0; $i <= 8; $i++) {
echo "<td class=\"class_bar" . $i . "\">" . ${$rasse[$j].$klasse[$i]} . "<BR />" . ${$rasse[$j].$klasse[$i].prozent} . "%</td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=9></td><td class=\"innerbottomright\"></td>
</tr>
<tr>
<td width=20></td>
<td class=\"class_bar0\" align=\"center\"><img src='Census_Druid.jpg' border=0 alt=\"Druide\"><br>Druide</td>
<td class=\"class_bar1\" align=\"center\"><img src='Census_Hunter.jpg' border=0 alt=\"J?ger\"><br>J?ger</td>
<td class=\"class_bar2\" align=\"center\"><img src='Census_Mage.jpg' border=0 alt=\"Magier\"><br>Magier</td>
<td class=\"class_bar3\" align=\"center\"><img src='Census_Paladin.jpg' border=0 alt=\"Paladin\"><br>Paladin</td>
<td class=\"class_bar4\" align=\"center\"><img src='Census_Priest.jpg' border=0 alt=\"Priester\"><br>Priest</td>
<td class=\"class_bar5\" align=\"center\"><img src='Census_Rogue.jpg' border=0 alt=\"Schurke\"><br>Rogue</td>
<td class=\"class_bar6\" align=\"center\"><img src='Census_Shaman.jpg' border=0 alt=\"Schamane\"><br>Shaman</td>
<td class=\"class_bar7\" align=\"center\"><img src='Census_Warlock.jpg' border=0 alt=\"Hexenmeister\"><br>Warlock</td>
<td class=\"class_bar8\" align=\"center\"><img src='Census_Warrior.jpg' border=0 alt=\"Krieger\"><br>Krieger</td>
<td width=20></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=15></td>
<td colspan=2>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
<td align=\"center\" colspan=2>
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID="Table10">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=51></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=50></td>
";
for ($k = 10; $k <= 60; $k++) {
echo "<td class='levelbar'> <img src='Census_LevelBar.jpg' height=" . ${$rasse[$j].levelprozent}[$k] * $levelprozentmulti . " alt=\"" . ${$rasse[$j].level}[$k] . "\" width=6 border=0> </td>";
}
echo "
<td class='innerright'></td></tr><tr><td class='innerleft'></td><td class=\"category\" colspan=2 align='left'>10</td><td colspan=2></td><td class='category' colspan=3>15</td><td colspan=2></td><td class='category' colspan=3>20</td><td colspan=2></td><td class='category' colspan=3>25</td><td colspan=2></td><td class='category' colspan=3>30</td><td colspan=2></td><td class='category' colspan=3>35</td><td colspan=2></td><td class='category' colspan=3>40</td><td colspan=2></td><td class='category' colspan=3>45</td><td colspan=2></td><td class='category' colspan=3>50</td><td colspan=2></td><td class='category' colspan=3>55</td><td colspan=2></td><td class='category' colspan=2 align='right'>60</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=51></td><td class=\"innerbottomright\"></td>
</tr>
</table>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=\"2\"></td><td class=\"innerbottomright\"></td>
</tr>
</table>
<p> </p>
</center>";
}
// don't forget our credit link =)
echo "<center>";
echo "Sourcedata by <a href='http://www.warcraftrealms.com/'>WarcraftRealms.com</a>.";
echo "Data-handling and output by <a href='http://www.beat-solutions.de/'>D.Cron Beat-Solutions</a>.";
echo "</center>";
?>
</body>
</html>
phpbb:phpinfo()
I found some errors in the code and the linked ZIP-package is not online anymore. However this following code should do for the EU-Krag'jin Server:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>WoW Server-Census - sponsored by WarcraftRealms.com</title>
<meta name='keywords' content='world of warcraft, warcraft, warcraft census, warcraft realm, warcraft realms, world, wow, wow census, wow realm, wow realms, bloodscalp'>
<meta name='description' content='World of Warcraft Census Information and Data'>
</head>
<style type='text/css'>td.bar0{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg0{ width:40px;}</style>
<style type='text/css'>td.bar1{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg1{ width:40px;}</style>
<style type='text/css'>td.bar2{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg2{ width:40px;}</style>
<style type='text/css'>td.bar3{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg3{ width:40px;}</style>
<style type='text/css'>td.bar4{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg4{ width:40px;}</style>
<style type='text/css'>td.bar5{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg5{ width:40px;}</style>
<style type='text/css'>td.bar6{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg6{ width:40px;}</style>
<style type='text/css'>td.bar7{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.raceimg7{ width:40px;}</style>
<style type='text/css'>td.class_bar0{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img0{ width:40px;}</style>
<style type='text/css'>td.class_bar1{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img1{ width:40px;}</style>
<style type='text/css'>td.class_bar2{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img2{ width:40px;}</style>
<style type='text/css'>td.class_bar3{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img3{ width:40px;}</style>
<style type='text/css'>td.class_bar4{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img4{ width:40px;}</style>
<style type='text/css'>td.class_bar5{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img5{ width:40px;}</style>
<style type='text/css'>td.class_bar6{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img6{ width:40px;}</style>
<style type='text/css'>td.class_bar7{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img7{ width:40px;}</style>
<style type='text/css'>td.class_bar8{ font-family: Verdana; color: #000000; font-size: 10px; vertical-align:bottom;text-align:center;padding-left: 2px;padding-right: 2px; width:40px;}
img.class_img8{ width:40px;}</style>
<style type='text/css'>td.innertopleft{background-image: url(inner-top-left.gif); width: 20px;}</style>
<style type='text/css'>td.innertop{background-image: url(inner-top.gif); height: 20px;}</style>
<style type='text/css'>td.innertopright{background-image: url(inner-top-right.gif); width: 20px;}</style>
<style type='text/css'>td.innerleft{background-image: url(inner-left.gif); width: 20px;}</style>
<style type='text/css'>td.innerright{background-image: url(inner-right.gif); width: 20px;}</style>
<style type='text/css'>td.innerbottomleft{background-image: url(inner-bottom-left.gif); width: 20px;}</style>
<style type='text/css'>td.innerbottom{background-image: url(inner-bottom.gif); height: 20px;}</style>
<style type='text/css'>td.innerbottomright{background-image: url(inner-bottom-right.gif); width: 20px;}</style>
<style type='text/css'>table.censusinfo{background-image: url(newsback.gif);}</style>
<style type='text/css'>td.levelbar{vertical-align: bottom; padding: 1px;}</style>
<style type='text/css'>td.category{font-family: Verdana; color: #000000; font-size: 10px;}</style>
<style type='text/css'>body{ background-image:url(hintergrund.jpg); font-family: Verdana; color: #000000; font-size: 10px; }</style>
<body>
<?php
// -------------------------------------------------------------------------------
// CHECKING STATUS FILE AND GETTING NEW CENSUS DATA, IF NEWER FILE EXISTS
// -------------------------------------------------------------------------------
// Remember to check the status file so that you are not pulling data
// more than once per day
//
$localstatusfile = "status.txt";
$infile = fopen ($localstatusfile, "r");
$current_timestamp = 0;
if (!$infile)
{
echo "<p>No status file available, assuming this is the first run<br>";
}
else
{
// read our status file time
$buffer = fgets($infile, 4096);
$current_timestamp = trim( $buffer );
// Output of last Update on top if the page
echo '<p align="center">Letzte Aktualisierung: ' . strftime("%m/%d/%y %H:%M:%S",$current_timestamp) . '</p><br>';
}
fclose( $infile ); // close our local status file
$filename = "http://www.warcraftrealms.com/exports/status.txt";
$infile = fopen ($filename, "r"); // open remote status file
if (!$infile)
{
echo "<p>Unable to open status file.<br>";
exit;
}
$remote_timestamp = 0;
if(!feof ($infile)) // only 1 read should be needed for the status file
{
$buffer = fgets($infile, 4096);
$remote_timestamp = trim( $buffer );
// Output of last Update of the original Census File. Not needed, if code is working. maybe god for Update-Testing
// echo '<p align="center">Originale Census Datenfile: ' . strftime("%m/%d/%y %H:%M:%S",$remote_timestamp) . '</p><br>';
}
fclose( $infile ); // close the remote status file
if( $remote_timestamp - $current_timestamp > 86400 ) // 1 day = 60*60*24
{
//
// We can do a full get
//
// write our new status file
$outfilename = "status.txt";
$outfile = fopen($outfilename, "w");
if( !$outfile )
{
echo "<p>Unable to open save file => " . $outfilename . "<br>";
exit;
}
fputs($outfile, $buffer);
fclose($outfile);
//
// Now get our guild roster file
//
// -------------------------------------------------------------------------------
// REPLACE THE URL FOR YOUR REALM FILE
$filename = "http://www.warcraftrealms.com/exports/download.php?fname=EU-Khaz'goroth.csv.gz";
// -------------------------------------------------------------------------------
$infile = gzopen ($filename, "r");
if (!$infile)
{
echo "<p>Unable to open remote file.<br>\n";
exit;
}
$outfilename = "kragjinroster.csv"; // Local filename for downloaded Census Data - Normaly no need to change
$outfile = fopen($outfilename, "w");
if( !$outfile )
{
echo "<p>Unable to open save file => " . $outfilename . "<br>\n";
exit;
}
while (!feof ($infile))
{
$buffer = fgets($infile, 4096);
fputs($outfile, $buffer);
}
fclose($outfile);
fclose($infile);
}
// -------------------------------------------------------------------------------
// Data download and checking is now done. Now the Data-Processing can begin.
// -------------------------------------------------------------------------------
$filename = "kragjinroster.csv";
$infile = fopen ($filename, "r");
if (!$infile)
{
echo "<p>Unable to open local roster file.<br>";
exit;
}
// do one read to get the header
$buffer = fgets($infile, 4096);
$lines = 0;
// read the entries
while (!feof ($infile))
{
$buffer = fgets($infile, 4096);
list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",",$buffer);
$lines = $lines + 1;
}
//-------------DANS SCRIPT --------------------------------
// declaring main vars
$horde = 0;
$alliance = 0;
$allianceprozent = 0;
$hordeprozent = 0;
$allianceratio = 0;
$horderatio = 0;
$druid = 0;
$hunter = 0;
$mage = 0;
$paladin = 0;
$priest = 0;
$rogue = 0;
$shaman = 0;
$warlock = 0;
$warrior = 0;
// declaring sub-vars and vars with Strings of the Races and classes
$rasse = array(dwarf, gnome, human, nightelf, orc, tauren, troll, undead);
$rassecaps = array("Dwarf", "Gnome", "Human", "Night Elf", "Orc", "Tauren", "Troll", "Undead");
$rassedeutsch = array(Zwergen, Gnomen, Menschen, Nachtelfen, Ork, Tauren, Troll, Untoten);
$klasse = array(druid, hunter, mage, paladin, priest, rogue, shaman, warlock, warrior);
for ($i = 0; $i <= 7; $i++) {
${$rasse[$i]} = 0;
${$rasse[$i].druid} = 0;
${$rasse[$i].hunter} = 0;
${$rasse[$i].mage} = 0;
${$rasse[$i].paladin} = 0;
${$rasse[$i].priest} = 0;
${$rasse[$i].rogue} = 0;
${$rasse[$i].shaman} = 0;
${$rasse[$i].warlock} = 0;
${$rasse[$i].warrior} = 0;
${$rasse[$i].unknown} = 0;
${$rasse[$i].prozent} = 0;
}
$csv = file_get_contents("kragjinroster.csv");
$csv = explode("\n",$csv);
$count = 0 ; // Z?hlt durch bis Ende Hauptarray
while ($count <= $lines)
{
$csv[$count] = explode(",",$csv[$count]);
//-----------Allianz Horde---------------
if ($csv[$count][1] == "Alliance") {
$alliance = $alliance + $csv[$count][5];
} else {
$horde = $horde + $csv[$count][5];
}
//---------------------------------------
for ($i = 0; $i <= 7; $i++) {
// cycle through all races
if ($csv[$count][2] == $rassecaps[$i]) {
// cycle through all classes of a race and add the number of class-race-chars to the class-racespecific countervar
${$rasse[$i]} = ${$rasse[$i]} + $csv[$count][5];
if ($csv[$count][3] == "Druid") {
${$rasse[$i].druid} = ${$rasse[$i].druid} + $csv[$count][5];
} elseif ($csv[$count][3] == "Hunter") {
${$rasse[$i]."hunter"} = ${$rasse[$i]."hunter"} + $csv[$count][5];
} elseif ($csv[$count][3] == "Mage") {
${$rasse[$i].mage} = ${$rasse[$i].mage} + $csv[$count][5];
} elseif ($csv[$count][3] == "Paladin") {
${$rasse[$i].paladin} = ${$rasse[$i].paladin} + $csv[$count][5];
} elseif ($csv[$count][3] == "Priest") {
${$rasse[$i].priest} = ${$rasse[$i].priest} + $csv[$count][5];
} elseif ($csv[$count][3] == "Rogue") {
${$rasse[$i].rogue} = ${$rasse[$i].rogue} + $csv[$count][5];
} elseif ($csv[$count][3] == "Shaman") {
${$rasse[$i].shaman} = ${$rasse[$i].shaman} + $csv[$count][5];
} elseif ($csv[$count][3] == "Warlock") {
${$rasse[$i].warlock} = ${$rasse[$i].warlock} + $csv[$count][5];
} elseif ($csv[$count][3] == "Warrior") {
${$rasse[$i].warrior} = ${$rasse[$i].warrior} + $csv[$count][5];
} else {
${$rasse[$i].unknown} = ${$rasse[$i].unknown} + $csv[$count][5];
}
// add the levels of a race to a race-level array
$levelhelper = $csv[$count][4];
${$rasse[$i].level}[$levelhelper] = ${$rasse[$i].level}[$levelhelper] + $csv[$count][5];
} else {
}
}
$count = $count + 1;
}
// sum all race-class-chars to a single race variable
for ($i = 0; $i <= 7; $i++) {
$druid = $druid + ${$rasse[$i].druid};
$hunter = $hunter + ${$rasse[$i].hunter};
$mage = $mage + ${$rasse[$i].mage};
$paladin = $paladin + ${$rasse[$i].paladin};
$priest = $priest + ${$rasse[$i].priest};
$rogue = $rogue + ${$rasse[$i].rogue};
$shaman = $shaman + ${$rasse[$i].shaman};
$warlock = $warlock + ${$rasse[$i].warlock};
$warrior = $warrior + ${$rasse[$i].warrior};
}
// End of Data reading and writing main arrays.
// -------------------------------------------------------------------------------
// mathematics
// -------------------------------------------------------------------------------
// count all palyers an get the A-H-Ratio
$player = $alliance + $horde;
$allianceprozent = round($alliance / $player * 100);
$hordeprozent = 100 - $allianceprozent;
$allianceratio = round($allianceprozent / $hordeprozent,1);
$horderatio = 1;
// Get all race-Percantages and make a race-multiplier for adequate Ber-Height in the Output-Table
// z.B. dwarfprozent
$rasseprozentmax = 0;
for ($i = 0; $i <= 7; $i++) {
${$rasse[$i].prozent} = round(${$rasse[$i]} / $player * 100);
if (${$rasse[$i].prozent} > $rasseprozentmax) {
$rasseprozentmax = ${$rasse[$i].prozent};
}
}
$rasseprozentmulti = floor(100 / $rasseprozentmax);
// Sum all Classes from Race-Class-counter
for ($j = 0; $j <= 8; $j++) {
${$klasse[$j].prozent} = 0;
for ($i = 0; $i <= 7; $i++) {
${$klasse[$j]} = ${$klasse[$j]} + ${$rasse[$i].$klasse[$j]};
}
}
// Get all Class-Percantages and make a Class-multiplier for adequate Ber-Height in the Output-Table
// z.B. druidprozent
$klasseprozentmax = 0;
for ($i = 0; $i <= 8; $i++) {
${$klasse[$i].prozent} = round(${$klasse[$i]} / $player * 100);
if (${$klasse[$i].prozent} > $klasseprozentmax) {
$klasseprozentmax = ${$klasse[$i].prozent};
}
}
$klasseprozentmulti = floor(100 / $klasseprozentmax);
// Get all race-class-Percantages and make a race-class-multiplier for adequate Ber-Height in the Output-Table
// z.B. drwarfdruidprozent
for ($i = 0; $i <= 7; $i++) {
${$rasse[$i].klasseprozentmax} = 0;
for ($j = 0; $j <= 8; $j++) {
${$rasse[$i].$klasse[$j].prozent} = round(${$rasse[$i].$klasse[$j]} / ${$rasse[$i]} * 100);
if (${$rasse[$i].$klasse[$j].prozent} > ${$rasse[$i].klasseprozentmax}) {
${$rasse[$i].klasseprozentmax} = ${$rasse[$i].$klasse[$j].prozent};
}
}
${$rasse[$i].klasseprozentmulti} = floor(100 / ${$rasse[$i].klasseprozentmax});
}
// get all Race-level-percentages and its multiplier
// rassenlevelprozent
for ($j = 0; $j <= 7; $j++) {
${$rasse[$j].levelprozentmax} = 0;
for ($i = 10; $i <= 60; $i++) {
${$rasse[$j].levelprozent}[$i] = round(${$rasse[$j].level}[$i] / ${$rasse[$j]} * 100,3);
if (${$rasse[$j].levelprozent}[$i] > ${$rasse[$j].levelprozentmax}) {
${$rasse[$j].levelprozentmax} = ${$rasse[$j].levelprozent}[$i];
}
}
${$rasse[$j].levelprozentmulti} = floor(50 / ${$rasse[$j].levelprozentmax});
}
// get all levels from race-levels
for ($j = 10; $j <= 60; $j++) {
$level[$j] = 0;
for ($i = 0; $i <= 7; $i++) {
$level[$j] = $level[$j] + ${$rasse[$i].level}[$j];
}
// echo " Level " . $j . " = " . $level[$j] . " !";
}
// get all level percentages
$levelprozentmax = 0;
for ($i = 10; $i <= 60; $i++) {
$levelprozent[$i] = round($level[$i] / $player * 100,3);
if ($levelprozent[$i] > $levelprozentmax) {
$levelprozentmax = $levelprozent[$i];
}
}
$levelprozentmulti = floor(50 / $levelprozentmax);
// --------------------------------------------------------------------------------------------
// End of Mathematics part. Now all Vars are written an can be used f?r output
// --------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------
// GRAPHICAL OUTPUT BEGINGS.
// --------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------
// First Table with general Stats and Race and class overview, as well as all-chars-levels
// --------------------------------------------------------------------------------------------
echo "<center>
<p> </p>
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID=\"Table1\">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=2></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
<td> <img src=\"kgcensuslogo.jpg\"> </td>
<td>
<table align=\"right\" cellpadding=0 cellspacing=0 class=\"censusinfo\" ID=\"Table2\">
<tr>
<td class=\"category\">Total Characters:</td>
<td class=\"category\"><b>$player</b></td>
</tr>
<tr>
<td class=\"category\">Total Alliance:</td>
<td class=\"category\"><b>$alliance - $allianceprozent %</b></td>
</tr>
<tr>
<td class=\"category\">Total Horde:</td>
<td class=\"category\"><b>$horde - $hordeprozent %</b></td>
</tr>
<tr>
<td class=\"category\">A to H Ratio:</td>
<td class=\"category\"><b>$allianceratio : $horderatio</b></td>
</tr>
</table>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
<td align=\"center\" colspan=2>
<table class=\"censusinfo\" ID=\"Table3\"><tr><td align=\"center\">
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID=\"Table4\">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=8></td><td class=\"innertopright\"></td>
</tr>
<!-- <tr>
<td class=\"innerleft\"></td>
<td align=\"center\" colspan=4>Alliance</td>
<td align=\"center\" colspan=4>Horde</td>
<td class=\"innerright\"></td>
</tr>
--> <tr>
<td class=\"innerleft\" height=100></td>
";
for ($i = 0; $i <= 7; $i++) {
echo "<td class=\"bar" . $i . "\"><img class=\"raceimg" . $i . "\" src='Census_Bar.jpg' height=\"" . ${$rasse[$i].prozent} * $rasseprozentmulti . "\" alt=\"" . ${$rasse[$i]} . " - " . ${$rasse[$i].prozent} . " %\"></td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
";
for ($i = 0; $i <= 7; $i++) {
echo "<td class=\"bar" . $i . "\">" . ${$rasse[$i]} . "<BR />" . ${$rasse[$i].prozent} . "%</td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=8></td><td class=\"innerbottomright\"></td>
</tr>
<tr>
<td width=20></td>
<td class=\"bar0\" align=\"center\"><img src='Census_Dwarf.jpg' border=0 alt=\"Zwerg\"><br>Zwerg</td>
<td class=\"bar1\" align=\"center\"><img src='Census_Gnome.jpg' border=0 alt=\"Gnom\"><br>Gnom</td>
<td class=\"bar2\" align=\"center\"><img src='Census_Human.jpg' border=0 alt=\"Mensch\"><br>Mensch</td>
<td class=\"bar3\" align=\"center\"><img src='Census_NightElf.jpg' border=0 alt=\"Nacht Elf\"><br>N-Elf</td>
<td class=\"bar4\" align=\"center\"><img src='Census_Orc.jpg' border=0 alt=\"Ork\"><br>Ork</td>
<td class=\"bar5\" align=\"center\"><img src='Census_Tauren.jpg' border=0 alt=\"Taure\"><br>Taure</td>
<td class=\"bar6\" align=\"center\"><img src='Census_Troll.jpg' border=0 alt=\"Troll\"><br>Troll</td>
<td class=\"bar7\" align=\"center\"><img src='Census_Undead.jpg' border=0 alt=\"Untoter\"><br>Untoter</td>
<td width=20></td>
</tr>
<tr><td> </td></tr>
</table>
</td>
<td rowspan='2' height='100%'> </td>
</tr><tr>
<td align=\"center\">
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID=\"Table5\">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=9></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=100></td>
";
for ($i = 0; $i <= 8; $i++) {
echo "<td class=\"class_bar" . $i . "\"><img class=\"class_img" . $i . "\" src='Census_Bar.jpg' height=\"" . ${$klasse[$i].prozent} * $klasseprozentmulti . "\" alt=\"" . ${$klasse[$i]} . " - " . ${$klasse[$i].prozent} . " %\"></td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
";
for ($i = 0; $i <= 8; $i++) {
echo "<td class=\"class_bar" . $i . "\">" . ${$klasse[$i]} . "<BR />" . ${$klasse[$i].prozent} . "%</td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=9></td><td class=\"innerbottomright\"></td>
</tr>
<tr>
<td width=20></td>
<td class=\"class_bar0\" align=\"center\"><img src='Census_Druid.jpg' border=0 alt=\"Druide\"><br>Druide</td>
<td class=\"class_bar1\" align=\"center\"><img src='Census_Hunter.jpg' border=0 alt=\"J?ger\"><br>J?ger</td>
<td class=\"class_bar2\" align=\"center\"><img src='Census_Mage.jpg' border=0 alt=\"Magier\"><br>Magier</td>
<td class=\"class_bar3\" align=\"center\"><img src='Census_Paladin.jpg' border=0 alt=\"Paladin\"><br>Paladin</td>
<td class=\"class_bar4\" align=\"center\"><img src='Census_Priest.jpg' border=0 alt=\"Priester\"><br>Priest</td>
<td class=\"class_bar5\" align=\"center\"><img src='Census_Rogue.jpg' border=0 alt=\"Schurke\"><br>Rogue</td>
<td class=\"class_bar6\" align=\"center\"><img src='Census_Shaman.jpg' border=0 alt=\"Schamane\"><br>Shaman</td>
<td class=\"class_bar7\" align=\"center\"><img src='Census_Warlock.jpg' border=0 alt=\"Hexenmeister\"><br>Warlock</td>
<td class=\"class_bar8\" align=\"center\"><img src='Census_Warrior.jpg' border=0 alt=\"Krieger\"><br>Krieger</td>
<td width=20></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=15></td>
<td colspan=2>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
<td align=\"center\" colspan=2>
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID=\"Table6\">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=51></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=50></td>
";
for ($j = 10; $j <= 60; $j++) {
echo "<td class='levelbar'> <img src='Census_LevelBar.jpg' height=" . $levelprozent[$j] * $levelprozentmulti . " alt=\"" . $level[$j] . "\" width=6 border=0> </td>";
}
echo "
<td class='innerright'></td></tr><tr><td class='innerleft'></td><td class=\"category\" colspan=2 align='left'>10</td><td colspan=2></td><td class='category' colspan=3>15</td><td colspan=2></td><td class='category' colspan=3>20</td><td colspan=2></td><td class='category' colspan=3>25</td><td colspan=2></td><td class='category' colspan=3>30</td><td colspan=2></td><td class='category' colspan=3>35</td><td colspan=2></td><td class='category' colspan=3>40</td><td colspan=2></td><td class='category' colspan=3>45</td><td colspan=2></td><td class='category' colspan=3>50</td><td colspan=2></td><td class='category' colspan=3>55</td><td colspan=2></td><td class='category' colspan=2 align='right'>60</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=51></td><td class=\"innerbottomright\"></td>
</tr>
</table>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=\"2\"></td><td class=\"innerbottomright\"></td>
</tr>
</table>
<p> </p>
</center>";
// --------------------------------------------------------------------------------------------
// The 8 Tables with Race-Specific data. Only 1 Code, but repeated 8 times by the "For"-Code
// --------------------------------------------------------------------------------------------
for ($j = 0; $j <= 7; $j++) {
echo "<center>
<p> </p>
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID=\"Table7\">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=2></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
";
echo "<td> <img src='" . $rasse[$j] . ".jpg '> </td><td> </td>";
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
<td align=\"center\" colspan=2>
<table class=\"censusinfo\" ID=\"Table8\">
<tr>
<td align=\"center\">
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID=\"Table9\">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=9></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=100></td>
";
for ($i = 0; $i <= 8; $i++) {
echo "<td class=\"class_bar" . $i . "\"><img class=\"class_img" . $i . "\" src='Census_Bar.jpg' height=\"" . ${$rasse[$j].$klasse[$i].prozent} * ${$rasse[$j].klasseprozentmulti} . "\" alt=\"" . ${$rasse[$j].$klasse[$i]} . " - " . ${$rasse[$j].$klasse[$i].prozent} . " %\"></td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
";
for ($i = 0; $i <= 8; $i++) {
echo "<td class=\"class_bar" . $i . "\">" . ${$rasse[$j].$klasse[$i]} . "<BR />" . ${$rasse[$j].$klasse[$i].prozent} . "%</td>";
}
echo "
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=9></td><td class=\"innerbottomright\"></td>
</tr>
<tr>
<td width=20></td>
<td class=\"class_bar0\" align=\"center\"><img src='Census_Druid.jpg' border=0 alt=\"Druide\"><br>Druide</td>
<td class=\"class_bar1\" align=\"center\"><img src='Census_Hunter.jpg' border=0 alt=\"J?ger\"><br>J?ger</td>
<td class=\"class_bar2\" align=\"center\"><img src='Census_Mage.jpg' border=0 alt=\"Magier\"><br>Magier</td>
<td class=\"class_bar3\" align=\"center\"><img src='Census_Paladin.jpg' border=0 alt=\"Paladin\"><br>Paladin</td>
<td class=\"class_bar4\" align=\"center\"><img src='Census_Priest.jpg' border=0 alt=\"Priester\"><br>Priest</td>
<td class=\"class_bar5\" align=\"center\"><img src='Census_Rogue.jpg' border=0 alt=\"Schurke\"><br>Rogue</td>
<td class=\"class_bar6\" align=\"center\"><img src='Census_Shaman.jpg' border=0 alt=\"Schamane\"><br>Shaman</td>
<td class=\"class_bar7\" align=\"center\"><img src='Census_Warlock.jpg' border=0 alt=\"Hexenmeister\"><br>Warlock</td>
<td class=\"class_bar8\" align=\"center\"><img src='Census_Warrior.jpg' border=0 alt=\"Krieger\"><br>Krieger</td>
<td width=20></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=15></td>
<td colspan=2>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerleft\"></td>
<td align=\"center\" colspan=2>
<table class=\"censusinfo\" cellpadding=0 cellspacing=0 ID=\"Table10\">
<tr>
<td class=\"innertopleft\"></td><td class=\"innertop\" colspan=51></td><td class=\"innertopright\"></td>
</tr>
<tr>
<td class=\"innerleft\" height=50></td>
";
for ($k = 10; $k <= 60; $k++) {
echo "<td class='levelbar'> <img src='Census_LevelBar.jpg' height=" . ${$rasse[$j].levelprozent}[$k] * $levelprozentmulti . " alt=\"" . ${$rasse[$j].level}[$k] . "\" width=6 border=0> </td>";
}
echo "
<td class='innerright'></td></tr><tr><td class='innerleft'></td><td class=\"category\" colspan=2 align='left'>10</td><td colspan=2></td><td class='category' colspan=3>15</td><td colspan=2></td><td class='category' colspan=3>20</td><td colspan=2></td><td class='category' colspan=3>25</td><td colspan=2></td><td class='category' colspan=3>30</td><td colspan=2></td><td class='category' colspan=3>35</td><td colspan=2></td><td class='category' colspan=3>40</td><td colspan=2></td><td class='category' colspan=3>45</td><td colspan=2></td><td class='category' colspan=3>50</td><td colspan=2></td><td class='category' colspan=3>55</td><td colspan=2></td><td class='category' colspan=2 align='right'>60</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=51></td><td class=\"innerbottomright\"></td>
</tr>
</table>
</td>
<td class=\"innerright\"></td>
</tr>
<tr>
<td class=\"innerbottomleft\"></td><td class=\"innerbottom\" colspan=\"2\"></td><td class=\"innerbottomright\"></td>
</tr>
</table>
<p> </p>
</center>";
}
// don't forget our credit link =)
echo "<center>";
echo "Sourcedata by <a href='http://www.warcraftrealms.com/'>WarcraftRealms.com</a>.";
echo "Data-handling and output by <a href='http://www.beat-solutions.de/'>D.Cron Beat-Solutions</a>.";
echo "</center>";
?>
</body>
</html>
Anyone got a copy of the zip file. Its a bad url now.
<a href="http://www.warcraftrealms.com/profile/16037192" target="_new"><img src ="http://www.warcraftrealms.com/sig/16037192.jpg" alt="Click to view Profile" title="Click to view Profile"></a>