Page 1 of 1

Help

Posted: Tue Oct 25, 2005 10:39 am
by erypmav
Is there any way for someone who is using Freewebs.com as their host to use the data collected on there guild from here? I dont think my freewebs.com account uses php :( Any help whould be great.

Posted: Fri Oct 28, 2005 10:48 am
by Hybuir
Most of the guild display codes (including mine) is in PHP, but according to the FAQ's at Freewebs.com (http://members.freewebs.com/page.jsp?page=faqs#mysql)
What about MySQL, MSACCESS, and PHP?
Unfortunately, Freewebs does not offer these functions.
Plus no CGI or Perl Scripts, so it's kind of hard for it do be implemented on your Freeweb.com site.

I did a quick search for a free hosting from Free-webhosts.com and 100Webhosting offers what you need:

http://www.100webspace.com/freeplan.html

Hope this helps :D

Posted: Fri Oct 28, 2005 7:15 pm
by erypmav
Thanks :)

Posted: Tue Nov 08, 2005 12:46 pm
by erypmav
Ok now I have a page up and running. The only change I want to do is have the number values for the pvp rank changed to the accuall rank. Since I am new to php, can some one make a suggestion? You can view the page at http://ioa.freefronthost.com/memberlist.php. Also here is the code I am using.

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; february 1st 2005   
    //
    //  Author&#58;  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        = 364279;   //  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 &#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;;

        echo '<body &#123;BODY&#125; width="750" bgcolor="black" link="darkgoldenrod" vlink="firebrick" text="darkgoldenrod"><p align="center"> Local status file reads &#58; ' . strftime&#40;"%m/%d/%y %H&#58;%M&#58;%S",$current_timestamp&#41; . '<br>';
    &#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;;

        echo 'Remote status file reads &#58; ' . strftime&#40;"%m/%d/%y %H&#58;%M&#58;%S",$remote_timestamp&#41; . '<br>';

    &#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.csv";
        $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.csv";
    $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 '<br><table align="center" width="750" border="3" bordercolor="firebrick" cellspacing="5" cellpadding="3" cellspacingcolor="firebrick" frame="void" rules="rows"><tr><th align="center">Name</th><th align="center">Race</th><th align="center">Class</th><th align="center">Level</th><th align="center">Last Seen</th><th align="center">Guild Rank</th><th align="center">PVP Rank</th></tr>';
    while &#40;!feof &#40;$infile&#41;&#41;

    &#123;
        $buffer = fgets&#40;$infile, 4096&#41;;
        list&#40; $name, $race, $class, $level, $last_seen, $guild_rank, $pvp_rank &#41; = explode&#40;",",$buffer&#41;;

        $member_count++;
        
         

        &#123;
      echo '<tr><td align="center">' . $name . '</td><td align="center">' . $race . '</td><td align="center">' . $class . '</td><td align="center">' . $level . '</td><td align="center">' . $last_seen . '</td><td align="center">' . $guild_rank . '</td><td align="center" >' . $pvp_rank . '</td></tr align="center">';
        &#125;

    &#125;
    echo '</table>';

echo '<table class="content"><tr><td class="topcontent"><center>Statistics</center><tr><td class="content" align="center">';
echo "Total Members&#58; ";
echo "$member_count"-1;
echo '<p></center>'; 

    //  don't forget our credit link =&#41;

    echo "Guild data provided by <a href='http&#58;//www.warcraftrealms.com/'>WarcraftRealms.com</a>.<br>Huge Thanks to Rollie for starting this script!";
?>

Posted: Tue Nov 08, 2005 1:11 pm
by Rollie
What you can do is set up an array with the correct values, and then just index into that array based on the pvp rank value.

For example:

Code: Select all

$pvpranktext&#91;5&#93; = "Private";
$pvpranktext&#91;6&#93; = "Corporal";
$pvpranktext&#91;7&#93; = "Sergeant";
$pvpranktext&#91;8&#93; = "Master Sergeant";
$pvpranktext&#91;9&#93; = "Sergeant Major";
$pvpranktext&#91;10&#93; = "Knight";
$pvpranktext&#91;11&#93; = "Knight-Lieutenant";
$pvpranktext&#91;12&#93; = "Knight-Captain";
$pvpranktext&#91;13&#93; = "Knight-Champion";
$pvpranktext&#91;14&#93; = "Lieutenant Commander";
$pvpranktext&#91;15&#93; = "Commander";
$pvpranktext&#91;16&#93; = "Marshal";
$pvpranktext&#91;17&#93; = "Field Marshall";
$pvpranktext&#91;18&#93; = "Grand Marshall";
After you have declared that (like at the top), then you would just need to change

Code: Select all

<td align="center" >' . $pvp_rank . '</td>
to

Code: Select all

<td align="center" >' . $pvpranktext&#91;$pvp_rank&#93; . '</td>
in the output section.

Posted: Tue Nov 08, 2005 1:24 pm
by erypmav
Hmm now all the ranks are blank on the page.

Posted: Tue Nov 08, 2005 1:49 pm
by erypmav
Had to change

Code: Select all

$pvpranktext&#91;5&#93; = "Private";
$pvpranktext&#91;6&#93; = "Corporal";
$pvpranktext&#91;7&#93; = "Sergeant";
$pvpranktext&#91;8&#93; = "Master Sergeant";
$pvpranktext&#91;9&#93; = "Sergeant Major";
$pvpranktext&#91;10&#93; = "Knight";
$pvpranktext&#91;11&#93; = "Knight-Lieutenant";
$pvpranktext&#91;12&#93; = "Knight-Captain";
$pvpranktext&#91;13&#93; = "Knight-Champion";
$pvpranktext&#91;14&#93; = "Lieutenant Commander";
$pvpranktext&#91;15&#93; = "Commander";
$pvpranktext&#91;16&#93; = "Marshal";
$pvpranktext&#91;17&#93; = "Field Marshall";
$pvpranktext&#91;18&#93; = "Grand Marshall";
to

Code: Select all

    $pvpranktext&#91;1&#93;  = "Private";
    $pvpranktext&#91;2&#93;  = "Corporal";
    $pvpranktext&#91;3&#93;  = "Sergeant";
    $pvpranktext&#91;4&#93;  = "Master Sergeant";
    $pvpranktext&#91;5&#93;  = "Sergeant Major";
    $pvpranktext&#91;6&#93;  = "Knight";
    $pvpranktext&#91;7&#93;  = "Knight-Lieutenant";
    $pvpranktext&#91;8&#93;  = "Knight-Captain";
    $pvpranktext&#91;9&#93;  = "Knight-Champion";
    $pvpranktext&#91;10&#93; = "Lieutenant Commander";
    $pvpranktext&#91;11&#93; = "Commander";
    $pvpranktext&#91;12&#93; = "Marshal";
    $pvpranktext&#91;13&#93; = "Field Marshall";
    $pvpranktext&#91;14&#93; = "Grand Marshall";
add

Code: Select all

    $pvprank2 = $pvprank-4;     
and change

Code: Select all

$pvpranktext&#91;$pvprank&#93;
to

Code: Select all

$pvpranktext&#91;$pvprank2&#93;
For some reason it doesnt look at $pvprank as a number.
Hope this helps other ppl in the future.

Posted: Thu Nov 10, 2005 4:16 pm
by Jenlor
whoa, it's been a few years since i've done any programming, and i've never programmed in php, but i think i got everything worked out and in the right place:

http://warcraft.kotls.com/rostertest.php

It's not as nice looking as this (edited manually each week) but we're getting too big for manual edits.

http://warcraft.kotls.com/wowmembers.htm

Thanks for all the help and information!