Page 13 of 16

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 09 Dec 2011 21:11
by Ant
Nice, there may be a new version soon because the player banners for global stats has already been tweaked for a little nicer display.

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 10 Dec 2011 13:52
by sbone
Hi,

i have one problem since a lots of time with TM2 servers and same thing with last update of xstats.
Nicknames are well displayed for all xstats pages exect the ranking page (/xstats/?serv=0&lang=FRA&page=players)
See screenshots below :

Image


Image

On this ranking page, see the "?" in place of special caracteres in nickname column

Im using php 5.3.2, i check my os locale, UTF-8 enconding for http...
I don't find an issue.
Any idea ?

Thanks
Sorry if this has already be posted, but don't see it ;)

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 11 Dec 2011 19:17
by Ant
Maybe it has something to do with your changes to pages/players.php ? Have you double checked that ?

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 11 Dec 2011 19:47
by sbone
Ant wrote:Maybe it has something to do with your changes to pages/players.php ? Have you double checked that ?
No change on that page :(

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 11 Dec 2011 20:24
by Ant
Ok, well do you get these results with a clean install (try a test install maybe)

What changes have you made though?

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 12 Dec 2011 08:32
by sbone
Ant wrote:Ok, well do you get these results with a clean install (try a test install maybe)

What changes have you made though?
Only changes in config.php for the colors
Same problem with a "clean original" install :(

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 12 Dec 2011 20:27
by Ant
Well the only difference I can see is you are on php 5.3.2 and I am still using 5.2.17 - Its quite strange though, I'll look into it a bit more then try and give you a solution.

Edit: Can you try this and let me know if that changes anything please?

pages/players.php

Code: Select all

<?php
require("config.php");

print "<p class=\"tabletitle\">$lng_players_headline</p>";

if (!$pos) $pos = 0;
if (is_null($orderby)) $orderby = "rank";
if (is_null($sort)) $sort = "ASC";

$sorturl = "?serv=$serv&lang=$lang&page=$page&orderby=%s&sort=".(($sort == "ASC") ? "DESC" : "ASC");

print "<table width=\"100%\" border=\"0\" bgcolor=\"$bg4\" align=\"center\">
  <tr bgcolor=\"$resultbg\">
    <td width=\"60\" class=\"tablehead\"><a href=\"".sprintf($sorturl, "rank")."\">$lng_players_rank</a></td>
    <td width=\"150\" class=\"tablehead\"><a href=\"".sprintf($sorturl, "NickName")."\">$lng_players_nickname</a></td>
    <td width=\"150\" class=\"tablehead\"><a href=\"".sprintf($sorturl, "Login")."\">$lng_players_login</a></td>
    <td width=\"80\" class=\"tablehead\"><a href=\"".sprintf($sorturl, "rank")."\">$lng_players_avg</a></td>
    <td width=\"120\" class=\"tablehead\"><a href=\"".sprintf($sorturl, "TimePlayed")."\">$lng_players_timeplayed</a></td>
	<td width=\"120\" class=\"tablehead\"><a href=\"".sprintf($sorturl, "UpdatedAt")."\">$lng_players_lastvisit</a></td>
    <td width=\"60\" class=\"tablehead\"><a href=\"".sprintf($sorturl, "Id")."\">$lng_players_id</a></td>
    <td width=\"50\" class=\"tablehead\"><a href=\"".sprintf($sorturl, "Nation")."\">$lng_players_nation</a></td>";
    if ($show_player_banners) print "<td width=\"50\" class=\"tablehead\">$lng_players_banner</td>";
print "</tr>";

$sql = "SELECT * FROM (
			SELECT t1.*, @r:=@r+1 AS rank
			FROM (
				SELECT p.*, r.avg, r.avg IS NULL AS norank
				FROM players p
				LEFT JOIN rs_rank r ON p.Id = r.playerID
				ORDER BY norank ASC, r.avg ASC
			) t1, (SELECT @r:=0) t2
		) t3
		ORDER BY %s
		LIMIT $pos, $count";

if ($orderby == "rank") {
	$sql = sprintf($sql, "norank $sort, $orderby $sort");
} else {
	$sql = sprintf($sql, "$orderby $sort");
}

$result = mysql_query($sql) or die(mysql_error());
$totalrows = mysql_num_rows(mysql_query("SELECT * FROM players"));

if ($totalrows < 1) {
	print "<tr><td class=\"celltext\" colspan=\"10\">No results</td></tr>";
} else {
	$new_pos_next = $pos + $count;
	$new_pos_prev = $pos - $count;
	$link_next = ($new_pos_next >= $totalrows) ? "" : "?serv=$serv&lang=$lang&page=$page&pos=$new_pos_next&orderby=$orderby&sort=$sort";
	$link_prev = ($new_pos_prev < 0) ? "" : "?serv=$serv&lang=$lang&page=$page&pos=$new_pos_prev&orderby=$orderby&sort=$sort";

	$bg = $bg1;
	while($data = mysql_fetch_array($result))
	{
		$MwTime = $data['TimePlayed'];
		$lastvisited = $data['UpdatedAt'];
		$hours = floor($MwTime/3600);
		$minutes = floor(($MwTime/60-$hours*60));
		$seconds = substr($MwTime-$minutes*60-$hours*3600,-2);
		$time = sprintf("%02dh%02dm%02ds", $hours, $minutes, $seconds);
		if (!is_null($data['avg'])) {
			$avg = sprintf ("%.1f", $data['avg']/10000);
			$rank = $data['rank'];
		} else {
			$avg = "-";
			$rank = "-";
		}
		
		

		$bg = ($bg == $bg1) ? $bg2 : $bg1;
		echo "<tr bgcolor=".$bg." onMouseOver=\"this.style.backgroundColor='".$bg3."'\" onMouseOut=\"this.style.backgroundColor='".$bg."'\">";
		echo "<td class=\"celltext\">".$rank."</td>";
		if ($stunt[$serv]){
		echo "<td class=\"celltext\"><a href=\"?serv=".$serv."&lang=".$lang."&page=stprecords&plid=".$data['Id']."\" class=\"celltext\">".$cp->toHTML($data['NickName'], false, true, 'all')."</a></td></td>";
		} else {
		echo "<td class=\"celltext\"><a href=\"?serv=".$serv."&lang=".$lang."&page=precords&plid=".$data['Id']."\" class=\"celltext\">".$cp->toHTML($data['NickName'], false, true, 'all')."</a></td></td>";
		}
		echo "<td class=\"celltext\">".$data['Login']."</td>";
		echo "<td class=\"celltext\">".$avg."</td>";
		echo "<td class=\"celltext\">".$time."</td>";
		echo "<td class=\"celltext\">".$lastvisited."</td>";
		echo "<td class=\"celltext\">".$data['Id']."</td>";
		if($data['Nation']){
			echo "<td class=\"celltext\"><img src=\"img/flags/".$data['Nation'].".png\" alt=\"".$data['Nation']."\" title=\"".$data['Nation']."\"></td>";
		} else {
			echo "<td class=\"celltext\"><img src=\"img/flags/UKN.png\" alt=\"Unknown\" title=\"Unknown\"></td>";
		}
	    if ($show_player_banners) print "<td class=\"celltext\"><a href=\"?serv=".$serv."&lang=".$lang."&page=playerstatsbox&plid=".$data['Id']."\"><img src=\"img/stats.gif\" border=\"0\"></a></td>";
	    echo "</tr>";
	}
}

?>

</table>

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 13 Dec 2011 10:42
by sbone
Things are little different but still the problem with special chars.

Image

Yes i think is due to php 5.3.2 :(

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 13 Dec 2011 18:48
by oliverde8
I used it on my old server with php5.3 no problems.

Maybe you changed the charset of the files when saving them?

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 14 Dec 2011 21:23
by Ant
oliverde8 wrote:I used it on my old server with php5.3 no problems.

Maybe you changed the charset of the files when saving them?
On top of this, maybe check how your db is encoded - and also, what operating system are you using?

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 15 Dec 2011 09:46
by sbone
OS : Linux CentOS 6.1 x64
Php 5.3.3
Mysql db encodage : latin1_swedish_ci
Im using xstats since a lot of time on several servers (TMNF & TM2) with same configuration,
the only difference is the version of php and only this ranking page with php 5.3.3 isn't correct.

I read about a possibly bug in php-pdo...

To be continued ;)

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 15 Dec 2011 10:29
by McRobert
Sorry guys, but I get this error on my server and you do not see the banners of users

Code: Select all

PHP Parse error:  syntax error, unexpected T_STRING in /mnt/ssd1/hosted/blackangel.fakaheda.eu/xaseco-stats2/xaseco-stats/playerstats.php on line 155, referer: http://blackangel.fakaheda.eu/xaseco-stats2/xaseco-stats/?serv=0&lang=ENG&page=playerstatsbox&plid=20
Thanks

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 15 Dec 2011 10:32
by sbone
McRobert wrote:Sorry guys, but I get this error on my server and you do not see the banners of users

Code: Select all

PHP Parse error:  syntax error, unexpected T_STRING in /mnt/ssd1/hosted/blackangel.fakaheda.eu/xaseco-stats2/xaseco-stats/playerstats.php on line 155, referer: http://blackangel.fakaheda.eu/xaseco-stats2/xaseco-stats/?serv=0&lang=ENG&page=playerstatsbox&plid=20
Thanks
And you have also the same problem as mine, incorrect nickname are displayed on ranking page
for special caracteres

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 15 Dec 2011 10:39
by McRobert
sbone wrote:
McRobert wrote:Sorry guys, but I get this error on my server and you do not see the banners of users

Code: Select all

PHP Parse error:  syntax error, unexpected T_STRING in /mnt/ssd1/hosted/blackangel.fakaheda.eu/xaseco-stats2/xaseco-stats/playerstats.php on line 155, referer: http://blackangel.fakaheda.eu/xaseco-stats2/xaseco-stats/?serv=0&lang=ENG&page=playerstatsbox&plid=20
Thanks
And you have also the same problem as mine, incorrect nickname are displayed on ranking page
for special caracteres

For your problem I solved by putting this string in config.php

Code: Select all

mysql_query('set names utf8');

Re: (X)Aseco+RASP Website Stats v3.6

Posted: 15 Dec 2011 10:45
by sbone
McRobert wrote:
sbone wrote:
McRobert wrote:Sorry guys, but I get this error on my server and you do not see the banners of users

Code: Select all

PHP Parse error:  syntax error, unexpected T_STRING in /mnt/ssd1/hosted/blackangel.fakaheda.eu/xaseco-stats2/xaseco-stats/playerstats.php on line 155, referer: http://blackangel.fakaheda.eu/xaseco-stats2/xaseco-stats/?serv=0&lang=ENG&page=playerstatsbox&plid=20
Thanks
And you have also the same problem as mine, incorrect nickname are displayed on ranking page
for special caracteres

For your problem I solved by putting this string in config.php

Code: Select all

mysql_query('set names utf8');
Thanks, it works ;)