💖 Apoie o Servidor

Escolha sua forma de contribuição:

hey Repflez

Lugar pra conversar com outros jogadores, fazer amizade e marcar partidas.
Avatar do usuário
Resistência PSO
Site Admin
Mensagens: 301
Registrado em: 02 Abr 2025, Qua, 10:16
Localização: Pioneer 2
Has thanked: 26 times
Been thanked: 96 times
Contato:

hey Repflez

Mensagem por Resistência PSO »

What is your level of knowledge in phpBB forums? I need help with a setup that I can't find a solution for, and if you could help with this, I would really appreciate it. @onion5@
Imagem
Avatar do usuário
Resistência PSO
Site Admin
Mensagens: 301
Registrado em: 02 Abr 2025, Qua, 10:16
Localização: Pioneer 2
Has thanked: 26 times
Been thanked: 96 times
Contato:

Re: hey Repflez

Mensagem por Resistência PSO »

what is my doubt:
To display the server status directly on your phpBB forum, without the user having to click on a link, you can integrate the contents of the status page directly into the forum template. Here is a detailed step-by-step guide to do this:🛠️ Steps to Display Server Status on phpBB1. Get the status dataUse PHP to fetch the data from the URL where the status is available:

Código: Selecionar todos

$status_url = "http://167.88.32.81/phpbb/status.php";
$status_data = file_get_contents($status_url);
Make sure that allow_url_fopen is enabled in your php.ini. If it is not, use cURL as an alternative.2. Interpret the dataIf the data is plain text (like in the example you provided), you can separate it by lines:

Código: Selecionar todos

$status_lines = explode("\n", trim($status_data));
$hunters_online = $status_lines[0] ?? 'N/A';
$dreamcast_pc = $status_lines[1] ?? 'N/A';
$gamecube = $status_lines[2] ?? 'N/A';
$episode_iii = $status_lines[3] ?? 'N/A';
$psobb = $status_lines[4] ?? 'N/A';
3. Display in the forum template Edit the phpBB template (for example, overall_header.html or a custom block) and insert the following PHP code:

Código: Selecionar todos

<div class="server-status">
    <h3>Status do Servidor</h3>
    <p><?= htmlspecialchars($hunters_online) ?></p>
    <p><?= htmlspecialchars($dreamcast_pc) ?></p>
    <p><?= htmlspecialchars($gamecube) ?></p>
    <p><?= htmlspecialchars($episode_iii) ?></p>
    <p><?= htmlspecialchars($psobb) ?></p>
</div>
If your forum has caching enabled, clear the cache after editing the template files.4. Style with CSSAdd this CSS to your theme to make the display more pleasant:

Código: Selecionar todos

.server-status {
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    padding: 10px;
    margin: 15px 0;
    font-family: Arial, sans-serif;
}
.server-status h3 {
    margin-top: 0;
}
.server-status p {
    margin: 4px 0;
}
I have already tried to follow this tutorial but I didn’t succeed to be honest when I tried I had to revert the forum to a previous state using the daily active backup in my hosting service, and my idea as I said would be to have the status displayed directly here just like it is in the example:
https://ragol.org/
Do you know how to do this? @onion35@
Imagem
Avatar do usuário
Repflez
MEMBRO HANDGUN
Mensagens: 14
Registrado em: 26 Jun 2025, Qui, 16:25
Localização: Taco Land
Been thanked: 14 times

Re: hey Repflez

Mensagem por Repflez »

phpBB is not that hard, but that's a more general webdev skill.

Your script needs to output proper json, as in take newserv's json, format it as how you want, then output a separate json that you can consume in the forum. I'm about to go to work so I can give a more detailed explanation later
Imagem
Discord: omika_
Avatar do usuário
legit nyck
MEMBRO SPREAD NEEDLE
Mensagens: 236
Registrado em: 21 Abr 2025, Seg, 09:06
Localização: Suzano Sp Brasil
Has thanked: 13 times
Been thanked: 145 times
Contato:

Re: hey Repflez

Mensagem por legit nyck »

Repflez escreveu: 07 Jul 2025, Seg, 11:46 phpBB is not that hard, but that's a more general webdev skill.

Your script needs to output proper json, as in take newserv's json, format it as how you want, then output a separate json that you can consume in the forum. I'm about to go to work so I can give a more detailed explanation later
I will be anxiously waiting for your return Lol XD good work, have a blessed day.
Imagem
Avatar do usuário
Repflez
MEMBRO HANDGUN
Mensagens: 14
Registrado em: 26 Jun 2025, Qui, 16:25
Localização: Taco Land
Been thanked: 14 times

Re: hey Repflez

Mensagem por Repflez »

Ok, as I said, you consume newserv's internal API, like how you're doing it actually, but instead of outputting a HTML file, you make it output a different json with the data you're going to show. Then here in the forum, you add the html it's going to be here in your templates, then add some js code to consume your new api and show the correct data, and that's the gist of it.

Obviously, you may need to play a bit with Apache's configuration to make it work because browsers expect ajax calls to be over https domains, and your status pages are not only http, but also a naked ip
Imagem
Discord: omika_
Avatar do usuário
Resistência PSO
Site Admin
Mensagens: 301
Registrado em: 02 Abr 2025, Qua, 10:16
Localização: Pioneer 2
Has thanked: 26 times
Been thanked: 96 times
Contato:

Re: hey Repflez

Mensagem por Resistência PSO »

Repflez escreveu: 07 Jul 2025, Seg, 20:20 Ok, as I said, you consume newserv's internal API, like how you're doing it actually, but instead of outputting a HTML file, you make it output a different json with the data you're going to show. Then here in the forum, you add the html it's going to be here in your templates, then add some js code to consume your new api and show the correct data, and that's the gist of it.

Obviously, you may need to play a bit with Apache's configuration to make it work because browsers expect ajax calls to be over https domains, and your status pages are not only http, but also a naked ip
thank you soo much sorry for delay I see it next day @onion20@ @onion26@
Imagem
Avatar do usuário
Resistência PSO
Site Admin
Mensagens: 301
Registrado em: 02 Abr 2025, Qua, 10:16
Localização: Pioneer 2
Has thanked: 26 times
Been thanked: 96 times
Contato:

Re: hey Repflez

Mensagem por Resistência PSO »

Ok deixe-me pensar agora vou colando umas coisas aqui e ir trabalhando em cima disso mas antes...vou criar uma snapshot caso algo de errado kkkkkk

overall_header.html --- index_body.html

Código: Selecionar todos

<div id="server-status" class="status-box">
  <h3>Status do Servidor</h3>
  <p>Hunters Online: <span id="hunters-online">Carregando...</span></p>
  <p>Dreamcast/PC: <span id="dreamcast-pc">Carregando...</span></p>
  <p>GameCube: <span id="gamecube">Carregando...</span></p>
  <p>Episode III: <span id="episode-iii">Carregando...</span></p>
  <p>psoBB: <span id="psobb">Carregando...</span></p>
</div>
overall_footer.html

Código: Selecionar todos

<script>
  async function fetchServerStatus() {
    try {
      const response = await fetch("http://167.88.32.81/phpbb/status_server.php");
      const text = await response.text();

      // Extrai os dados usando expressões regulares simples
      const hunters = text.match(/(\d+)\s+hunters\s+online/i);
      const dreamcast = text.match(/Dreamcast\/PC:\s+(\d+)/i);
      const gamecube = text.match(/GameCube:\s+(\d+)/i);
      const episode = text.match(/Episode III:\s+(\d+)/i);
      const psobb = text.match(/psoBB:\s+(\d+)/i);

      document.getElementById("hunters-online").textContent = hunters ? hunters[1] : "N/A";
      document.getElementById("dreamcast-pc").textContent = dreamcast ? dreamcast[1] : "N/A";
      document.getElementById("gamecube").textContent = gamecube ? gamecube[1] : "N/A";
      document.getElementById("episode-iii").textContent = episode ? episode[1] : "N/A";
      document.getElementById("psobb").textContent = psobb ? psobb[1] : "N/A";
    } catch (error) {
      console.error("Erro ao buscar status do servidor:", error);
    }
  }

  fetchServerStatus();
  setInterval(fetchServerStatus, 60000); // Atualiza a cada 60 segundos
</script>
@onion33@ vamos lá
Imagem
Avatar do usuário
Resistência PSO
Site Admin
Mensagens: 301
Registrado em: 02 Abr 2025, Qua, 10:16
Localização: Pioneer 2
Has thanked: 26 times
Been thanked: 96 times
Contato:

Re: hey Repflez

Mensagem por Resistência PSO »

95% do caminho andado mas estou entediado e vou terminar isso amanha mas deixarei aqui as minhas modificações para me lembrar de onde prosseguir amanha
status_proxy.php

Código: Selecionar todos

nano /var/www/html/phpbb/status_proxy.php
com debug

Código: Selecionar todos

<?php
header('Content-Type: text/plain');
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://167.88.32.81/phpbb/status_server.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Cache-Control: no-cache']);

$response = curl_exec($ch);

if ($response === false) {
    echo "Erro cURL: " . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
overall_footer.html
Imagem
Avatar do usuário
Resistência PSO
Site Admin
Mensagens: 301
Registrado em: 02 Abr 2025, Qua, 10:16
Localização: Pioneer 2
Has thanked: 26 times
Been thanked: 96 times
Contato:

Re: hey Repflez

Mensagem por Resistência PSO »

DROGA EU CONSEGUI @onion22@ ESTA FUNCIONAL AGORA O RESTO É DETALHE ( DETALHES ESSE QUE FAREI AMANHA XD )

VICTORY @onion28@
Imagem
Avatar do usuário
Spam
MEMBRO SPREAD NEEDLE
Mensagens: 380
Registrado em: 22 Abr 2025, Ter, 12:54
Localização: Pioneer 2
Has thanked: 2 times
Been thanked: 31 times

Re: hey Repflez

Mensagem por Spam »

Resistência PSO escreveu: 17 Jul 2025, Qui, 22:39 DROGA EU CONSEGUI @onion22@ ESTA FUNCIONAL AGORA O RESTO É DETALHE ( DETALHES ESSE QUE FAREI AMANHA XD )

VICTORY @onion28@
@onion22@
Imagem
Imagem
Imagem
Imagem
Responder