(UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.') GROUP BY tusuario.id_user ORDER BY last_connect DESC' ); } else { $sql = sprintf( 'SELECT tusuario.id_user, tusuario.last_connect FROM tusuario INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user AND tusuario_perfil.id_grupo IN (%s) WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.') GROUP BY tusuario.id_user ORDER BY last_connect DESC', $groups ); } break; case 'postgresql': if (users_is_admin()) { $sql = sprintf( "SELECT tusuario.id_user, tusuario.last_connect FROM tusuario WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.') GROUP BY tusuario.id_user ORDER BY last_connect DESC' ); } else { $sql = sprintf( "SELECT tusuario.id_user, tusuario.last_connect FROM tusuario INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user AND tusuario_perfil.id_grupo IN (%s) WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.') GROUP BY tusuario.id_user ORDER BY last_connect DESC', $groups ); } break; case 'oracle': if (users_is_admin()) { $sql = sprintf( "SELECT tusuario.id_user, tusuario.last_connect FROM tusuario WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.') GROUP BY tusuario.id_user ORDER BY last_connect DESC' ); } else { $sql = sprintf( "SELECT tusuario.id_user, tusuario.last_connect FROM tusuario INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user AND tusuario_perfil.id_grupo IN (%s) WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.') GROUP BY tusuario.id_user ORDER BY last_connect DESC', $groups ); } break; default: // Nothing to do. break; } $rows = db_get_all_rows_sql($sql); if (empty($rows)) { $rows = []; echo "