there is no connection, data does not go to the website, ranking general players and Guilds no data?. Player Online Data error.
View attachment 286747View attachment 286748View attachment 286749
the ranking_geral.php is trying to catch ClassStyle, i already removed that in my FIX man, if still asking for ClassStyle, that means you are not using the ranking_geral.php that i posted in the fix for ep33 databases or you are not using the function_class.php for ep33, look my screenshot, I am using ep33 database, and my character appears just fine on ranking_geral.php, i don't know how, but you are doing something wrong for sure.
Just copy everything in fix ep33 databases.rar and past inside your website main folder, after that, check settings.php for configurations, and that's it.
there is no connection, data does not go to the website, ranking general players and Guilds no data?. Player Online Data error.
View attachment 286747View attachment 286748View attachment 286749
folder for ranking_geral.php is template/request
replace your code for ranking_geral for this code below:
<?php
require_once __DIR__ . '/../../web_conexao/init.php';
require_once __DIR__ . '/../../web_conexao/function_class.php';
$db = Database::conexao();
$stmt = $db->prepare("SELECT TOP 100 Name, LEV, Style, Nation FROM Server01.dbo.cabal_character_table WHERE Nation <> 3 ORDER BY LEV DESC");
$stmt->execute();
$resultados = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<section class="custom-ranking">
<div class="ranking-header">
<h1>Ranking de Personagens</h1>
<p>Os 100 personagens com maior nível no servidor</p>
</div>
<div class="ranking-table-wrapper">
<table class="ranking-table">
<thead>
<tr>
<th>Rank</th>
<th>Nome</th>
<th>Nível</th>
<th>Classe</th>
<th>Sexo</th>
</tr>
</thead>
<tbody>
<?php foreach ($resultados as $i => $r):
$style = decodificar_ep33($r['Style']);
$posicao = $i + 1;
$classeLinha = $i % 2 === 0 ? 'linha-par' : 'linha-impar';
?>
<tr class="<?= $classeLinha ?>">
<td><span class="rank-number"><?= $posicao ?></span></td>
<td><?= htmlspecialchars($r['Name']) ?></td>
<td><?= $r['LEV'] ?></td>
<td>
<div class="classe-info">
<?= $style['Classe_Nome'] ?>
<span class="classe-nome"><?= $style['Classe_is_name'] ?></span>
</div>
</td>
<td><?= $style['Sexo_Icone'] ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</section>
<style>
.custom-ranking {
max-width: 1200px;
margin: 4rem auto;
padding: 0 1rem;
color: #fff;
font-family: 'Segoe UI', sans-serif;
}
.ranking-header {
text-align: center;
margin-bottom: 2rem;
}
.ranking-header h1 {
font-size: 3rem;
font-weight: 700;
color: #fbbf24;
margin-bottom: 0.5rem;
}
.ranking-header p {
font-size: 1.125rem;
color: #bbb;
}
.ranking-table-wrapper {
overflow-x: auto;
}
.ranking-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
background-color: #1a1a1a;
border: 1px solid #333;
border-radius: 8px;
overflow: hidden;
}
.ranking-table thead {
background-color: #2c2c2c;
}
.ranking-table th {
padding: 1rem;
text-align: left;
font-size: 0.95rem;
color: #fbbf24;
border-bottom: 1px solid #444;
}
.ranking-table td {
padding: 0.75rem 1rem;
font-size: 0.9rem;
color: #eee;
border-bottom: 1px solid #333;
}
.ranking-table tr.linha-par {
background-color: #202020;
}
.ranking-table tr.linha-impar {
background-color: #181818;
}
.ranking-table tr:hover {
background-color: #333;
}
.rank-number {
font-weight: bold;
color: #fbbf24;
}
.classe-info {
display: flex;
align-items: center;
gap: 0.5rem;
}
.classe-nome {
color: #ddd;
font-size: 0.9rem;
}
/* Responsivo */
Media (max-width: 768px) {
.ranking-header h1 {
font-size: 2rem;
}
.ranking-header p {
font-size: 1rem;
}
.ranking-table th,
.ranking-table td {
padding: 0.6rem 0.5rem;
font-size: 0.85rem;
}
.classe-nome {
font-size: 0.8rem;
}
}
</style>
replace your function_class.php for this code below
P.S. function_class.php is located in web_conexao folder.
function_class.php:
<?php
function decodificar_ep33($styleValue) {
// Arrays para classes (mantidos da sua versão anterior)
$classeChar_array = array(
1 => '<img src="images/utilitares/gu.gif" width="19" height="19" title="Guerreiro"/>',
2 => '<img src="images/utilitares/du.gif" width="19" height="19" title="Duelista"/>',
3 => '<img src="images/utilitares/ma.gif" width="19" height="19" title="Mago"/>',
4 => '<img src="images/utilitares/aa.gif" width="19" height="19" title="Arqueiro Arcano"/>',
5 => '<img src="images/utilitares/ga.gif" width="19" height="19" title="Guardião Arcano"/>',
6 => '<img src="images/utilitares/ea.gif" width="19" height="19" title="Espadachim Arcano"/>',
7 => '<img src="images/utilitares/gl.gif" width="19" height="19" title="Gladiador"/>',
8 => '<img src="images/utilitares/at.gif" width="19" height="19" title="Atirador"/>',
9 => '<img src="images/utilitares/mn.gif" width="19" height="19" title="Mago Negro"/>',
// ... adicione mais classes se houver
);
$classeChar_Sigla = array(
1 => 'gu', 2 => 'du', 3 => 'ma',
4 => 'aa', 5 => 'ga', 6 => 'ea',
7 => 'gl', 8 => 'at', 9 => 'mn',
);
$classeChar_name = array(
1 => 'Guerreiro', 2 => 'Duelista', 3 => 'Mago',
4 => 'Arqueiro Arcano', 5 => 'Guardião Arcano', 6 => 'Espadachim Arcano',
7 => 'Gladiador', 8 => 'Atirador', 9 => 'Mago Negro',
);
// Decodificar a classe do valor 'Style'
// O ID da classe está nos bits 3 a 6 (deslocamento de 3 bits para a esquerda).
// Para obtê-lo, deslocamos 3 bits para a direita e aplicamos uma máscara de 0x0F (15 em decimal).
$classId = ($styleValue >> 3) & 0x0F;
// Decodificar o sexo do valor 'Style'
// O sexo é geralmente o bit 0.
// 0 = Masculino, 1 = Feminino
$sexo = $styleValue & 1;
$style = [];
$style['Classe'] = $classId;
$style['Classe_Nome'] = $classeChar_array[$classId] ?? 'Desconhecida';
$style['Classe_Sigla'] = $classeChar_Sigla[$classId] ?? '--';
$style['Classe_is_name'] = $classeChar_name[$classId] ?? 'Desconhecida';
$style['Sexo_Nome'] = $sexo == 0 ? 'Masculino' : 'Feminino';
$style['Sexo_Icone'] = $sexo == 0
? '<img src="images/utilitares/male.png" width="18" height="18" title="Masculino"/>'
: '<img src="images/utilitares/female.png" width="18" height="18" title="Feminino"/>';
return $style;
}
function decodificar($classId, $MegaHonra) {
$classeChar_array = array(
1 => '<img src="images/utilitares/gu.gif" width="19" height="19" title="Guerreiro"/>',
2 => '<img src="images/utilitares/du.gif" width="19" height="19" title="Duelista"/>',
3 => '<img src="images/utilitares/ma.gif" width="19" height="19" title="Mago"/>',
4 => '<img src="images/utilitares/aa.gif" width="19" height="19" title="Arqueiro Arcano"/>',
5 => '<img src="images/utilitares/ga.gif" width="19" height="19" title="Guardião Arcano"/>',
6 => '<img src="images/utilitares/ea.gif" width="19" height="19" title="Espadachim Arcano"/>',
7 => '<img src="images/utilitares/gl.gif" width="19" height="19" title="Gladiador"/>',
8 => '<img src="images/utilitares/at.gif" width="19" height="19" title="Atirador"/>',
9 => '<img src="images/utilitares/mn.gif" width="19" height="19" title="Mago Negro"/>',
// --- FIM NOVAS CLASSES ---
);
$classeChar_Sigla = array(
1 => 'gu', 2 => 'du', 3 => 'ma',
4 => 'aa', 5 => 'ga', 6 => 'ea',
7 => 'gl',
8 => 'at',
9 => 'mn',
);
$classeChar_name = array(
1 => 'Guerreiro', 2 => 'Duelista', 3 => 'Mago',
4 => 'Arqueiro Arcano', 5 => 'Guardião Arcano', 6 => 'Espadachim Arcano',
7 => 'Gladiador',
8 => 'Atirador',
9 => 'Mago Negro',
);
$classe = $classId;
$style['Classe'] = $classe;
$style['Classe_Nome'] = $classeChar_array[$classe] ?? 'Desconhecida';
$style['Classe_Sigla'] = $classeChar_Sigla[$classe] ?? '--';
$style['Classe_is_name'] = $classeChar_name[$classe] ?? 'Desconhecida';
$sexo = 0; // 0 para Masculino, 1 para Feminino (padrão)
$sexo_calc = round((((($MegaHonra % 0x4000000) % 0x20000) % 0x2000) % 0x100) / 8);
$sexo_classe_base = (((($MegaHonra % 0x4000000) % 0x20000) % 0x2000) % 0x100) - (($sexo_calc - 1) * 8);
$sexo = ($sexo_classe_base % 2 == 0) ? 0 : 1;
$style['Sexo_Nome'] = $sexo == 0 ? 'Masculino' : 'Feminino';
$style['Sexo_Icone'] = $sexo == 0
? '<img src="images/utilitares/male.png" width="18" height="18" title="Masculino"/>'
: '<img src="images/utilitares/female.png" width="18" height="18" title="Feminino"/>';
return $style;
}
function maps($number){
$maps =
array(1 => ' Tundra Infame',
2 => ' Deserto Lamentao',
3 => ' Floresta Desespero',
4 => 'Porto Lux',
5 => ' Forte Ruina',
6 => ' Elo Perdido',
7 => ' Regiao dos Lagos',
8 => ' Santurio Profano',
9 => ' Floresta Mutante',
10 => ' Pontus Ferrum',
11 => ' Forte Infernus',
12 => ' Vestigio Arcano',
13 => 'Dragona dos Mortos',
14 => 'Tropa de Soldados',
15 => 'Tierra Gloriosa',
16 => 'Tierra Gloriosa[Espera]',
17 => ' Ilha Desperta',
18 => ' T2 Desperto',
19 => 'Prisao',
20 => 'Arena Da Defesa',
21 => 'Senellinia',
22 => ' Dragona 3ss',
23 => ' Templo Esquecido 1SS',
24 => ' Cidade Vulcanica',
25 => ' Patren',
26 => ' Lago do Crepusculo',
27 => 'Calabouo',
28 => 'Calabouo',
29 => 'Calabouo',
30 => ' Central de Teleporte',
31 => 'Calabouo',
32 => 'Calabouo',
33 => 'Calabouo',
34 => ' Templo 2 ss',
35 => ' Ilha perdida',
36 => ' Siena 1 ss',
37 => ' Siena 2 ss',
38 => 'Calabouo',
39 => 'Calabouo',
40 => 'Calabouo',
41 => 'Calabouo',
42 => 'Calabouo',
43 => 'Calabouo',
44 => 'Calabouo',
45 => 'Calabouo',
46 => 'Calabouo',
47 => ' Castelo 1',
48 => 'Calabouo',
49 => 'Calabouo',
50 => 'Calabouo',
51 => ' Castelo 2',
52 => 'Calabouo',
53 => 'Calabouo'
);
return $maps[$number] ?? 'Desconhecido'; // Adicionado null coalescing operator para lidar com números não mapeados
}
function protecao($value){
return htmlspecialchars($value);
}
function anti_injection($sql)
{
$sql = preg_replace("/(from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/i", '', $sql);
$sql = trim($sql);
$sql = strip_tags($sql);
$sql = addslashes($sql);
$sql = htmlspecialchars($sql);
return $sql;
}
$badwords = array(";","'", "+", "--","/","|",":", "=", "%", "(", ")","DROP", "INSERT", "insert", "SELECT", "FROM", "from", "UPDATE", "DELETE", "drop", "select", "update", "delete", "WHERE", "where", "-1", "-2", "-3","-4", "-5", "-6", "-7", "-8", "-9",);
function protect($var) {
$banlist = array("insert", "select", "update", "delete", ";", "'", "+", "--", "/", "|", ":", "=", "%", "(", ")", "distinct", "having", "truncate", "replace","handler", "like", " as ", "or ", "procedure", "limit", "order by", "group by", "asc", "union", "desc", "'", "union all");
if(preg_match("/[a-zA-Z0-9]+/", $var)){
$texto = trim(str_replace($banlist,'', strtolower($var)));
}
return $texto;
}
if(!function_exists("antiSQL")) {
function antiSQL($campo, $adicionaBarras = false) {
$campo = preg_replace("/(from|alter table|select|insert|delete|update|were|drop table|-1|-2|-3|-4|-5|-6|-7|-8|-9|show tables|#|\*|--|\\\\)/i","Anti Sql-Injection - bjus Mãe !",$campo);
$campo = trim($campo);
$campo = strip_tags($campo);
if($adicionaBarras || !get_magic_quotes_gpc())
$campo = addslashes($campo);
return $campo;
} }
function soNumero($str){
return preg_replace("/[^0-9]/", "", $str);
}
function validaEmail($email){
$conta = "^[a-zA-Z0-9\._-]+@";
$domino = "outlook|outlook.com|live|live.com|hotmail|hotmail.com|gmail|gmail.com|yahoo|yahoo.com+.";
$extensao = "([a-zA-Z]{2,4})$";
$pattern = $conta.$domino.$extensao;
if(preg_match("/$pattern/i", $email)){
return true;
}else{
return false;
}
}
function tempoItem($tempo){
switch($tempo) {
case 1: echo "1 Hora"; break;
case 2: echo "2 Horas"; break;
case 3: echo "3 Horas"; break;
case 4: echo "4 Horas"; break;
case 5: echo "5 Horas"; break;
case 6: echo "6 Horas"; break;
case 7: echo "10 Horas"; break;
case 8: echo "12 Horas"; break;
case 9: echo "1 Dia"; break;
case 10: echo "3 Dias"; break;
case 11: echo "5 Dias"; break;
case 12: echo "7 Dias"; break;
case 13: echo "10 Dias"; break;
case 14: echo "14 Dias"; break;
case 15: echo "15 Dias"; break;
case 16: echo "20 Dias"; break;
case 17: echo "30 Dias"; break;
case 18: echo "45 Dias"; break;
case 19: echo "60 Dias"; break;
case 20: echo "90 Dias"; break;
case 21: echo "100 Dias"; break;
case 22: echo "120 Dias"; break;
case 23: echo "180 Dias"; break;
case 24: echo "270 Dias"; break;
case 25: echo "1 Ano"; break;
case 26: echo "3 Minutos"; break;
case 27: echo "30 Minutos"; break;
case 31: echo "Permanente"; break;
}
}
function limitarTexto($texto, $limite, $quebrar = true){
$contador = strlen(strip_tags($texto));
if($contador <= $limite):
$newtext = $texto;
else:
if($quebrar == true):
$newtext = trim(mb_substr($texto, 0, $limite))."...";
else:
$ultimo_espaço = strrpos(mb_substr($texto, 0, $limite)," ");
$newtext = trim(mb_substr($texto, 0, $ultimo_espaço))."...";
endif;
endif;
return $newtext;
}
/*------------functions -----------*/
function Deslogado() {
$idle_timeout = 1800;
$absolute_timeout = 28800;
if (!isset($_SESSION['my_login']) || empty($_SESSION['my_login'])) {
header('Location: /template/request/login_form.php');
exit;
}
if (isset($_SESSION['last_activity']) && (time() - $_SESSION['last_activity'] > $idle_timeout)) {
session_unset();
session_destroy();
session_start();
$_SESSION['login_error'] = 'Sua sessão expirou por inatividade. Faça login novamente.';
header('Location: /template/request/login_form.php');
exit;
}
if (!isset($_SESSION['login_time'])) {
$_SESSION['login_time'] = time();
} elseif (time() - $_SESSION['login_time'] > $absolute_timeout) {
session_unset();
session_destroy();
session_start();
$_SESSION['login_error'] = 'Sua sessão expirou por segurança. Faça login novamente.';
header('Location: /template/request/login_form.php');
exit;
}
$_SESSION['last_activity'] = time();
}
function isAdmin() {
if (!isset($_SESSION['my_login']) || empty($_SESSION['my_login'])) {
writeToLog("isAdmin(): my_login não definido ou vazio na sessão. Retornando false.", 'INFO');
return false;
}
$current_login = $_SESSION['my_login'];
writeToLog("isAdmin(): Verificando se '" . $current_login . "' é um admin.");
if (!defined('ADMIN_LOGINS') && !isset($GLOBALS['admin_users'])) {
writeToLog("isAdmin(): ERRO - Lista de administradores (ADMIN_LOGINS ou $admin_users) NÃO ENCONTRADA. Verifique settings.php e sua inclusão.", 'CRITICAL');
return false;
}
$admin_list = [];
if (defined('ADMIN_LOGINS')) {
$admin_list = ADMIN_LOGINS;
writeToLog("isAdmin(): Usando constante ADMIN_LOGINS: " . json_encode($admin_list));
} elseif (isset($GLOBALS['admin_users'])) {
$admin_list = $GLOBALS['admin_users'];
writeToLog("isAdmin(): Usando variável global \$admin_users: " . json_encode($admin_list));
} else {
writeToLog("isAdmin(): Nenhuma lista de admin encontrada.", 'WARNING');
return false;
}
$is_admin = in_array($current_login, $admin_list);
if ($is_admin) {
writeToLog("isAdmin(): '" . $current_login . "' é um administrador. Retornando true.", 'INFO');
return true;
} else {
writeToLog("isAdmin(): '" . $current_login . "' NÃO é um administrador. Retornando false.", 'INFO');
return false;
}
}
function AdminCP() {
if (!isAdmin()) {
writeToLog("AdminCP: Acesso negado para " . (isset($_SESSION['my_login']) ? $_SESSION['my_login'] : 'usuário não logado') . ". Redirecionando para index.php.", 'WARNING');
header("Location: /index.php");
exit;
}
}
function msgErro(){
echo '<script>console.log( swal("Information!", "fill in all fields of record.", "info") );</script>';
}
function checkout_token(){
$encrypt = md5(url_token);
$validat_url = md5($_SERVER['SERVER_NAME']);
if($validat_url != $encrypt){
echo '<div class=\'ferrorbig\'> Could not access this page because the access token is invalid, check with administrator.</div><meta HTTP-EQUIV=\'Refresh\' CONTENT=\'3;URL=../\'>';
exit();
}
}
function AntSQL($str) {
if( !is_array( $str ) ) {
$str = preg_replace( '/(from|select|insert|delete|where|drop|union|order|update|database)/i', '', $str );
$str = preg_replace( '/(<|<)?script(\/?(>|>(.*))?)/i', '', $str );
$tbl = get_html_translation_table( HTML_ENTITIES );
$tbl = array_flip( $tbl );
$str = addslashes( $str );
$str = strip_tags( $str );
return strtr( $str, $tbl );
} else {
return array_filter( $str, "AntSQL" );
}
}
function aiRemove($sql)
{
while(
preg_match("/(from|select|update|insert|shutdown|delete|where|drop table|show tables|'|#|\*|--|\\\\)/i", $sql)
||
preg_match("/(FROM|SELECT|UPDATE|INSERT|SHUTDOWN|DELETE|WHERE|DROP TABLE|SHOW TABLES|#|\*|--|\\\\)/i", $sql)
){
$sql = preg_replace("/(from|select|update|insert|shutdown|delete|where|drop table|show tables|'|#|\*|--|\\\\)/i","",$sql);
$sql = preg_replace("/(FROM|SELECT|UPDATE|INSERT|SHUTDOWN|DELETE|WHERE|DROP TABLE|SHOW TABLES|#|\*|--|\\\\)/i","",$sql);
}
$sql = trim($sql);
$sql = strip_tags($sql);
$sql = addslashes($sql);
return $sql;
}
function aiClearVar($var){
if(is_array($var)){
foreach($var as $k => $v){
if(is_array($v))
$var[$k] = aiClearVar($v);
else
$var[$k] = aiRemove($v);
}
}else{
$var = aiRemove($var);
}
return $var;
}
$_REQUEST = aiClearVar($_REQUEST);
$_POST = aiClearVar($_POST);
$_GET = aiClearVar($_GET);
$_COOKIE = aiClearVar($_COOKIE);
$_SESSION = aiClearVar($_SESSION);
?>