Page 4 of 5

Posted: Tue Sep 20, 2005 6:08 pm
by Prinz
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 8)


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!

Guild at a Glance

Posted: Thu Sep 22, 2005 8:01 pm
by Hybuir
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: Select all

<?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&#58; 1/27/2005    
    // 
    //  Author&#58;  Cooper Sellers aka Rollie - Bloodscalp 

	//		A Tinkering Called&#58; Guild at a Glance
    // 		Tinkerer&#58; Junior Dimas aka Hybuir - Boulderfist <Reapers> cdimas@gmail.com
	//		Note&#58; 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&#91;"PHP_SELF"&#93;;  //To show Source Code
	$endr = "<a href=$PHP_SELF?source>Get the Source Code</a>";
	if &#40;isset&#40;$_GET&#91;"source"&#93;&#41;&#41; &#123; // source display 
    	echo $endr; 
	    highlight_file&#40;__FILE__&#41;; 
	    die&#40;&#41;; 
	&#125;                                 


    // 
    //  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 &#40;$localstatusfile, "r"&#41;; 
    $current_timestamp = 0; 
    if &#40;!$infile&#41; 
    &#123; 
        echo "<p>No status file available, assuming this is the first run<br>"; 
    &#125; 
    else 
    &#123; 
        //  read our status file time 
        $buffer = fgets&#40;$infile, 4096&#41;; 

        $current_timestamp = trim&#40; $buffer &#41;; 
    &#125; 
    fclose&#40; $infile &#41;;         //  close our local status file 
    
    $filename = "http&#58;//www.warcraftrealms.com/exports/status.txt"; 
    $infile = fopen &#40;$filename, "r"&#41;;   // open remote status file 
    if &#40;!$infile&#41; 
    &#123; 
        echo "<p>Unable to open status file.<br>"; 
        exit; 
    &#125; 

    $remote_timestamp = 0; 
    if&#40;!feof &#40;$infile&#41;&#41;   // only 1 read should be needed for the status file 
    &#123; 
        $buffer = fgets&#40;$infile, 4096&#41;; 
        $remote_timestamp = trim&#40; $buffer &#41;; 
    &#125; 
    fclose&#40; $infile &#41;;  //  close the remote status file 

    if&#40; $remote_timestamp - $current_timestamp > 86400 &#41; //  1 day = 60*60*24 
    &#123; 
        // 
        //  We can do a full get 
        // 

        //  write our new status file 
        $outfilename = $local_directory . "status.txt"; 
        $outfile = fopen&#40;$outfilename, "w"&#41;; 
        if&#40; !$outfile &#41; 
        &#123; 
            echo "<p>Unable to open save file => " . $outfilename . "<br>"; 
            exit; 
        &#125; 

        fputs&#40;$outfile, $buffer&#41;; 
        fclose&#40;$outfile&#41;; 

        // 
        //  Now get our guild roster file 
        // 
        $filename = 'http&#58;//www.warcraftrealms.com/exports/guildexport.php?guildid=' . $guild_id; 
        $infile = fopen &#40;$filename, "r"&#41;; 
        if &#40;!$infile&#41; 
        &#123; 
            echo "<p>Unable to open remote file.<br>\n"; 
            exit; 
        &#125; 

        $outfilename = $local_directory . "guildroster.txt"; 
        $outfile = fopen&#40;$outfilename, "w"&#41;; 
        if&#40; !$outfile &#41; 
        &#123; 
            echo "<p>Unable to open save file => " . $outfilename . "<br>\n"; 
            exit; 
        &#125; 

        while &#40;!feof &#40;$infile&#41;&#41; 
        &#123; 
            $buffer = fgets&#40;$infile, 4096&#41;; 
            fputs&#40;$outfile, $buffer&#41;; 
        &#125; 

        fclose&#40;$outfile&#41;; 
        fclose&#40;$infile&#41;; 
    &#125; 
    // 
    //  Now let's just output our roster as it's given 
    // 
    $filename = $local_directory . "guildroster.txt"; 
    $infile = fopen &#40;$filename, "r"&#41;; 
    if &#40;!$infile&#41; 
    &#123; 
        echo "<p>Unable to open local roster file.<br>"; 
        exit; 
    &#125; 

    //Do one read to get the header 
    $buffer = fgets&#40;$infile, 4096&#41;; 
	//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 &#40;!feof &#40;$infile&#41;&#41; 
    &#123; 
        $buffer = fgets&#40;$infile, 4096&#41;; 
        list&#40; $name, $race, $class, $level, $last_seen, $rank &#41; = explode&#40;",",$buffer&#41;; 

	$total_count = $total_count + 1;
	$level_count = $level_count + $level;

	if &#40;$class == "Druid"&#41;
	&#123;
	$druid_count = $druid_count + 1;
		if &#40;$level>="40"&#41; &#123; $druid_mount = $druid_mount + 1; &#125;
	&#125;
		else if &#40;$class  == "Hunter"&#41;
		&#123;
		$hunter_count = $hunter_count + 1;
			if &#40;$level>="40"&#41; &#123; $hunter_mount = $hunter_mount + 1; &#125;
		&#125;
			else if &#40;$class == "Mage"&#41;
			&#123;
			$mage_count = $mage_count + 1;
				if &#40;$level>="40"&#41; &#123; $mage_mount = $mage_mount + 1; &#125;
			&#125;
				else if &#40;$class == "Priest"&#41;
				&#123;
				$priest_count = $priest_count + 1;
					if &#40;$level>="40"&#41; &#123; $priest_mount = $priest_mount + 1; &#125;
				&#125;
					else if &#40;$class == "Rogue"&#41;
					&#123;
					$rogue_count = $rogue_count + 1;
						if &#40;$level>="40"&#41; &#123; $rogue_mount = $rogue_mount + 1; &#125;
					&#125;

						else if &#40;$class == "Warlock"&#41;
						&#123;
						$warlock_count = $warlock_count + 1;
							if &#40;$level>="40"&#41; &#123; $warlock_mount = $warlock_mount + 1; &#125;
						&#125;
							else if &#40;$class == "Warrior"&#41;
							&#123;
							$warrior_count = $warrior_count + 1;
								if &#40;$level>="40"&#41; &#123; $warrior_mount = $warrior_mount + 1; &#125;
							&#125;
								else if &#40;$class == "Shaman"&#41; // Can be changed for Paladins
								&#123;
								$shaman_count = $shaman_count + 1;
									if &#40;$level>="40"&#41; &#123; $shaman_mount = $shaman_mount + 1; &#125;
								&#125;
    &#125; 

	// Start of finding out the percentages of the classess
    $druid_per = round&#40;&#40;$druid_count/$total_count&#41; * 100,1&#41;;
    $hunter_per = round&#40;&#40;$hunter_count/$total_count&#41; * 100,1&#41;;
    $mage_per = round&#40;&#40;$mage_count/$total_count&#41; * 100,1&#41;;
    $priest_per = round&#40;&#40;$priest_count/$total_count&#41; * 100,1&#41;;
    $rogue_per = round&#40;&#40;$rogue_count/$total_count&#41; * 100,1&#41;; 
    $shaman_per = round&#40;&#40;$shaman_count/$total_count&#41; * 100,1&#41;; 
    $warlock_per = round&#40;&#40;$warlock_count/$total_count&#41; * 100,1&#41;;
    $warrior_per = round&#40;&#40;$warrior_count/$total_count&#41; * 100,1&#41;;

	// Find out the percentages of players with mount capabilities
	$druid_mount_per = round&#40;&#40;$druid_mount/$druid_count&#41;*100&#41;;
	$hunter_mount_per = round&#40;&#40;$hunter_mount/$hunter_count&#41;*100&#41;;
	$mage_mount_per = round&#40;&#40;$mage_mount/$mage_count&#41;*100&#41;;
	$priest_mount_per = round&#40;&#40;$priest_mount/$priest_count&#41;*100&#41;;
	$rogue_mount_per = round&#40;&#40;$rogue_mount/$rogue_count&#41;*100&#41;;
	$shaman_mount_per = round&#40;&#40;$shaman_mount/$shaman_count&#41;*100&#41;;
	$warlock_mount_per = round&#40;&#40;$warlock_mount/$warlock_count&#41;*100&#41;;
	$warrior_mount_per = round&#40;&#40;$warrior_mount/$warrior_count&#41;*100&#41;;
    
	$total_mount = $druid_mount + $hunter_mount + $mage_mount + $priest_mount + $rogue_mount + $shaman_mount + $warlock_mount + $warrior_mount;
	$total_mount_per = round&#40;&#40;$total_mount/$total_count&#41;*100&#41;;

	// 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&#58;//www.warcraftrealms.com/census.php?guildid=' . $guild_id . ' target=_guild>'. $guild_name . '</a> - <a href=http&#58;//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  . ' &#40;' . $druid_mount_per  . '%&#41;</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  . ' &#40;' . $hunter_mount_per  . '%&#41;</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  . ' &#40;' . $mage_mount_per  . '%&#41;</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  . ' &#40;' . $priest_mount_per  . '%&#41;</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  . ' &#40;' . $rogue_mount_per  . '%&#41;</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  . ' &#40;' . $shaman_mount_per  . '%&#41;</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  . ' &#40;' . $warlock_mount_per  . '%&#41;</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  . ' &#40;' . $warrior_mount_per  . '%&#41;</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">&nbsp;</div></td>';
	echo ' <td><div align="center"><strong> ' . $total_mount  . ' &#40;' . $total_mount_per . '%&#41;</strong></div></td>';
	echo ' </tr> <tr valign="bottom">';
	echo ' <td colspan="4"> <div align="center"><font size="1">Updated ' . strftime&#40;"%m/%d/%y %H&#58;%M&#58;%S",$remote_timestamp&#41; . '. Guild data provided by <a href=http&#58;//www.warcraftrealms.com target=_new>WarcraftRealms.com</a>.</font></div></td>';
	echo ' </tr>';
	echo '</table>';
	echo $endr;
?>

no fopen support but still run the guildroster on your site

Posted: Tue Oct 04, 2005 3:37 pm
by Keitaran ;-)
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: Select all

<?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&#58; 1/27/2005   
    //
    //  Author&#58;  Cooper Sellers aka Rollie - Bloodscalp
    //
    //
    //  Now let's just output our roster as it's given
    //
    $filename = $local_directory . "guildroster.txt";
    $infile = fopen &#40;$filename, "r"&#41;;
    if &#40;!$infile&#41;
    &#123;
        echo "<p>Unable to open local roster file.<br>";
        exit;
    &#125;

    //  do one read to get the header
    $buffer = fgets&#40;$infile, 4096&#41;;

    //  read the entries
    echo '<table style="margin-left&#58; 180px; margin-right&#58; auto; margin-top&#58; 230px; text-align&#58; left; width&#58; 80%; height&#58; 60px;" border="1" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>Name</small></td><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>Rasse</small></td><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>Klasse</small></td><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>Level</small></td><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>Zuletzt gesehen</small></td><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>Rang</small></td></tr><tr>';
    while &#40;!feof &#40;$infile&#41;&#41;
    &#123;
        $buffer = fgets&#40;$infile, 4096&#41;;
        list&#40; $name, $race, $class, $level, $last_seen, $rank &#41; = explode&#40;",",$buffer&#41;;

        $member_count++; 

        echo '<tr><td style="font-family&#58; Verdana;"><small>' . $name . '</small></td><td style="font-family&#58; Verdana;"><small>' . $race . '</small></td><td style="font-family&#58; Verdana;"><small>' . $class . '</small></td><td style="font-family&#58; Verdana;"><small>' . $level . '</small></td><td style="font-family&#58; Verdana;"><small>' . $last_seen . '</small></td><td style="font-family&#58; Verdana;"><small>' . $rank . '</small></td></tr>';
    &#125;
    echo '</table>';
   


echo '<table class="content"><tr><td class="topcontent"><center>Statistics</center><tr><td class="content">';
echo "Total Members&#58; ";
echo "$member_count";
echo '</center>';
echo "Guild data provided by <a href='http&#58;//www.warcraftrealms.com/'>WarcraftRealms.com</a>.";
echo '</td></tr></table>';

   

?>
If there's any better way please inform me :D[/url]

bah

Posted: Tue Oct 04, 2005 3:38 pm
by Keitaran
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: Select all

    //  read the entries
    echo '<table style="margin-left&#58; 180px; margin-right&#58; auto; margin-top&#58; 230px; text-align&#58; left; width&#58; 80%; height&#58; 60px;" border="1" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>Name</small></td><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>Race</small></td><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>class</small></td><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>Level</small></td><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>Last seen</small></td><td style="font-weight&#58; bold; font-family&#58; Verdana;"><small>Rank</small></td></tr><tr>';

Guild in a glance

Posted: Tue Oct 04, 2005 4:15 pm
by Keitaran
Looks realy nice Hybuir thanks a lot i'll add it to my site

Re: Guild in a glance

Posted: Tue Oct 04, 2005 4:41 pm
by Hybuir
Keitaran wrote:Looks realy nice Hybuir thanks a lot i'll add it to my site
Thanks :D

Posted: Wed Oct 05, 2005 11:25 am
by pyrus
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

Guild at a Glance 2.0

Posted: Tue Oct 18, 2005 10:12 am
by Hybuir
Added level 60 count for individual clasess for "Guild At A Glance"

Source code and a working example at:
http://www.reapers.ws/guild_at_a_glance/sixty.php

Posted: Fri Nov 18, 2005 6:22 am
by lankyz0r
having never setup a cron job, what command do i use to download the guild csv file?

Posted: Fri Nov 18, 2005 6:35 am
by Hybuir
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.

Newbie

Posted: Fri Nov 18, 2005 11:47 pm
by Momboe
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 :)

Posted: Sat Nov 19, 2005 10:44 am
by Rollie
Your site should be able to run it. I have not set up a self installer yet, sorry.

Posted: Sat Nov 26, 2005 6:14 am
by credendum
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 :)

Posted: Sat Nov 26, 2005 4:02 pm
by Rollie
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!

Ok here's what I did

Posted: Tue Dec 13, 2005 2:53 pm
by Hybuir
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!!!!! :evil:

Working Example:
http://reapers.ws/guild_at_a_glance/activity.php

Code: Select all

<?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&#58; 1/27/2005     
    // 
    //  Author&#58;  Cooper Sellers aka Rollie - Bloodscalp  

    //      A Tinkering Called&#58; True Guild Colors &#58;-D  
    //       Tinkerer&#58; 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&#91;"PHP_SELF"&#93;;  //To show Source Code  
   $endr = "<a href=$PHP_SELF?source>Get the Source Code</a>";  
   if &#40;isset&#40;$_GET&#91;"source"&#93;&#41;&#41; &#123; // source display  
       echo $endr;  
       highlight_file&#40;__FILE__&#41;;  
       die&#40;&#41;;  
   &#125;                                   


    //  
    //  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 &#40;$localstatusfile, "r"&#41;;  
    $current_timestamp = 0;  
    if &#40;!$infile&#41;  
    &#123;  
        echo "<p>No status file available, assuming this is the first run<br>";  
    &#125;  
    else  
    &#123;  
        //  read our status file time  
        $buffer = fgets&#40;$infile, 4096&#41;;  

        $current_timestamp = trim&#40; $buffer &#41;;  
    &#125;  
    fclose&#40; $infile &#41;;         //  close our local status file  
     
    $filename = "http&#58;//www.warcraftrealms.com/exports/status.txt";  
    $infile = fopen &#40;$filename, "r"&#41;;   // open remote status file  
    if &#40;!$infile&#41;  
    &#123;  
        echo "<p>Unable to open status file.<br>";  
        exit;  
    &#125;  

    $remote_timestamp = 0;  
    if&#40;!feof &#40;$infile&#41;&#41;   // only 1 read should be needed for the status file  
    &#123;  
        $buffer = fgets&#40;$infile, 4096&#41;;  
        $remote_timestamp = trim&#40; $buffer &#41;;  
    &#125;  
    fclose&#40; $infile &#41;;  //  close the remote status file  

    if&#40; $remote_timestamp - $current_timestamp > 86400 &#41; //  1 day = 60*60*24  
    &#123;  
        //  
        //  We can do a full get  
        //  

        //  write our new status file  
        $outfilename = $local_directory . "status.txt";  
        $outfile = fopen&#40;$outfilename, "w"&#41;;  
        if&#40; !$outfile &#41;  
        &#123;  
            echo "<p>Unable to open save file => " . $outfilename . "<br>";  
            exit;  
        &#125;  

        fputs&#40;$outfile, $buffer&#41;;  
        fclose&#40;$outfile&#41;;  

        //  
        //  Now get our guild roster file  
        //  
        $filename = 'http&#58;//www.warcraftrealms.com/exports/guildexport.php?guildid=' . $guild_id;  
        $infile = fopen &#40;$filename, "r"&#41;;  
        if &#40;!$infile&#41;  
        &#123;  
            echo "<p>Unable to open remote file.<br>\n";  
            exit;  
        &#125;  

        $outfilename = $local_directory . "guildroster.txt";  
        $outfile = fopen&#40;$outfilename, "w"&#41;;  
        if&#40; !$outfile &#41;  
        &#123;  
            echo "<p>Unable to open save file => " . $outfilename . "<br>\n";  
            exit;  
        &#125;  

        while &#40;!feof &#40;$infile&#41;&#41;  
        &#123;  
            $buffer = fgets&#40;$infile, 4096&#41;;  
            fputs&#40;$outfile, $buffer&#41;;  
        &#125;  

        fclose&#40;$outfile&#41;;  
        fclose&#40;$infile&#41;;  
    &#125;  
    //  
    //  Now let's just output our roster as it's given  
    //  
    $filename = $local_directory . "guildroster.txt";  
    $infile = fopen &#40;$filename, "r"&#41;;  
    if &#40;!$infile&#41;  
    &#123;  
        echo "<p>Unable to open local roster file.<br>";  
        exit;  
    &#125;  

    //Do one read to get the header  
    $buffer = fgets&#40;$infile, 4096&#41;;  

   //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 &#40;!feof &#40;$infile&#41;&#41;  
    &#123;  
        $buffer = fgets&#40;$infile, 4096&#41;;  
        list&#40; $name, $race, $class, $level, $last_seen, $rank &#41; = explode&#40;",",$buffer&#41;;  
     
    $interval = &#40;&#40;time&#40;&#41; - strtotime&#40;$last_seen&#41;&#41;/86400&#41;; //takes the interval in seconds and converts into days 

    $total_count = $total_count + 1;  

    if &#40;$interval <= $idle&#41;  &#123; 
        $active_count = $active_count + 1; 

        if &#40; $level < 20 &#41; &#123; 
        $active_01_19 = $active_01_19 + 1; 
        &#125; 
            else if &#40; $level <= 39 &#41; &#123; 
            $active_20_39 = $active_20_39 + 1; 
            &#125; 
                else if &#40; $level <=59 &#41; &#123; 
                $active_40_59 = $active_40_59 + 1; 
                &#125; 
                    else if &#40; $level == 60 &#41; &#123; 
                    $active_60 = $active_60 + 1; 
                    &#125;     
    &#125; 

    else if &#40; $interval > $idle && $interval < $inactive&#41; &#123; 
        $idle_count = $idle_count + 1; 

        if &#40; $level < 20 &#41; &#123; 
        $idle_01_19 = $idle_01_19 + 1; 
        &#125; 
            else if &#40; $level <= 39 &#41; &#123; 
            $idle_20_39 = $idle_20_39 + 1; 
            &#125; 
                else if &#40; $level <=59 &#41; &#123; 
                $idle_40_59 = $idle_40_59 + 1; 
                &#125; 
                    else if &#40; $level == 60 &#41; &#123; 
                    $idle_60 = $idle_60 + 1; 
                    &#125;         
     
    &#125; 
    else if &#40; $interval > $inactive &#41; &#123;  
        $inactive_count = $inactive_count + 1; 

        if &#40; $level < 20 &#41; &#123; 
        $inactive_01_19 = $inactive_01_19 + 1; 
        &#125; 
            else if &#40; $level <= 39 &#41; &#123; 
            $inactive_20_39 = $inactive_20_39 + 1; 
            &#125; 
                else if &#40; $level <=59 &#41; &#123; 
                $inactive_40_59 = $inactive_40_59 + 1; 
                &#125; 
                    else if &#40; $level == 60 &#41; &#123; 
                    $inactive_60 = $inactive_60 + 1; 
                    &#125; 
    &#125; 


    &#125;  

echo ' <table bordercolor="#000000" border="1px">';   
echo ' <tr>';   
echo ' <td colspan="7"><div align="center">Guild True Colors - <a href=http&#58;//www.warcraftrealms.com/census.php?guildid=' . $guild_id . ' target=_guild>'. $guild_name . '</a> - <a href=http&#58;//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&#58; red">Inactive</td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; red"><div align="center">' . $inactive_01_19 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; red"><div align="center">' . $inactive_20_39 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; red"><div align="center">' . $inactive_40_59 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; red"><div align="center">' . $inactive_60 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; red"><div align="center">' . round&#40;&#40;$inactive_count/$total_count&#41;*100&#41; . '%</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; red"><div align="center">' . $inactive_count . '</div></td>'; 
echo ' </tr>'; 

echo ' <tr>';  
echo ' <td style="BACKGROUND-COLOR&#58; #ffcc99">Idle</td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ffcc99"><div align="center">' . $idle_01_19 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ffcc99"><div align="center">' . $idle_20_39 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ffcc99"><div align="center">' . $idle_40_59 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ffcc99"><div align="center">' . $idle_60 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ffcc99"><div align="center">' . round&#40;&#40;$idle_count/$total_count&#41;*100&#41; . '%</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ffcc99"><div align="center">' . $idle_count . '</div></td>'; 
echo ' </tr>'; 

echo ' <tr>';  
echo ' <td style="BACKGROUND-COLOR&#58; #ccffcc">Active</td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ccffcc"><div align="center">' . $active_01_19 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ccffcc"><div align="center">' . $active_20_39 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ccffcc"><div align="center">' . $active_40_59 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ccffcc"><div align="center">' . $active_60 . '</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ccffcc"><div align="center">' . round&#40;&#40;$active_count/$total_count&#41;*100&#41; . '%</div></td>'; 
echo ' <td style="BACKGROUND-COLOR&#58; #ccffcc"><div align="center">' . $active_count . '</div></td>'; 
echo ' </tr>'; 

echo ' <tr>'; 
echo ' <td colspan="5">&nbsp;</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&#40;"%m/%d/%y %H&#58;%M&#58;%S",$remote_timestamp&#41; . '. Guild data provided by <a href=http&#58;//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; 
?> 

Posted: Tue Dec 13, 2005 8:19 pm
by Skyfire
Prolly the majority of them are alts...

Posted: Tue Dec 13, 2005 9:03 pm
by Hybuir
The sad part is that they're not :evil: :shock:

Posted: Tue Dec 13, 2005 11:49 pm
by Skyfire
:shock:

Posted: Wed Dec 14, 2005 1:41 am
by Hybuir
this is exactly why I made this script.

Posted: Mon Dec 19, 2005 1:03 pm
by Jack|Paladin
Nice