hey Repflez
Enviado: 07 Jul 2025, Seg, 07:47
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@
Um espaço para debates e compartilhamento de conhecimento sobre Phantasy Star Online
https://resistencia-server.com/
Código: Selecionar todos
$status_url = "http://167.88.32.81/phpbb/status.php";
$status_data = file_get_contents($status_url);
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';
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>
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 will be anxiously waiting for your return Lol XD good work, have a blessed day.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
thank you soo much sorry for delay I see it next day @onion20@ @onion26@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
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>
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>
Código: Selecionar todos
nano /var/www/html/phpbb/status_proxy.php
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);
?>
@onion22@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@