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  Next
 
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
Guest








PostPosted: Mon May 16, 2005 6:05 pm    Post subject: Reply with quote

I'm in Gideon's boat here. I'll try to describe my situation and maybe it will help more than the two of us.

I have purchased hosting at globat.com and have access to their tools. They run PHP, MySQL, and a host of other eCommerce things (that part I really don't care about). I have access to tools like phpMyAdmin (even though I have zilch experience in using it).

I've done my best to understand what exactly I need to do with the code listed in this forum and turn it into a viable guild roster page as it's displayed here on your site.

I do believe I have access to all the tools I need.

But like Gideon, I have zippo experience in programming (minus HTML), I haven't used PHP in the past and no experience with MySQL. I can write fairly efficient HTML code and understand it.

I guess I'd just like to be able to grasp how I take this CSV file and turn it into what you display on your site.

What I do have is energy and enthusiasm to learn what I need to do so I can present my guild's roster in a professional manner.

Thank you very much for any help and assistance you can provide.

Raffi
Officer of "The Unnamed"
Cenarius
Back to top
Raffi



Joined: 16 May 2005
Posts: 2

WR Updates: 0
Raffi WR Profile

PostPosted: Mon May 16, 2005 6:06 pm    Post subject: Reply with quote

Gah, thought I was logged in.

Raffi
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: Mon May 16, 2005 10:24 pm    Post subject: Reply with quote

Well, you are probably closer than you realize to being able to do it then. Do you have much/any database experience? I guess it wouldn't hurt to throw together an SQL script that would create the necessary database tables and such. Might make it a little easier to get up and running.
Back to top
View user's profile Send private message Visit poster's website
Raffi



Joined: 16 May 2005
Posts: 2

WR Updates: 0
Raffi WR Profile

PostPosted: Wed May 18, 2005 5:43 pm    Post subject: Reply with quote

I would say that I'm a beginning database user at best.

Thanks again for your help and assitance.

Raffi
Back to top
View user's profile Send private message
Crippler
Guest







PostPosted: Sat May 28, 2005 8:30 am    Post subject: Getting csv with ASP Reply with quote

Hi all

Has anyone got this working with ASP ???

I know it should be very easy, i just have no idea how to download the csv file with ASP, the rest i can do myself, like import that csv into a database and setup a page to view it etc, but i have no idea how to pull the csv file itself.

Any help would be much appreciated,


Thanks in advance
Back to top
Raducanu



Joined: 28 Jul 2005
Posts: 1

WR Updates: 0
Raducanu WR Profile

PostPosted: Fri Jul 29, 2005 3:38 am    Post subject: Reply with quote

Hello,

i'm still a PHP newbee but i like to filter the results.

Is there a way to do this.

For example:
Just show all priest >50 or members online <30 days and so on.

Can someone write me an example for this?

Im using this script (see in action http://www.marcelmertens.de/temp/guilde.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
    //

    $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        = 102065;   //  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 > 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.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);
    }



    //
    //  Now let's just output our roster as it's given
    //
    $filename = $local_directory . "guildroster.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);

    //  read the entries
    echo '<table style="margin-left: auto; margin-right: auto; 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>Rank</small></td></tr><tr>';
    while (!feof ($infile))
    {
        $buffer = fgets($infile, 4096);
        list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",",$buffer);

        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>' . $rank . '</small></td></tr>';
    }
    echo '</table>';
   
//Printing out the member data
   
   for($i = 1;$i < count($d_file);$i++)
{
    list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",", $d_file[$i]);

    echo '<tr class="content"><td class="content">' . $name . '</td><td class="content">' . $race . '</td><td class="content">' . $class . '</td><td class="content">' . $level . '</td><td class="content">' . $last_seen . '</td><td class="content">' . $rank . '</td></tr>';
}

echo '</table>';
//The first line contains no member data
$member_count = count($d_file) - 1;

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>';

   

?>
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 Jul 29, 2005 8:55 am    Post subject: Reply with quote

All you would need to do is customize your output based on the results from this statement:

Code:
    list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",", $d_file[$i]);


Which is located near the bottom in the Printing Out The Member Data section.
Back to top
View user's profile Send private message Visit poster's website
Guest








PostPosted: Fri Aug 05, 2005 3:44 am    Post subject: Reply with quote

I have experience with php.

Can someone give me a example how to (f.e.) show all priest higher than 40?
Back to top
Guest








PostPosted: Fri Aug 05, 2005 3:44 am    Post subject: Reply with quote

Sorry, forgot to login, no edit function.

I have NO Experience with PHP
Back to top
Dagobert
Guest







PostPosted: Tue Sep 20, 2005 3:39 pm    Post subject: Reply with quote

Could maybe somebody help me? i don?t get.

http://berentirsidh.fbhosting.com/census.php

It should be work, but it don?t. I also don?t get an error but the Datas are missing Sad

What did I wrong? What could be the reason?



Another question: Does somebody know a free webspace provider where the script is running? Maybe I don?t have all permissions that i need, but on the other hand that cant be the reason because I dont get a permission error.
Back to top
Dagobert
Guest







PostPosted: Tue Sep 20, 2005 3:48 pm    Post subject: Reply with quote

sorry,now it works.
I had to rename the csv files on my server to txt files and change it in the script,too because of the permissions of my provider
Back to top
Dagobert
Guest







PostPosted: Tue Sep 20, 2005 3:55 pm    Post subject: Reply with quote

I use the same script like "Raducanu" with the difference that i had to rename the csv files to txt. But why dont the member counter works and the "Last Seen" Output?

Could somebody hlp me please?

TANKS!!

http://berentirsidh.fbhosting.com/test3.php
Back to top
Guest








PostPosted: Tue Sep 20, 2005 4:10 pm    Post subject: Dagobert Reply with quote

sorry,I am a gump Very Happy
Forget the "Last Seen" Problem,but the counter still dont works.I am too stupid
Back to top
Rollie
Site Admin


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

PostPosted: Tue Sep 20, 2005 4:19 pm    Post subject: Reply with quote

Without seeing the actual php code, there is no way to determine why the counter is not working correctly.
Back to top
View user's profile Send private message Visit poster's website
Dagobert
Guest







PostPosted: Tue Sep 20, 2005 4:20 pm    Post subject: Reply with quote

Sorry,this is my actual code:

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

    $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        = 153595;   //  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 > 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);

    //  read the entries
    echo '<table style="margin-left: auto; margin-right: auto; 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);

        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>';
   
//Printing out the member data
   
   for($i = 1;$i < count($d_file);$i++)
{
    list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",", $d_file[$i]);

    echo '<tr><td>' . $name . '</td><td>' . $race . '</td><td>' . $class . '</td><td>' . $level . '</td><td>' . $last_seen . '</td><td>' . $rank . '</td></tr>';
}

echo '</table>';
//The first line contains no member data
$member_count = count($d_file) - 1;

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>';

   

?>
Back to top
Rollie
Site Admin


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

PostPosted: Tue Sep 20, 2005 4:26 pm    Post subject: Reply with quote

Remove all of this

Code:
//Printing out the member data
   
   for($i = 1;$i < count($d_file);$i++)
{
    list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",", $d_file[$i]);

    echo '<tr><td>' . $name . '</td><td>' . $race . '</td><td>' . $class . '</td><td>' . $level . '</td><td>' . $last_seen . '</td><td>' . $rank . '</td></tr>';
}

echo '</table>';
//The first line contains no member data
$member_count = count($d_file) - 1;


Change this:

Code:
    while (!feof ($infile))
    {
        $buffer = fgets($infile, 4096);
        list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",",$buffer);

        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>';
    }


to this:

Code:
    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>';
    }
Back to top
View user's profile Send private message Visit poster's website
Dagobert
Guest







PostPosted: Tue Sep 20, 2005 4:34 pm    Post subject: Reply with quote

cool,thx ! It works great ! Smile

I?ve got another question, do you know how I can test if the guildroster-updating-function really works?
Back to top
Rollie
Site Admin


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

PostPosted: Tue Sep 20, 2005 4:38 pm    Post subject: Reply with quote

I'm not quite sure I understand.
Back to top
View user's profile Send private message Visit poster's website
Dagobert
Guest







PostPosted: Tue Sep 20, 2005 4:41 pm    Post subject: Reply with quote

Sorry, my english is not the best Wink

Okay, i will try to explain what I mean. When I execute the script (by surfing to http://berentirsidh.fbhosting.com/test3.php) the script is looking in the database of warcraftrealms for a newer guildrost,right?
I don?t need to hold it up to date manually,right?
Back to top
Rollie
Site Admin


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

PostPosted: Tue Sep 20, 2005 6:04 pm    Post subject: Reply with quote

Yes, it is automatic!
Back to top
View user's profile Send private message Visit poster's website
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  Next
Page 3 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