|
|
| View previous topic :: View next topic |
| Author |
Message |
Prinz
Joined: 11 Sep 2005
Posts: 2
Location: Germany, Paderborn
WR Updates: 1,107
Prinz WR Profile
|
Posted: Tue Sep 20, 2005 6:08 pm Post subject: |
|
|
I know...it should be automated, but I am not sure that it really automaticly works with my free webspace provider,how can I be sure if it really works? that was my question
sorry for the many topics,can you delete them? I now registered me
okay,your update is done. But my status.txt on my webspace is still the same ("1127203996"). Does somebody has an idea what the problem could be? I dont have any suggestion because I also dont get any errors by executing the php. http://berentirsidh.fbhosting.com/test4.php
Other question: Does somebody know a free webspace provider where the script is 100 percently running without any problems? Thanks for all your help! |
|
| Back to top |
|
 |
Hybuir
Gear Dependent Squirrel

Joined: 06 Sep 2005
Posts: 1536
Location: Austin, TX
WR Updates: 2,466,953
Hybuir WR Profile
|
Posted: Thu Sep 22, 2005 8:01 pm Post subject: Guild at a Glance |
|
|
Heya everyone, I've gone ahead and made a 'condensed' version that gives critical information to the user without having to decypher the whole guild list. I've implemented the base code, with a couple of quirks. Any feedback would be greatly appreciated. Working example at http://reapers.ws/guild_at_a_glance/
| Code: |
<?php
//
// Rostertest.php
//
// Sample guild export downloader and display
// You may use this script as you wish. This is only some sample code
// provided to help get a jumpstart!
//
// Created: 1/27/2005
//
// Author: Cooper Sellers aka Rollie - Bloodscalp
// A Tinkering Called: Guild at a Glance
// Tinkerer: Junior Dimas aka Hybuir - Boulderfist <Reapers> cdimas@gmail.com
// Note: this code is originally written for a Horde guild. To change it to
// an alliance guild, trade off Shaman variables with the Paladin name.
$local_directory = ""; // this is the directory where your local files
// will be written to and read from. Make sure
// you have WRITE priveledges on this directory
$guild_id = 146466; // get this number from the link posted on the
// guilddisplay.php page
$guild_name = "Reapers"; // Variables to link back to your guilds full info
$server_id = "52"; // on WarcraftRealms.com
$server_name = "Boulderfist";
$PHP_SELF = $_SERVER["PHP_SELF"]; //To show Source Code
$endr = "<a href=$PHP_SELF?source>Get the Source Code</a>";
if (isset($_GET["source"])) { // source display
echo $endr;
highlight_file(__FILE__);
die();
}
//
// Remember to check the status file so that you are not pulling data
// more than once per day
//
$localstatusfile = $local_directory . "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 );
}
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 );
}
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 = $local_directory . "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
//
$filename = 'http://www.warcraftrealms.com/exports/guildexport.php?guildid=' . $guild_id;
$infile = fopen ($filename, "r");
if (!$infile)
{
echo "<p>Unable to open remote file.<br>\n";
exit;
}
$outfilename = $local_directory . "guildroster.txt";
$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);
}
//
// Now let's just output our roster as it's given
//
$filename = $local_directory . "guildroster.txt";
$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);
//Initiallize all counts
$total_count=0;
$druid_count=0;
$druid_mount=0;
$hunter_count=0;
$hunter_mount=0;
$mage_count=0;
$mage_mount=0;
$priest_count=0;
$priest_mount=0;
$rogue_count=0;
$rogue_mount=0;
$shaman_count=0;
$shaman_mount=0;
$warlock_count=0;
$warlock_mount=0;
$warrior_count=0;
$warrior_mount=0;
$level_count=0;
// read the entries
while (!feof ($infile))
{
$buffer = fgets($infile, 4096);
list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",",$buffer);
$total_count = $total_count + 1;
$level_count = $level_count + $level;
if ($class == "Druid")
{
$druid_count = $druid_count + 1;
if ($level>="40") { $druid_mount = $druid_mount + 1; }
}
else if ($class == "Hunter")
{
$hunter_count = $hunter_count + 1;
if ($level>="40") { $hunter_mount = $hunter_mount + 1; }
}
else if ($class == "Mage")
{
$mage_count = $mage_count + 1;
if ($level>="40") { $mage_mount = $mage_mount + 1; }
}
else if ($class == "Priest")
{
$priest_count = $priest_count + 1;
if ($level>="40") { $priest_mount = $priest_mount + 1; }
}
else if ($class == "Rogue")
{
$rogue_count = $rogue_count + 1;
if ($level>="40") { $rogue_mount = $rogue_mount + 1; }
}
else if ($class == "Warlock")
{
$warlock_count = $warlock_count + 1;
if ($level>="40") { $warlock_mount = $warlock_mount + 1; }
}
else if ($class == "Warrior")
{
$warrior_count = $warrior_count + 1;
if ($level>="40") { $warrior_mount = $warrior_mount + 1; }
}
else if ($class == "Shaman") // Can be changed for Paladins
{
$shaman_count = $shaman_count + 1;
if ($level>="40") { $shaman_mount = $shaman_mount + 1; }
}
}
// Start of finding out the percentages of the classess
$druid_per = round(($druid_count/$total_count) * 100,1);
$hunter_per = round(($hunter_count/$total_count) * 100,1);
$mage_per = round(($mage_count/$total_count) * 100,1);
$priest_per = round(($priest_count/$total_count) * 100,1);
$rogue_per = round(($rogue_count/$total_count) * 100,1);
$shaman_per = round(($shaman_count/$total_count) * 100,1);
$warlock_per = round(($warlock_count/$total_count) * 100,1);
$warrior_per = round(($warrior_count/$total_count) * 100,1);
// Find out the percentages of players with mount capabilities
$druid_mount_per = round(($druid_mount/$druid_count)*100);
$hunter_mount_per = round(($hunter_mount/$hunter_count)*100);
$mage_mount_per = round(($mage_mount/$mage_count)*100);
$priest_mount_per = round(($priest_mount/$priest_count)*100);
$rogue_mount_per = round(($rogue_mount/$rogue_count)*100);
$shaman_mount_per = round(($shaman_mount/$shaman_count)*100);
$warlock_mount_per = round(($warlock_mount/$warlock_count)*100);
$warrior_mount_per = round(($warrior_mount/$warrior_count)*100);
$total_mount = $druid_mount + $hunter_mount + $mage_mount + $priest_mount + $rogue_mount + $shaman_mount + $warlock_mount + $warrior_mount;
$total_mount_per = round(($total_mount/$total_count)*100);
// The reason why there are so many echo's is because I just copied and pasted the code for the table from DreamWeaver
// I know that it isn't the best code, but it makes the people that are anal about tag placement very happy.
echo '<table bordercolor="#000000" border="1px">';
echo ' <tr>';
echo ' <td colspan="4"> <div align="center">Guild at a Glance - <a href=http://www.warcraftrealms.com/census.php?guildid=' . $guild_id . ' target=_guild>'. $guild_name . '</a> - <a href=http://www.warcraftrealms.com/census.php?serverid=' . $server_id . ' target=_server>' . $server_name .'</a> </div></td>';
echo ' </tr><tr>';
echo ' <td> <div align="center">Class</div></td>';
echo ' <td> <div align="center">Count</div></td>';
echo ' <td bordercolor="#000000"> <div align="center">Percent</div></td>';
echo ' <td> <div align="center">Mount Count</div></td>';
echo ' </tr><tr>';
echo ' <td>Druid</td>';
echo ' <td> <div align="center">' . $druid_count . ' </div></td>';
echo ' <td> <div align="center">' . $druid_per . ' </div></td>';
echo ' <td> <div align="center">' . $druid_mount . ' (' . $druid_mount_per . '%)</div></td>';
echo ' </tr><tr>';
echo ' <td>Hunter</td>';
echo ' <td> <div align="center">' . $hunter_count . ' </div></td>';
echo ' <td> <div align="center">' . $hunter_per . ' </div></td>';
echo ' <td> <div align="center">' . $hunter_mount . ' (' . $hunter_mount_per . '%)</div></td>';
echo ' </tr><tr>';
echo ' <td>Mage</td>';
echo ' <td> <div align="center">' . $mage_count .'</div></td>';
echo ' <td> <div align="center">' . $mage_per .'</div></td>';
echo ' <td> <div align="center">' . $mage_mount . ' (' . $mage_mount_per . '%)</div></td>';
echo ' </tr><tr>';
echo ' <td>Priest</td>';
echo ' <td> <div align="center">' . $priest_count .'</div></td>';
echo ' <td> <div align="center">' . $priest_per .'</div></td>';
echo ' <td> <div align="center">' . $priest_mount . ' (' . $priest_mount_per . '%)</div></td>';
echo ' </tr><tr>';
echo ' <td>Rogue</td>';
echo ' <td> <div align="center">' . $rogue_count . '</div></td>';
echo ' <td> <div align="center">' . $rogue_per . '</div></td>';
echo ' <td> <div align="center">' . $rogue_mount . ' (' . $rogue_mount_per . '%)</div></td>';
echo ' </tr><tr>';
echo ' <td>Shaman</td>';
echo ' <td> <div align="center">' . $shaman_count . '</div></td>';
echo ' <td> <div align="center">' . $shaman_per . '</div></td>';
echo ' <td> <div align="center">' . $shaman_mount . ' (' . $shaman_mount_per . '%)</div></td>';
echo ' </tr><tr>';
echo ' <td>Warlock</td>';
echo ' <td> <div align="center">' . $warlock_count . ' </div></td>';
echo ' <td> <div align="center">' . $warlock_per . '</div></td>';
echo ' <td> <div align="center">' . $warlock_mount . ' (' . $warlock_mount_per . '%)</div></td>';
echo ' </tr><tr>';
echo ' <td>Warrior</td>';
echo ' <td> <div align="center">' . $warrior_count . ' </div></td>';
echo ' <td> <div align="center">' . $warrior_per . ' </div></td>';
echo ' <td> <div align="center">' . $warrior_mount . ' (' . $warrior_mount_per . '%)</div></td>';
echo ' </tr><tr>';
echo ' <td><div align="right"><strong>Total</strong></div></td>';
echo ' <td><div align="center"><strong> ' . $total_count . ' </strong></div></td>';
echo ' <td><div align="center"> </div></td>';
echo ' <td><div align="center"><strong> ' . $total_mount . ' (' . $total_mount_per . '%)</strong></div></td>';
echo ' </tr> <tr valign="bottom">';
echo ' <td colspan="4"> <div align="center"><font size="1">Updated ' . strftime("%m/%d/%y %H:%M:%S",$remote_timestamp) . '. Guild data provided by <a href=http://www.warcraftrealms.com target=_new>WarcraftRealms.com</a>.</font></div></td>';
echo ' </tr>';
echo '</table>';
echo $endr;
?> |
_________________
 
  |
|
| Back to top |
|
 |
Keitaran ;-)
Guest
|
Posted: Tue Oct 04, 2005 3:37 pm Post subject: no fopen support but still run the guildroster on your site |
|
|
This is my first post on the forum, i've had some problems with my host becourse they don't support fopen becourse they run PHP in save mode. So i've been strugling a little to change the code for people that like to have the guildroster working on their site.
I've had no experience with with the code but it all worked out pretty well. I've saved the guildroster in the same map as the php file.
The only problem you will have here is that you will need to manualy save the new guildroster file to your webspace each time to keep it up to date.
Here's the code i use at my site: http://www.keitaran.net/guildmembers.php
| Code: | <?php
//
// Rostertest.php
//
// Sample guild export downloader and display
// You may use this script as you wish. This is only some sample code
// provided to help get a jumpstart!
//
// Created: 1/27/2005
//
// Author: Cooper Sellers aka Rollie - Bloodscalp
//
//
// Now let's just output our roster as it's given
//
$filename = $local_directory . "guildroster.txt";
$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);
// read the entries
echo '<table style="margin-left: 180px; margin-right: auto; margin-top: 230px; text-align: left; width: 80%; height: 60px;" border="1" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-weight: bold; font-family: Verdana;"><small>Name</small></td><td style="font-weight: bold; font-family: Verdana;"><small>Rasse</small></td><td style="font-weight: bold; font-family: Verdana;"><small>Klasse</small></td><td style="font-weight: bold; font-family: Verdana;"><small>Level</small></td><td style="font-weight: bold; font-family: Verdana;"><small>Zuletzt gesehen</small></td><td style="font-weight: bold; font-family: Verdana;"><small>Rang</small></td></tr><tr>';
while (!feof ($infile))
{
$buffer = fgets($infile, 4096);
list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",",$buffer);
$member_count++;
echo '<tr><td style="font-family: Verdana;"><small>' . $name . '</small></td><td style="font-family: Verdana;"><small>' . $race . '</small></td><td style="font-family: Verdana;"><small>' . $class . '</small></td><td style="font-family: Verdana;"><small>' . $level . '</small></td><td style="font-family: Verdana;"><small>' . $last_seen . '</small></td><td style="font-family: Verdana;"><small>' . $rank . '</small></td></tr>';
}
echo '</table>';
echo '<table class="content"><tr><td class="topcontent"><center>Statistics</center><tr><td class="content">';
echo "Total Members: ";
echo "$member_count";
echo '</center>';
echo "Guild data provided by <a href='http://www.warcraftrealms.com/'>WarcraftRealms.com</a>.";
echo '</td></tr></table>';
?> |
If there's any better way please inform me [/url] |
|
| Back to top |
|
 |
Keitaran
Joined: 04 Oct 2005
Posts: 2
WR Updates: 0
Keitaran WR Profile
|
Posted: Tue Oct 04, 2005 3:38 pm Post subject: bah |
|
|
I thought i was logged in
I saw in my code was some german, but since i've posted it as a guest i can't change it. You need to change:
Rasse to Race
Klasse to Class
Zuletzt gesehen to Last seen
Rang to Rank
or replace this at // read the entries
| Code: | // read the entries
echo '<table style="margin-left: 180px; margin-right: auto; margin-top: 230px; text-align: left; width: 80%; height: 60px;" border="1" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-weight: bold; font-family: Verdana;"><small>Name</small></td><td style="font-weight: bold; font-family: Verdana;"><small>Race</small></td><td style="font-weight: bold; font-family: Verdana;"><small>class</small></td><td style="font-weight: bold; font-family: Verdana;"><small>Level</small></td><td style="font-weight: bold; font-family: Verdana;"><small>Last seen</small></td><td style="font-weight: bold; font-family: Verdana;"><small>Rank</small></td></tr><tr>'; |
Last edited by Keitaran on Tue Oct 04, 2005 4:36 pm; edited 1 time in total |
|
| Back to top |
|
 |
Keitaran
Joined: 04 Oct 2005
Posts: 2
WR Updates: 0
Keitaran WR Profile
|
Posted: Tue Oct 04, 2005 4:15 pm Post subject: Guild in a glance |
|
|
| Looks realy nice Hybuir thanks a lot i'll add it to my site |
|
| Back to top |
|
 |
Hybuir
Gear Dependent Squirrel

Joined: 06 Sep 2005
Posts: 1536
Location: Austin, TX
WR Updates: 2,466,953
Hybuir WR Profile
|
Posted: Tue Oct 04, 2005 4:41 pm Post subject: Re: Guild in a glance |
|
|
| Keitaran wrote: | | Looks realy nice Hybuir thanks a lot i'll add it to my site |
Thanks  _________________
 
  |
|
| Back to top |
|
 |
pyrus
Guest
|
Posted: Wed Oct 05, 2005 11:25 am Post subject: |
|
|
For those interested how ours turned out. This is for use with PHPBB
I'll post my code once I clean the mess up lol.
http://pytav.com/roster.php |
|
| Back to top |
|
 |
Hybuir
Gear Dependent Squirrel

Joined: 06 Sep 2005
Posts: 1536
Location: Austin, TX
WR Updates: 2,466,953
Hybuir WR Profile
|
|
| Back to top |
|
 |
lankyz0r
Joined: 07 Oct 2005
Posts: 26
WR Updates: 111,220
lankyz0r WR Profile
|
Posted: Fri Nov 18, 2005 6:22 am Post subject: |
|
|
having never setup a cron job, what command do i use to download the guild csv file? _________________
 |
|
| Back to top |
|
 |
Hybuir
Gear Dependent Squirrel

Joined: 06 Sep 2005
Posts: 1536
Location: Austin, TX
WR Updates: 2,466,953
Hybuir WR Profile
|
Posted: Fri Nov 18, 2005 6:35 am Post subject: |
|
|
Well if you run the php script it will automatically check to see if a newer version is available. A cron job might just be set up to run the file every hour, hour and a half, to make sure that the information is the most up to date. _________________
 
  |
|
| Back to top |
|
 |
Momboe
Joined: 14 Aug 2005
Posts: 1
WR Updates: 790
Momboe WR Profile
|
Posted: Fri Nov 18, 2005 11:47 pm Post subject: Newbie |
|
|
Hiya. Read in the post that you might create a self installing SQL script. Was wondering if it was available?
I tried several times to get the script to work but had zero luck. I have basic knowledge of HTML. And pretty much know nothing about PHP.
My Webhost is PowWeb.com and offers the following:
______________________________
FrontPage 98/2000/2002 Extensions
PHP4 & PHP5 w/Zend Optimizer, Perl5, Sendmail
CGI-BIN, SSI, .htaccess, Cronjobs
Flash, Shockwave, Midi, Multimedia Support
MySQL Databases
phpMyAdmin
______________________________
Should my site be able to run your code?
Any step by step information would be awesome as well. The site URL is www.wowslackers.com
Thanks for any help in advance  |
|
| Back to top |
|
 |
Rollie
Site Admin

Joined: 28 Nov 2004
Posts: 5370
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile
|
Posted: Sat Nov 19, 2005 10:44 am Post subject: |
|
|
| Your site should be able to run it. I have not set up a self installer yet, sorry. |
|
| Back to top |
|
 |
credendum
Joined: 18 Jul 2005
Posts: 5
WR Updates: 349
credendum WR Profile
|
Posted: Sat Nov 26, 2005 6:14 am Post subject: |
|
|
Hey i'm back ok i forgot all about this thing and don't remember how I did it last time.. so... here we go.
#1 Where do I put the code
#2 What do i do after I have the code in
#3 yea.
lol.. lil help if ya would  |
|
| Back to top |
|
 |
Rollie
Site Admin

Joined: 28 Nov 2004
Posts: 5370
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile
|
Posted: Sat Nov 26, 2005 4:02 pm Post subject: |
|
|
| Umm... you need to make sure that your host supports php. Next, just put the code into a file, say roster.php. Make sure you have the proper write permissions and give it a whirl! |
|
| Back to top |
|
 |
Hybuir
Gear Dependent Squirrel

Joined: 06 Sep 2005
Posts: 1536
Location: Austin, TX
WR Updates: 2,466,953
Hybuir WR Profile
|
Posted: Tue Dec 13, 2005 2:53 pm Post subject: Ok here's what I did |
|
|
Ok here's what happened... I was tired of my guild being all about numbers and wrote this little script using the base code for processing the guild roster. What it does is go through the last seen number and compares it to the thresholds that you can set up. In this case, if someone has logged within the last 2 weeks they're Active, over 2 weeks but within 30 days, they are marked as Idle, after 30 days they're Inactive.
To further illustrate this point I went ahead and broke down the level ranges either 1-19, 20-39, 40-59, and 60. I really hate my guild now because they wont remove inactives!!!! Bastards! Deviants!!!!!
Working Example:
http://reapers.ws/guild_at_a_glance/activity.php
| Code: | <?php
//
// Rostertest.php
//
// Sample guild export downloader and display
// You may use this script as you wish. This is only some sample code
// provided to help get a jumpstart!
//
// Created: 1/27/2005
//
// Author: Cooper Sellers aka Rollie - Bloodscalp
// A Tinkering Called: True Guild Colors :-D
// Tinkerer: Junior Dimas aka Hybuir - Boulderfist <Reapers> cdimas@gmail.com
$local_directory = ""; // this is the directory where your local files
// will be written to and read from. Make sure
// you have WRITE priveledges on this directory
$guild_id = 146466; // get this number from the link posted on the
// guilddisplay.php page
$guild_name = "Reapers"; // Variables to link back to your guilds full info
$server_id = "52"; // on WarcraftRealms.com
$server_name = "Boulderfist";
$PHP_SELF = $_SERVER["PHP_SELF"]; //To show Source Code
$endr = "<a href=$PHP_SELF?source>Get the Source Code</a>";
if (isset($_GET["source"])) { // source display
echo $endr;
highlight_file(__FILE__);
die();
}
//
// Remember to check the status file so that you are not pulling data
// more than once per day
//
$localstatusfile = $local_directory . "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 );
}
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 );
}
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 = $local_directory . "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
//
$filename = 'http://www.warcraftrealms.com/exports/guildexport.php?guildid=' . $guild_id;
$infile = fopen ($filename, "r");
if (!$infile)
{
echo "<p>Unable to open remote file.<br>\n";
exit;
}
$outfilename = $local_directory . "guildroster.txt";
$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);
}
//
// Now let's just output our roster as it's given
//
$filename = $local_directory . "guildroster.txt";
$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);
//Activity threshold variables in DAYS
$idle = 14; //before $idle days you are active
$inactive = 30; //after $idle days and before $inacive day you are idle
//after $inacive days you are... uhm... inacive
$seconds_in_a_day = 24*60*60; //self explanitory.
//Initiallize all counts
$total_count=0;
$inactive_count=0;
$inactive_01_19=0;
$inactive_20_39=0;
$inactive_40_59=0;
$inactive_60=0;
$idle_count=0;
$idle_01_19=0;
$idle_20_39=0;
$idle_40_59=0;
$idle_60=0;
$active_count=0;
$active_01_19=0;
$active_20_39=0;
$active_40_59=0;
$active_60=0;
// read the entries
while (!feof ($infile))
{
$buffer = fgets($infile, 4096);
list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",",$buffer);
$interval = ((time() - strtotime($last_seen))/86400); //takes the interval in seconds and converts into days
$total_count = $total_count + 1;
if ($interval <= $idle) {
$active_count = $active_count + 1;
if ( $level < 20 ) {
$active_01_19 = $active_01_19 + 1;
}
else if ( $level <= 39 ) {
$active_20_39 = $active_20_39 + 1;
}
else if ( $level <=59 ) {
$active_40_59 = $active_40_59 + 1;
}
else if ( $level == 60 ) {
$active_60 = $active_60 + 1;
}
}
else if ( $interval > $idle && $interval < $inactive) {
$idle_count = $idle_count + 1;
if ( $level < 20 ) {
$idle_01_19 = $idle_01_19 + 1;
}
else if ( $level <= 39 ) {
$idle_20_39 = $idle_20_39 + 1;
}
else if ( $level <=59 ) {
$idle_40_59 = $idle_40_59 + 1;
}
else if ( $level == 60 ) {
$idle_60 = $idle_60 + 1;
}
}
else if ( $interval > $inactive ) {
$inactive_count = $inactive_count + 1;
if ( $level < 20 ) {
$inactive_01_19 = $inactive_01_19 + 1;
}
else if ( $level <= 39 ) {
$inactive_20_39 = $inactive_20_39 + 1;
}
else if ( $level <=59 ) {
$inactive_40_59 = $inactive_40_59 + 1;
}
else if ( $level == 60 ) {
$inactive_60 = $inactive_60 + 1;
}
}
}
echo ' <table bordercolor="#000000" border="1px">';
echo ' <tr>';
echo ' <td colspan="7"><div align="center">Guild True Colors - <a href=http://www.warcraftrealms.com/census.php?guildid=' . $guild_id . ' target=_guild>'. $guild_name . '</a> - <a href=http://www.warcraftrealms.com/census.php?serverid=' . $server_id . ' target=_server>' . $server_name .'</a> </div></td>';
echo ' </tr>';
echo ' <tr><td><div align="center"><b>Activity</b></div></td><td><div align="center"><b>1-19</b></div></td><td><div align="center"><b>20-39</b></div></td><td><div align="center"><b>40-59</b></div></td><td><div align="center"><b>60</b></div></td><td><div align="center"><b>Percent</b></div></td><td><div align="center"><b>#</b></div></td></tr>';
echo ' <tr>';
echo ' <td style="BACKGROUND-COLOR: red">Inactive</td>';
echo ' <td style="BACKGROUND-COLOR: red"><div align="center">' . $inactive_01_19 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: red"><div align="center">' . $inactive_20_39 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: red"><div align="center">' . $inactive_40_59 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: red"><div align="center">' . $inactive_60 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: red"><div align="center">' . round(($inactive_count/$total_count)*100) . '%</div></td>';
echo ' <td style="BACKGROUND-COLOR: red"><div align="center">' . $inactive_count . '</div></td>';
echo ' </tr>';
echo ' <tr>';
echo ' <td style="BACKGROUND-COLOR: #ffcc99">Idle</td>';
echo ' <td style="BACKGROUND-COLOR: #ffcc99"><div align="center">' . $idle_01_19 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: #ffcc99"><div align="center">' . $idle_20_39 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: #ffcc99"><div align="center">' . $idle_40_59 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: #ffcc99"><div align="center">' . $idle_60 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: #ffcc99"><div align="center">' . round(($idle_count/$total_count)*100) . '%</div></td>';
echo ' <td style="BACKGROUND-COLOR: #ffcc99"><div align="center">' . $idle_count . '</div></td>';
echo ' </tr>';
echo ' <tr>';
echo ' <td style="BACKGROUND-COLOR: #ccffcc">Active</td>';
echo ' <td style="BACKGROUND-COLOR: #ccffcc"><div align="center">' . $active_01_19 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: #ccffcc"><div align="center">' . $active_20_39 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: #ccffcc"><div align="center">' . $active_40_59 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: #ccffcc"><div align="center">' . $active_60 . '</div></td>';
echo ' <td style="BACKGROUND-COLOR: #ccffcc"><div align="center">' . round(($active_count/$total_count)*100) . '%</div></td>';
echo ' <td style="BACKGROUND-COLOR: #ccffcc"><div align="center">' . $active_count . '</div></td>';
echo ' </tr>';
echo ' <tr>';
echo ' <td colspan="5"> </td><td><b><div align="right">Total</b></div></td><td><b>' . $total_count . '</b></td>';
echo ' </tr>';
echo ' <tr>';
echo ' <td colspan="7"> <div align="center"><font size="1">Updated ' . strftime("%m/%d/%y %H:%M:%S",$remote_timestamp) . '. Guild data provided by <a href=http://www.warcraftrealms.com target=_new>WarcraftRealms.com</a>.</font></div></td>';
echo ' </tr>';
echo ' </table>';
echo ' <small>* Active is defined as last login within ' . $idle . ' days.</small><br>';
echo ' <small>* Idle is defined as last login between ' . $idle . ' and ' . $inactive .' days.</small><br>';
echo ' <small>* Inactive is defined as last login after ' . $inactive . ' days.</small><br>';
echo $endr;
?> |
_________________
 
  |
|
| Back to top |
|
 |
Skyfire
Trolling Enforcement
Joined: 18 Aug 2005
Posts: 748
Location: New Jersey
WR Updates: 44,279
Skyfire WR Profile
|
Posted: Tue Dec 13, 2005 8:19 pm Post subject: |
|
|
Prolly the majority of them are alts... _________________ Admin on WoWWiki
Moderator, Blogger on Wowhead |
|
| Back to top |
|
 |
Hybuir
Gear Dependent Squirrel

Joined: 06 Sep 2005
Posts: 1536
Location: Austin, TX
WR Updates: 2,466,953
Hybuir WR Profile
|
Posted: Tue Dec 13, 2005 9:03 pm Post subject: |
|
|
The sad part is that they're not  _________________
 
  |
|
| Back to top |
|
 |
Skyfire
Trolling Enforcement
Joined: 18 Aug 2005
Posts: 748
Location: New Jersey
WR Updates: 44,279
Skyfire WR Profile
|
|
| Back to top |
|
 |
Hybuir
Gear Dependent Squirrel

Joined: 06 Sep 2005
Posts: 1536
Location: Austin, TX
WR Updates: 2,466,953
Hybuir WR Profile
|
Posted: Wed Dec 14, 2005 1:41 am Post subject: |
|
|
this is exactly why I made this script. _________________
 
  |
|
| Back to top |
|
 |
Jack|Paladin
Joined: 19 Dec 2005
Posts: 1
WR Updates: 0
Jack|Paladin WR Profile
|
Posted: Mon Dec 19, 2005 1:03 pm Post subject: |
|
|
Nice _________________
 |
|
| Back to top |
|
 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|