Bug in Player Count

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Bug in Player Count

    Danter:
    I think there is a bug in the "Online Player Count" in the overview of 2moons 2.0. The online count is performed before the update, when the current player was online. So it will sometimes count the active player and sometimes not. To resolve this, count online player execpt the current user and add 1 to the result:

    PHP Source Code

    1. $onlineUserResult = $db->select("SELECT id FROM %%USERS%% WHERE NOT id =:userId AND onlinetime > :timeUser AND authlevel < :auth ;", array(
    2. ':timeUser' => TIMESTAMP - 15*60,
    3. ':auth' => AUTH_ADM,
    4. ':userId' => $USER['id'],
    5. ));
    6. $onlineUser = $db->rowCount($onlineUserResult) + 1; //And me
  • yes, and I haven't retouched the source code of version 2.0 at all because the best thing is to do it in js to have dynamic rendering without refreshing on our view.
  • Palatinus wrote:

    Danter:
    I think there is a bug in the "Online Player Count" in the overview of 2moons 2.0. The online count is performed before the update, when the current player was online. So it will sometimes count the active player and sometimes not. To resolve this, count online player execpt the current user and add 1 to the result:

    PHP Source Code

    1. $onlineUserResult = $db->select("SELECT id FROM %%USERS%% WHERE NOT id =:userId AND onlinetime > :timeUser AND authlevel < :auth ;", array(
    2. ':timeUser' => TIMESTAMP - 15*60,
    3. ':auth' => AUTH_ADM,
    4. ':userId' => $USER['id'],
    5. ));
    6. $onlineUser = $db->rowCount($onlineUserResult) + 1; //And me
    Con esta condición igual sigue sin contar a todos los usuarios conectados.
    No es que este contando mal, es que la condición real es mostrar en línea a todos los usuarios excepto a los miembros del staff

    Source Code

    1. $onlineUserResult = $db->select("SELECT * FROM %%USERS%% WHERE onlinetime > :timeUser AND authlevel < :auth ;", array(
    2. ':timeUser' => TIMESTAMP - 15*60,
    3. ':auth' => AUTH_ADM,
    4. ));
    5. $onlineUser = $db->rowCount($onlineUserResult);

    Por lo que con la condición que pones, si igual agregas otro miembro con authlevel mayor que 0 igual no los contará

    Para tener en cuenta a todos los miembros incluyendo miembros de staff deberías poner algo así


    Source Code

    1. $onlineUserResult = $db->select("SELECT * FROM %%USERS%% WHERE onlinetime > :timeUser;", array(
    2. ':timeUser' => TIMESTAMP - 15*60
    3. ));
    4. $onlineUser = $db->rowCount($onlineUserResult);
    También que esto solamente incluye a los usuarios activos en los últimos 15 minutos


    PD: Esto es lo que entendí por tu mensaje, sino es pido disculpa. la traducción apesta
    VERY SAD :/ :/ :/ :/