Jump to content

Server Stats page for XpKiller's 'BF3 Chat, GUID, Stats and Mapstats Logger'


ImportBot

Recommended Posts

Originally Posted by ty_ger07*:

 

I feel like someone else had this same issue somewhere within the last 42 pages, but I can't remember the solution. If 'localhost' doesj't work let me know and I will scratch my head for a while.

* Restored post. It could be that the author is no longer active.
Link to comment
  • Replies 487
  • Created
  • Last Reply

Originally Posted by cjffly*:

 

I feel like someone else had this same issue somewhere within the last 42 pages, but I can't remember the solution. If 'localhost' doesj't work let me know and I will scratch my head for a while.

my forum and my datebase is not the same. my forum is in Hong-Kong, and my database is in USA...lol

 

so "localhost" wont work, i guess

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by p19blo*:

 

my forum and my datebase is not the same. my forum is in Hong-Kong, and my database is in USA...lol

 

so "localhost" wont work, i guess

get the ip of the database or the url if it has one for example www.db4free.net
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by cjffly*:

 

do you have to have the IP of the forum added to the remote list for the database?

yes, I add the forum IP to white list. I think DB site is OK, because I managed to access the DB with some tool from my own PC. Right now I am talking to my forum provider to check whether they blocked something (port 3306_) I am waiting their reply.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

I am at a loss.

 

Your PRoCon plugin is able to access the database just fine. You are able to log into the database directly from your computer using HeidiSQL (or whatever program you used). As long as you entered the same database connection details into the webpage, it should work. The only thing I can think (like you said) is that your website host has blocked the connection for some reason.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by cjffly*:

 

I am at a loss.

 

Your PRoCon plugin is able to access the database just fine. You are able to log into the database directly from your computer using HeidiSQL (or whatever program you used). As long as you entered the same database connection details into the webpage, it should work. The only thing I can think (like you said) is that your website host has blocked the connection for some reason.

Right, my forum provider block all the port for safety reason, and I tried another web-hosting and it works! Thanks for the help:cool:

 

Edit:

 

I have another problem. When I try translate the content into Chinese, these words will shown as unknown such as: ???????. Do you know how to fix this?

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

I haven't dealt with making pages in other languages, so I don't know the exact answer, but I am sure it has something to do with the content type of the document.

 

 

Close to the top of the file, below '// output the header', it says this:

 

Try changing that to:

 

Hopefully that will allow the document characters to be parsed properly by the browser.

 

I am a noob at this sort of question. :huh:

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by cjffly*:
 

I haven't dealt with making pages in other languages, so I don't know the exact answer, but I am sure it has something to do with the content type of the document.


Close to the top of the file, below '// output the header', it says this:



Try changing that to:



Hopefully that will allow the document characters to be parsed properly by the browser.

I am a noob at this sort of question. :huh:

That works locally:cool:

but on the web, not. So i think I need to contact the webhost provider to change some settings~

I will let you know if I work it out~

Edit:

I add this
Code:

<?php

[b]header('Content-Type: text/html; charset=gbk');[/b]

and everything works good.

links here

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Cool!

 

Otherwise someone else may know better than me how to do this. Make sure you refresh the page 2 or 3 times in a row while testing because it might not seem to update if your browser cached the page.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

http://mmcdb.branspace.com/player_st...r_stats_cn.php

 

It's not done yet, but you can take a look

I see the characters just fine. I think you just need to reload the page a few times until your browser's cache gets updated to the new header information.

 

EDIT: By "just fine" I am assuming what I am seeing is correct since I can't understand it but it looks like Chinese to me. :cool:

 

EDIT2: I see you edited a post above with the solution. Cool! Glad you got it working!

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ColColonCleaner*:

 

I see the characters just fine. I think you just need to reload the page a few times until your browser's cache gets updated to the new header information.

 

EDIT: By "just fine" I am assuming what I am seeing is correct since I can't understand it but it looks like Chinese to me. :cool:

 

EDIT2: I see you edited a post above with the solution. Cool! Glad you got it working!

CTRL+F5 in most browsers will reload the page with a cleared cache :smile:
* Restored post. It could be that the author is no longer active.
Link to comment
  • 4 weeks later...

Originally Posted by p19blo*:

 

hey how can i make the top player list be for kills and not scores?

 

i run a competition on my site for most kills in a month and atm its hard to get the result.

 

Thanks

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ozplanet*:

 

Copy the existing top players function, then just change the order by from Score to Kills.

 

Code:

ORDER BY [b]Kills[/b] DESC LIMIT $offset, $rowsperpage");
If no one has given you a better answer. I will follow up with an example using the original code. The Code I am using has been heavily modified.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ozplanet*:

 

But that only gives you an overall Kills.

 

Hopefully you enabled Sessions ?

 

If you did you can query from the sessions table and get only those players that actually played that month and their actual kill count for a particular month.

 

I'll create something for you when I get home from work.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ozplanet*:

 

Yikes then all your stats are gone. The code just needs a few adjustments instead to get the information you want.

 

Take a look at the changes I made to our clan site Top Players By Kills

 

Gather up some stats and let me know what information you want to display and I'll write up a modified function for you to display.

 

In Procon there is an option to save session data, enable this option, so we can grab stats for an individual month without that it only collects overall stats.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ozplanet*:
 

Top Players By Kills

 

Ok here ya go:

Top portion for the title
Code:

elseif($_GET['top25_players_kill'])
{
echo '<meta name="keywords" content="Top,Players,' . $server_name . ',' . $clan_name . ',BF3,Player,Stats,Server" />
<meta name="description" content="This is our ' . $clan_name . ' BF3 ' . $server_name . ' server player stats page of Top Players." />
<title>' . $clan_name . ' BF3 Player Stats - Top Players By Kills - ' . $server_name . '</title>';
}

Add another link to the top
Code:

<td width="10%" style="text-align: center">
<a href="' . $_SERVER['PHP_SELF'] . '_top25_players_kill=View">Top Players By Kills</a>
</td>

REPLACE
Code:

if(($_GET['top25_players']) OR  !(($_GET['search_player']) OR ($_GET['suspicious_players']) OR ($_GET['banned_players']) OR ($_GET['top25_countries']) OR ($_GET['mapstats']) OR ($_GET['serverstats']) OR ($_GET['chat'])))

WITH
Code:

if(($_GET['top25_players']) OR  !(($_GET['top25_players_kill']) OR ($_GET['search_player']) OR ($_GET['suspicious_players']) OR ($_GET['banned_players']) OR ($_GET['top25_countries']) OR ($_GET['mapstats']) OR ($_GET['serverstats']) OR ($_GET['chat'])))

Add before the replaced line above
Code:

if(($_GET['top25_players_kill']))
{
    TopPlayersByKills();
}

function MonthsDropDown(){
    $prevmonth = mktime(0, 0, 0, date("m")-2, date("d"),   date("Y"));
    $lastmonth = mktime(0, 0, 0, date("m")-1, date("d"),   date("Y"));
    
    echo "<form action='" . $_SERVER['PHP_SELF'] . "_top25_players_kill=View' method='get' style='margin-left:30px'><select name='Month' id='Month' onchange='this.form.submit();' class='inputbox'>";
    $selected = ($_GET['Month'] == (date('Y',$prevmonth).'-'.date('m',$prevmonth)) _ 'selected' : '');
    echo '<option value="'.(date('Y',$prevmonth).'-'.date('m',$prevmonth)).'" '.$selected.'>'.date('F',$prevmonth).'</option>';
    $selected = ($_GET['Month'] == (date('Y',$lastmonth).'-'.date('m',$lastmonth)) _ 'selected' : '');
    echo '<option value="'.(date('Y',$lastmonth).'-'.date('m',$lastmonth)).'" '.$selected.'>'.date('F',$lastmonth).'</option>';
    $selected = ($_GET['Month'] == '' _ 'selected' : '');
    echo '<option value="" '.$selected.'>'.date('F').'(current)</option>';
    echo "</select><input type='hidden' name='top25_players_kill' value='View'/></form>";
}

function TopPlayersByKills(){
    global $server_name,$table_suffix,$server_ID;
    echo '
    <div class="middlecontent">
    <table width="100%" border="0">
    <tr><td  class="headline">
    <center><b>' . $server_name . ' Main Stats Page</b></center>
    </td></tr>
    </table>
    </div>
    
    <div class="middlecontent">
    <table width="100%" border="0">
    <tr><td>
    
    <center>Statistics data presented is not BF3 global statistics data.  These are the statistics of each player only in the server listed.  Click name on scoreboard for further player stats.</center>
    
    </td></tr>
    </table>
    </div><table width="100%" border="0">
    <tr>
    <td valign="top" align="center">
    <div class="middlecontent">
    
    <table width="100%" border="0">
    <tr>
    <th>Top Players in ' . $server_name .'</th>
    </tr>
    <tr>
    <td>
    <div class="innercontent">
    ';
    
    // pagination code thanks to: http://www.phpfreaks.com/tutorial/basic-pagination
    // find out how many rows are in the table
    $sql = @mysql_query("SELECT COUNT(tpd.SoldierName), tps.Score FROM tbl_playerstats{$table_suffix} tps INNER JOIN tbl_server_player{$table_suffix} tsp ON tsp.StatsID = tps.StatsID INNER JOIN tbl_playerdata{$table_suffix} tpd ON tsp.PlayerID = tpd.PlayerID WHERE tsp.ServerID = '$server_ID' ORDER BY Score DESC");
    $r = @mysql_fetch_row($sql);
    $numrows = $r[0];
    // number of rows to show per page
    $rowsperpage = 25;
    // find out total pages
    $totalpages = ceil($numrows / $rowsperpage);
    // get the current page or set a default
    if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage']))
    {
        // cast var as int
        $currentpage = (int) $_GET['currentpage'];
    }
    else
    {
        // default page num
        $currentpage = 1;
    }
    // if current page is greater than total pages...
    if ($currentpage > $totalpages)
    {
        // set current page to last page
        $currentpage = $totalpages;
    }
    // if current page is less than first page...
    if ($currentpage < 1)
    {
        // set current page to first page
        $currentpage = 1;
    }
    // the offset of the list, based on current page
    $offset = ($currentpage - 1) * $rowsperpage;
    $month = $_GET['Month'];
    If (!$month) $month = date('Y-m');
    // get the info from the db
    $sql = @mysql_query("SELECT pd.SoldierName, Sum( s.Kills ) Kills, Sum( s.Deaths ) Deaths, Sum( s.RoundCount ) Rounds
                        FROM tbl_sessions{$table_suffix} s, tbl_playerdata{$table_suffix} pd, tbl_server_player{$table_suffix} sp
                        WHERE s.statsID = sp.StatsID
                        AND sp.ServerID = '$server_ID'
                        AND pd.PlayerID = sp.PlayerID
                        AND s.RoundCount >0
                        AND STR_TO_DATE( s.StartTime, '%Y-%m' ) = STR_TO_DATE('$month','%Y-%m')
                        GROUP BY SoldierName
                        ORDER BY Kills DESC
                        LIMIT $offset, $rowsperpage");
    
    // offset of player rank count to show on scoreboard
    $count = ($currentpage * 25) - 25;
    // check if there are rows returned
    if(@mysql_num_rows($sql)!=0)
    {
        // while there are rows to be fetched...
        while($playerstats_row = @mysql_fetch_assoc($sql))
        {
            //$Score = $playerstats_row['Score'];
            $SoldierName = $playerstats_row['SoldierName'];
            $Kills = $playerstats_row['Kills'];
            $Deaths = $playerstats_row['Deaths'];
            // avoid dividing by zero
            if($Deaths == 0)
            {
                $Deaths = 0.0001;
            }
            $KDR = round(($Kills / $Deaths), 2);
            // fix huge KDR division error
            if($Deaths == 0.0001)
            {
                $KDR = ($KDR / 10000);
            }
            // fix tiny KDR division error
            if($KDR == 0.0001)
            {
                $KDR = 0;
            }
            // return value to zero if necessary
            if($Deaths == 0.0001)
            {
                $Deaths = 0;
            }
            $Rounds = $playerstats_row['Rounds'];
            $rank_offset = (($_GET['currentpage']) * 25);
            $count++;

            echo '
            <table width="95%" align="center" border="0">
            <tr>
            <td style="text-align: left;" width="5%"><font size="2">' . $count . ':</font></td>
            <td width="25%" style="text-align: left;"><a href="' . $_SERVER['PHP_SELF'] . '_player_name=' . $SoldierName . '&search_player=Search"><font size="2">' . $SoldierName . '</font></a></td>
            <td width="25%" style="text-align: left;"><font class="information">Kills: </font>' . $Kills . '</td>
            <td width="25%" style="text-align: left;"><font class="information">Rounds Played: </font>' . $Rounds . '</td>
            <td width="20%" style="text-align: left;"><font class="information">KDR: </font>' . $KDR . '</td>
            </tr>    
            </table>
            ';
            
        }
    }
    else
    {
        echo '
        <table width="95%" align="center" border="0">
        <tr>
        <td style="text-align: left;" width="100%"><center><font class="information">No player stats found for ' . $server_name . ' server.</font></center></td>
        </tr>
        </table>
        ';
    }
    // build the pagination links
    echo '</div>';
    // don't display pagination links if no players found
    if(@mysql_num_rows($sql)!=0)
    {
        echo '<center>';
        // range of num links to show
        $range = 3;
        // if on page 1, don't show back links
        if ($currentpage > 1)
        {
            // show << link to go back to first page
            echo '<a href="' . $_SERVER['PHP_SELF'] . '_top25_players_kill=View&currentpage=1"><<</a>';
            // get previous page num
            $prevpage = $currentpage - 1;
            // show < link to go back one page
            echo ' <a href="' . $_SERVER['PHP_SELF'] . '_top25_players_kill=View&currentpage=' . $prevpage . '"><</a> ';
        }
        // loop to show links to range of pages around current page
        for($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++)
        {
            // if it's a valid page number...
            if (($x > 0) && ($x <= $totalpages))
            {
                // if we're on current page...
                if ($x == $currentpage)
                {
                    // 'highlight' it but don't make a link
                    echo ' [<font class="information">' . $x . '</font>] ';
                }
                else
                {
                    // make it a link
                    echo ' <a href="' . $_SERVER['PHP_SELF'] . '_top25_players_kill=View&currentpage=' . $x . '">' . $x . '</a> ';
                }
            }
        }
        // if not on last page, show forward links        
        if ($currentpage != $totalpages)
        {
            // get next page
            $nextpage = $currentpage + 1;
            // show > link to go forward one page
            echo ' <a href="' . $_SERVER['PHP_SELF'] . '_top25_players_kill=View&currentpage=' . $nextpage . '">></a> ';
            // show >> link to last page
            echo '<a href="' . $_SERVER['PHP_SELF'] . '_top25_players_kill=View&currentpage=' . $totalpages . '">>></a>';
        }
        echo '</center>';
    }
    // end build pagination links and end block
    echo '
    </td>
    </tr>
    </table>
    </div>'.
    MonthsDropDown()
    .'</td></tr>
    </table>
    ';
    
}

Results are a page that display Top Players By Kills for the current month and 2 months in the past.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by p19blo*:

 

you sir are my hero. This is perfect.

 

Is their a way to get it to log every month not just the last 3 ? or last 6 even ?

 

Also for the current month it only shows 1 guy in it when there is more.

 

http://www.battlefieldtweaks.com/fla...yers_kill=View

 

Thanks again.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ozplanet*:

 

The reason you only have a limited number of players is because I guess you did not have save Session Data enabled. So any past data was not collected but now as long as you have that enabled from here on out your stats can be calculated monthly.

 

So for this month you will have to do it the hard way or just cancel the award for this month and start fresh next month knowing that you have stats collected.

 

If you want to increase the amount of months to show in the past just add more values to the drop down.

 

I made it simple but I will post something better after work again. A drop down that will display past months with a cut off point.

 

It was easy enough to implement ?

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by p19blo*:

 

The reason you only have a limited number of players is because I guess you did not have save Session Data enabled. So any past data was not collected but now as long as you have that enabled from here on out your stats can be calculated monthly.

 

So for this month you will have to do it the hard way or just cancel the award for this month and start fresh next month knowing that you have stats collected.

 

If you want to increase the amount of months to show in the past just add more values to the drop down.

 

I made it simple but I will post something better after work again. A drop down that will display past months with a cut off point.

 

It was easy enough to implement ?

yes very easy to amend the file.

 

i do have save session to DB enabled. its updated members but only a few. This months competition is void and will start from september, once ive ironed out a few things.

 

Thanks once again. Very helpful

 

 

*edit*

 

So after leaving it over night after a lttle test, 15 players played. but top kills only shows 5 of them. which itsnt right as i was in the 15 and not on the list.

 

Something is a miss here. any ideas?

 

here the code from below the db entries

 

http://www.mediafire.com/_65ye92cxzorzmeh

* Restored post. It could be that the author is no longer active.
Link to comment
  • 2 months later...

Originally Posted by Ralphvd*:

 

I have a problem with the stats site:

 

http://niceclan.t15.org/Site2/player...ayer_stats.php

 

Database is working correctly ingame.

Mysql is running on same pc as the procon host. So for the plugin i have set everything up as localhost.

 

Webpage i have setup ip as my outside ip. I have port forwarded 3306 to the pc which hosted procon/mysql.

 

What am i doing wrong?

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ozplanet*:

 

I have a problem with the stats site:

 

http://niceclan.t15.org/Site2/player...ayer_stats.php

 

Database is working correctly ingame.

Mysql is running on same pc as the procon host. So for the plugin i have set everything up as localhost.

 

Webpage i have setup ip as my outside ip. I have port forwarded 3306 to the pc which hosted procon/mysql.

 

What am i doing wrong?

Chances are your database is not accessible from outside of localhost.
* Restored post. It could be that the author is no longer active.
Link to comment

Archived

This topic is now archived and is closed to further replies.




×
×
  • Create New...

Important Information

Please review our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.