WarcraftReamls.com
  FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups   RegisterRegister 
  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Log inLog in 
Some sample guild export code
Goto page Previous  1, 2, 3, 4, 5
 
Post new topic   This topic is locked: you cannot edit posts or make replies.    WarcraftRealms.com Forum Index -> WarcraftRealms Developers
View previous topic :: View next topic  
Author Message
Jundar



Joined: 19 Feb 2006
Posts: 7

WR Updates: 8,381
Jundar WR Profile

PostPosted: Tue Feb 21, 2006 6:26 pm    Post subject: Reply with quote

I realize this is probably all old news, but here's my use of your efforts:
http://horderlies.com/index.php?id=members
The WCR link is in the middle section, i was moving the tables around to decide where I liked which parts where.. thats where it ended up, but it is there (the credit)

hehe, don't laught Cool
Also.. the "Idle" character's isn't quite right (For sure the Idle 60s), but i'll figure that out later.
_________________
Please, Don't squeeze the Shaman!
Back to top
View user's profile Send private message
Jundar



Joined: 19 Feb 2006
Posts: 7

WR Updates: 8,381
Jundar WR Profile

PostPosted: Fri Mar 03, 2006 11:12 am    Post subject: Reply with quote

Ok, i am encountering a problem.
The "Guild at a glance" code works, the "Guild Activity" code works (as in they both reflect the correct # of guild members).
However, the Member List isn't working properly with updating new members or member levels..
http://horderlies.com/index.php?id=members

Even when the Remote and Local data match up the list doesn't properly reflect the correct data or members compared to the list on the WCR site.
http://www.warcraftrealms.com/guilddisplay.php?guildid=436705

Why is it that the otehr 2 codes reflect the correct data but not the member list?
any suggestions?
_________________
Please, Don't squeeze the Shaman!
Back to top
View user's profile Send private message
Jundar



Joined: 19 Feb 2006
Posts: 7

WR Updates: 8,381
Jundar WR Profile

PostPosted: Sat Mar 11, 2006 2:02 pm    Post subject: Reply with quote

wow, thanks for the help Wink
Anyway, Its working now. I had to point the path to the local txt file and not the csv file and since then everything seems to be updating properly now.
Yay!

Now, if only WCR profilers worked eh? i'd be in heaven
_________________
Please, Don't squeeze the Shaman!
Back to top
View user's profile Send private message
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Sun Mar 12, 2006 9:11 pm    Post subject: Reply with quote

Gonna get those profiles back in order very soon. I'm going to do all I can to allot the time to fix them this week.

Glad you got your export code working =)
Back to top
View user's profile Send private message Visit poster's website
Jundar



Joined: 19 Feb 2006
Posts: 7

WR Updates: 8,381
Jundar WR Profile

PostPosted: Mon Mar 13, 2006 7:08 pm    Post subject: Reply with quote

Hey Thanks a bunch!
My next goal is to try to get the report to color code each table row (or the text within, rather) based on the Class.
my php is no where near that advanced but I am sure I can figure it out from similar situations on other forums.

Ah, if it weren't for gaming, i'd just be a useless tool.
but for now, i'm a wrench being used as a hammer. Wink
_________________
Please, Don't squeeze the Shaman!
Back to top
View user's profile Send private message
dantoonina



Joined: 01 Jun 2006
Posts: 3

WR Updates: 0
dantoonina WR Profile

PostPosted: Thu Jun 01, 2006 3:48 pm    Post subject: Can I get your help? Reply with quote

I can't seem to get this working, can you send me a php file that works?

$local_directory = "roster/";
$guild_id = 595244;
These are the guilds settings.

Rollie wrote:
When you get it up and running, drop a link so I can check out your handywork!
Back to top
View user's profile Send private message MSN Messenger
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Thu Jun 01, 2006 4:15 pm    Post subject: Reply with quote

What seems to be the problem? Where is it breaking?

It is likely your directory permissions are not set properly, or that your site host does not allow remote fopen calls.
Back to top
View user's profile Send private message Visit poster's website
dantoonina



Joined: 01 Jun 2006
Posts: 3

WR Updates: 0
dantoonina WR Profile

PostPosted: Thu Jun 01, 2006 4:20 pm    Post subject: Re: Guild at a Glance Reply with quote

I need help, I have tried and tried to get your script to work, here is ther errors I am getting:

File Last Updated at : 12/31/69 17:00:00

Warning: fopen(): URL file-access is disabled in the server configuration in /home/content/S/O/L/SOLGuild/html/roster.php on line 44

Warning: fopen(http://www.warcraftrealms.com/exports/status.txt): failed to open stream: no suitable wrapper could be found in /home/content/S/O/L/SOLGuild/html/roster.php on line 44
Unable to open status file.

How do I fix this, what did I do wrong?



[quote="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/
Back to top
View user's profile Send private message MSN Messenger
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Thu Jun 01, 2006 4:47 pm    Post subject: Reply with quote

There's your problem right there. fopen on URL is disabled on your server. YOu could try the CURL version.

http://www.warcraftrealms.com/forum/viewtopic.php?p=6049#6049
Back to top
View user's profile Send private message Visit poster's website
villavengore



Joined: 24 Feb 2006
Posts: 13

WR Updates: 95,696
villavengore WR Profile

PostPosted: Thu Jun 15, 2006 9:32 am    Post subject: Reply with quote

Thank you guys sooooo much for all the help that there was on this thread.


http://www.sgone.info/roster2.php

http://www.sgone.info/roster1.php

needs working on for formatting etc - but it works! Wink Wink Wink
_________________

Back to top
View user's profile Send private message
Skraggy



Joined: 22 Dec 2005
Posts: 5

WR Updates: 3,032
Skraggy WR Profile

PostPosted: Fri Jun 16, 2006 11:51 am    Post subject: Reply with quote

I figure since I used Rollie's code as a base, I'd post here what I ended up with.

First, I split it out into two files, rostergrab.php which checks for new status file, and roster.php which is the main roster, and I just cron rostergrab.php. I don't really need my page hitting warcraftrealms everytime someone hits the page, so I wanted it separate.

So for rostergrab.php, I have this (which is just Rollie's code with the display part ripped out):

Code:
<?php
    //
    //  Rostergrab.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
    //

    $local_directory = "download/";     //  this is the directory where your local files
                                //  will be written to and read from.  Make sure
                                //  you have WRITE privileges on this directory

    $guild_id        = 18447;   //  get this number from the link posted on the
                                //  guilddisplay.php page



    //
    //  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 );

        echo 'Local status file reads : ' . strftime("%m/%d/%y %H:%M:%S",$current_timestamp) . '<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 );

        echo 'Remote status file reads : ' . strftime("%m/%d/%y %H:%M:%S",$remote_timestamp) . '<br>';

    }
    fclose( $infile );  //  close the remote status file

    if( $remote_timestamp - $current_timestamp > 79200 ) //  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.csv";
        $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);
    }

?>


And then for my main guild list, I wanted it split out by class, and sorted by guild rank, display pvp rank and activity, so I came up with the following:

Code:
<?php
    //  Author:  Skraggy of Aggramar, based on Rollie's sample code

    $local_directory = "download/";     //  this is the directory where your local files
                                //  will be written to and read from.  Make sure
                                //  you have WRITE privileges on this directory

    $rankorder = array('High Champion','Chief','Chieftan','Elder','Tribal Guardian','Oathsworn','Tribesman','Brave','Officer Alt','Tribealt','Unknown');
    $classorder = array('Druid','Hunter','Mage','Priest','Rogue','Shaman','Warlock','Warrior');

    // Read in roster file
    $filename = $local_directory . "guildroster.csv";
    $infile = fopen ($filename, "r");
    if (!$infile)
    {
        echo "<p>Unable to open local roster file.<br>";
        exit;
    }

    // Read header
    $header = fgetcsv($infile, 4096, ",");

    // Populate Guild List array
    while (($data = fgetcsv($infile, 4096, ",")) !== FALSE) {
       if (isset($header)) {
          foreach ($header as $key=>$heading) {
             $row[$heading]=(isset($data[$key])) ? $data[$key] : '';
          }
          $guildlist[]=$row;
       }
    }

    fclose($infile);

    while (list($key,$class) = each($classorder)) {
       printClass($class,$guildlist,$rankorder);
    }

    //  don't forget our credit link =)

    echo "<p> Guild data provided by <a href='http://www.warcraftrealms.com/'>WarcraftRealms.com</a>.</p>";

    function printClass($classname,$guildarray,$ranks) {
       while (list($key,$member) = each($guildarray)) {
          if ($member['Class'] == $classname) {
             $classlist[] = $member;
          }
       }
       $num = count($classlist);
       echo "<h3><a name=\"$classname\">$classname</a>: $num</h3>\n";
       echo '<table width="640" bgcolor="#5A1F0C"><tr><th>Name</th><th>Race</th><th>Level</th><th>Guild Rank</th><th>PvP Rank</th><th>Status</th></tr>';
       foreach ($ranks as $key=>$rank) {
          $ranklist = getRankList($rank,$classlist);
          if ($ranklist) {
             outputTable($ranklist);
          }
       }
       echo '</table>';
       return;
    }

    function getRankList($rankname,$classarray) {
       $return = false;
       while (list($key,$member) = each($classarray)) {
          if ($member['GuildRank'] == $rankname) {
             $return[] = $member;
          }
       }
       return $return;
    }

    function outputTable($sortedclass) {
       while (list($key,$member) = each($sortedclass)) {
          list($name,$race,$class,$level,$lastseen,$guildrank,$pvprank) = array_values($member);

          //Activity threshold variables in DAYS
          $idle = 14;
          $inactive = 30;

          $interval = ((time() - strtotime($lastseen))/86400);

          $status = '<font color="red">Inactive</font>';
          if ($interval <= $idle)  {
             $status = '<font color="#ccffcc">Active</font>';
          }
          else if ($interval > $idle && $interval < $inactive) {
             $status = '<font color="#ffcc99">Idle</font>';
          }

          // Horde Ranks
          $pvpranklist = array('','','','','', 'Scout', 'Grunt', 'Sergeant', 'Senior Sergeant', 'First Sergeant', 'Stone Guard', 'Blood Guard', 'Legionnaire', 'Centurion', 'Champion', 'Lieutenant General', 'General', 'General', 'Warlord', 'High Warlord');
          if (!$pvprank) $pvprank = '000004';
          $pvptitle = $pvpranklist[intval($pvprank)];

          echo '<tr><td>' . $name . '</td><td>' . $race . '</td><td>' . $level . '</td><td>' . $guildrank . '</td><td>' . $pvptitle . '</td><td>' . $status . '</td></tr>';

       }
       return;
    }
?>


Items to note if you want to use this is you'll have to change the rankorder value to list the ranks your guild has, and the order you want them displayed per class. Also, if you're alliance, you'll need to change the pvpranklist to the alliance ranks.

Anyway.... the result is you get something like this (which includes the other two activity and summary code snippets earlier in the thread): http://gamehaven.org/wow/tribe/roster.php
_________________


Last edited by Skraggy on Fri Jun 16, 2006 1:20 pm; edited 2 times in total
Back to top
View user's profile Send private message
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Fri Jun 16, 2006 1:07 pm    Post subject: Reply with quote

Very nice!
Back to top
View user's profile Send private message Visit poster's website
tszeusts



Joined: 25 Jul 2006
Posts: 4

WR Updates: 7,327
tszeusts WR Profile

PostPosted: Wed Aug 09, 2006 1:48 pm    Post subject: Reply with quote

I started to create a table in a MYSQL database hosted by 1&1, but noticed the disclaimer says the database is behind a firewall. Would I be able to use the sample code you have been so generous on providing? I am wondering if I create this database and put the table on my site whether or not it will even work, since 1&1 is hosting for me.

Thanks,
~T
Back to top
View user's profile Send private message
Skraggy



Joined: 22 Dec 2005
Posts: 5

WR Updates: 3,032
Skraggy WR Profile

PostPosted: Wed Aug 09, 2006 2:36 pm    Post subject: Reply with quote

tszeusts wrote:
I started to create a table in a MYSQL database hosted by 1&1, but noticed the disclaimer says the database is behind a firewall. Would I be able to use the sample code you have been so generous on providing? I am wondering if I create this database and put the table on my site whether or not it will even work, since 1&1 is hosting for me.


If your site is hosted at 1&1 as well as the database, you should have no problem using any code to put information into and access the database.

You would only have a problem if you tried to access the database directly from a web site hosted elsewhere.

None of the code in this thread requires a database however (it's all done in flat files) unless that's functionality you are planning on adding to your own.
_________________
Back to top
View user's profile Send private message
tszeusts



Joined: 25 Jul 2006
Posts: 4

WR Updates: 7,327
tszeusts WR Profile

PostPosted: Thu Aug 10, 2006 12:38 pm    Post subject: Reply with quote

Quote:
If your site is hosted at 1&1 as well as the database, you should have no problem using any code to put information into and access the database.

You would only have a problem if you tried to access the database directly from a web site hosted elsewhere.

None of the code in this thread requires a database however (it's all done in flat files) unless that's functionality you are planning on adding to your own.


Oh ok I think I am getting it now. Thanks for the reply Skrag- I'm happy to admit I am venturing into web design for the first time if you can't tell. Can you clarify then, in fact, the code is on the page itself? I'll keep reading up, but appreciate any additional help you could provide. From this point forward I plan on using coffecup's free web editor. It seems to provide everything I will need to publish the site I want.

http://www.coffeecup.com/free-editor/

This site is great and the people here are very helpful !
Back to top
View user's profile Send private message
Skraggy



Joined: 22 Dec 2005
Posts: 5

WR Updates: 3,032
Skraggy WR Profile

PostPosted: Fri Aug 11, 2006 4:27 pm    Post subject: Reply with quote

There are two files written to a directory, one which is a comma delimited text file pulled from warcraftrealms, and one that simply saves the status of updating that text file.

Where it is saved in most of these scripts is defined in the beginning of the scripts:
Code:

    $local_directory = "download/";     //  this is the directory where your local files
                                //  will be written to and read from.  Make sure
                                //  you have WRITE privileges on this directory


Then, the php page simply reads this comma delimited file and makes it look pretty (sorting, calculating, doing whatever depending on which scripts you use) each time they are viewed.
_________________
Back to top
View user's profile Send private message
Hybuir
Gear Dependent Squirrel
Gear Dependent Squirrel


Joined: 06 Sep 2005
Posts: 1539
Location: Austin, TX
WR Updates: 2,634,634
Hybuir WR Profile

PostPosted: Mon Sep 24, 2007 1:09 pm    Post subject: Reply with quote

Don't know if there's even a demand for this anymore but... I was bored, what can I say? I expanded my 'Guild at a Glance' code to include 70's.

Step 1. Make an php file (index.php) to include this code. Make sure you update your '$guild_id' '$guild_name' '$server_id' and '$server_name' variables to reflect the correct information.
Full Code at: http://juniordimas.com/fold/index.php.txt

Step 2. Make a txt file called 'guildroster.txt' and just have it completely empty

Step 3. Make a txt file called 'status.txt' and have it just have 6 Zeros (000000)

Step 4. Upload all these files to the same folder.

Step 5. CHMOD guildroster.txt and status.txt to 666

You're done! Access your file and it should be all nice and informative
Working copy at: http://juniordimas.com/fold/index.php

_________________



Last edited by Hybuir on Mon Sep 24, 2007 1:24 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website AIM Address
rootuser



Joined: 06 Feb 2008
Posts: 1
Location: Worcester, MA
WR Updates: 276
rootuser WR Profile

PostPosted: Wed Feb 06, 2008 10:46 am    Post subject: Thank you! Question, though.. Reply with quote

Hi Rollie & Co.;

Thanks for your work. The CSV file and corresponding code is very useful. The only question I've got and I didn't see it asked, yet (though I may have missed it) is has anyone addressed a purge of the data so that only current guild members are shown in the roster?

You can view my work below, though it's in need of optimization.

http://sos.fearthemike.com/roster.php
Back to top
View user's profile Send private message Visit poster's website AIM Address
DM.
Census Tester


Joined: 03 Oct 2005
Posts: 1155
Location: Toronto, Canada
WR Updates: 841,833
DM. WR Profile

PostPosted: Wed Feb 06, 2008 4:49 pm    Post subject: Re: Thank you! Question, though.. Reply with quote

rootuser wrote:
http://sos.fearthemike.com/roster.php
Now if we can only see your work.. but its in a Member's only section Razz
_________________

Click my sig
Back to top
View user's profile Send private message
Hybuir
Gear Dependent Squirrel
Gear Dependent Squirrel


Joined: 06 Sep 2005
Posts: 1539
Location: Austin, TX
WR Updates: 2,634,634
Hybuir WR Profile

PostPosted: Wed Feb 11, 2009 3:53 pm    Post subject: Reply with quote

Updated the Guild True Colors code for 70+ characters.

http://juniordimas.com/2009/02/11/warcraftrealms-script-guild-true-colors/
_________________

Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    WarcraftRealms.com Forum Index -> WarcraftRealms Developers All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5
Page 5 of 5

 
Jump to:  
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
WarcraftRealms.com  


Powered by phpBB © 2001, 2005 phpBB Group