Quote:
Originally Posted by Fearts
Thanks for the work you did on the interface. One thing I would really like is just to be able to filter each column so I can see who has played the longest and who has the most visits ect. Also a way to get a % for each type of thing. Like the % of people who connect via favorites and such.
|
You can replace the a few sections with this:
index.php
Spoiler
PHP Code:
Morris.Donut({
element: 'f2p',
data: <?php echo $user->jsPremiumTotal(); ?>,
formatter: function (y) { return y + "%" ;}
});
Morris.Donut({
element: 'method',
data: <?php echo $user->jsMethodTotal(); ?>,
formatter: function (y) { return y + "%" ;}
});
data/users.php
Spoiler
PHP Code:
/**
*
* Gets the total Premium/F2P user count
*/
public function jsPremiumTotal() {
if (is_null($pTotal)) {
$this->_premiumTotal();
}
$total = 0;
foreach ($this->pTotal as $n => $v) {
$total += $v['total'];
}
foreach ($this->pTotal as $n => $v) {
if ( $this->pTotal[$n]['premium']=='0') $this->pTotal[$n]['premium']='F2P';
elseif ( $this->pTotal[$n]['premium']=='1') $this->pTotal[$n]['premium']='Premium';
$ret[] = array(
//'country_code3' => $this->mAudience[$n]['country_code3'],
'label' => $this->pTotal[$n]['premium'],
'value' => number_format($this->pTotal[$n]['total'] * 100 / $total, 2)
);
}
return json_encode($ret);
}
/**
*
* Sets the total Premium/F2P user count
*/
private function _premiumTotal() {
$q = "SELECT `premium`, COUNT(`premium`) AS `total`
FROM `player_analytics`
GROUP BY `premium`";
$this->pTotal = $this->db->query($q,true);
}
/**
*
* Gets the total Connect Method user count
*/
public function jsMethodTotal() {
if (is_null($cmTotal)) {
$this->_MethodTotal();
}
$total = 0;
foreach ($this->cmTotal as $n => $v) {
$total += $v['total'];
}
foreach ($this->cmTotal as $n => $v) {
if ( $this->cmTotal[$n]['connect_method']==NULL) $this->cmTotal[$n]['connect_method']='?';
elseif ( $this->cmTotal[$n]['connect_method']=='serverbrowser_favorites') $this->cmTotal[$n]['connect_method']='Favorites';
elseif ( $this->cmTotal[$n]['connect_method']=='serverbrowser_friends') $this->cmTotal[$n]['connect_method']='Friends';
elseif ( $this->cmTotal[$n]['connect_method']=='serverbrowser_history') $this->cmTotal[$n]['connect_method']='History';
elseif ( $this->cmTotal[$n]['connect_method']=='serverbrowser_internet') $this->cmTotal[$n]['connect_method']='Browser';
elseif ( $this->cmTotal[$n]['connect_method']=='steam') $this->cmTotal[$n]['connect_method']='Steam';
$ret[] = array(
//'country_code3' => $this->mAudience[$n]['country_code3'],
'label' => $this->cmTotal[$n]['connect_method'],
'value' => number_format($this->cmTotal[$n]['total'] * 100 / $total, 2)
);
}
return json_encode($ret);
}
/**
*
* Sets the total Connect Method user count
*/
private function _MethodTotal() {
$q = "SELECT `connect_method`, COUNT( `connect_method` ) AS `total`
FROM `player_analytics`
GROUP BY `connect_method`";
$this->cmTotal = $this->db->query($q,true);
}
Quote:
Originally Posted by Pitbull3
hey I am seeing like.... 50 versions of quickplay_1, 2 ect..... is there a way to combine all of them permanently? I don't want to have to run an sql query each time I want to merge them together...
|
You can add/modify this to fit your needs, it will update connect_method from quickplay_* to quickplay on page load.
PHP Code:
UPDATE 'player_analytics' SET 'connect_method'='quickplay' WHERE `connect_method` LIKE '%quickplay%'"
added this to my updated panel in sessions.php
Spoiler
PHP Code:
mysqli_query($con,"UPDATE player_analytics SET connect_method='quickplay' WHERE `connect_method` LIKE '%quickplay%'");
Quote:
Originally Posted by DrFallen
Hey nice work Pickles on the modded web browser. I noticed it doesn't pick up the server name. Other than that everything works. No random errors.
|
I've had this problem too where the table is not being filled with the correct ip at times, instead being filled with 0.0.0.0. Since the server name comes from the recorded ip in config.php, it will be Other.