Ir para conteúdo

[Gesior Aac] 2 Novas Estatisticas Para Seu Web Site.


tyuahoi

Posts Recomendados

Olá

 

Após 3 Tentativas d autorizaçao para postar o script em outro forum, o Dono Me Autorizou POSAKPDKPSAKD

 

1. Estatisticas Do Servidor. (Ultimo Char Criado, Top Etc.)

 

Abra O: latestnews.php

E procure pela linha: $time = time(); ( Normalmente Bem No Começo)

 

adicione isso logo abaixo:

 

/////////////////////////////////////////////////////////////////////////////////////////
//The new edition of my script: Best Player, Last joined and something new Server Motd.//
/////////////////////////Everything in the new appearance.///////////////////////////////
//////////////////////////////////////by  Aleh///////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
///Queries ///
$query = $SQL->query('SELECT `players`.`name`,`players`.`id`,`players`.`level`, `players`.`experience`, `server_motd`.`id`, `server_motd`.`text` FROM `players`,`server_motd` WHERE `players`.`group_id` < '.$config['site']['players_group_id_block'].' AND `players`.`name` != "Account Manager" ORDER BY `players`.`level` DESC, `players`.`experience` DESC, `server_motd`.`id` DESC LIMIT 1;')->fetch();
$query2 = $SQL->query('SELECT `id`, `name` FROM `players` ORDER BY `id` DESC LIMIT 1;')->fetch();
$housesfree = $SQL->query('SELECT COUNT(*) FROM `houses` WHERE `owner`=0;')->fetch();
$housesrented = $SQL->query('SELECT COUNT(*) FROM `houses` WHERE `owner`=1;')->fetch();
$players = $SQL->query('SELECT COUNT(*) FROM `players` WHERE `id`>0;')->fetch();
$accounts = $SQL->query('SELECT COUNT(*) FROM `accounts` WHERE `id`>0;')->fetch();
$banned = $SQL->query('SELECT COUNT(*) FROM `bans` WHERE `id`>0;')->fetch();
$guilds = $SQL->query('SELECT COUNT(*) FROM `guilds` WHERE `id`>0;')->fetch();
///End Queries ///

   $main_content .= '<table bgcolor='.$config['site']['darkborder'].' border=0 cellpadding=4 cellspacing=1 width=100%>
   <tr bgcolor='. $config['site']['vdarkborder'] .'><td align="center" class=white colspan=1><b>Welcome to '.$config['server']['serverName'].'</b></td></tr>
   <tr><td><table border=0 cellpadding=1 cellspacing=1 width=100%>

   <tr bgcolor='. $config['site']['lightborder'] .'><td><center>Last joined us: <a href="?subtopic=characters&name='.urlencode($query2['name']).'">'.$query2['name'].'</a>, player number '.$query2['id'].'. Welcome and wish you a nice game!</center></td></tr>
   <tr bgcolor='. $config['site']['lightborder'] .'><td><center>Currently, the best player on the server is: <a href="index.php?subtopic=characters&name='.urlencode($query['name']).'"> '.$query['name'].'</a> ('.urlencode($query['level']).'). Congratulations!</center></td></tr>
   <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Server motd:</b> '.$query['text'].'</center></td></tr> 
   <table border=0 cellpadding=0 cellspacing=1 width=100%>
     <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Free Houses:</b> '.$housesfree[0].'</center></td>
   <td><center><b>Rented Houses:</b> '.$housesrented[0].'</center></td></tr>      
   <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Accounts</b> in database: '.$accounts[0].'</center></td>
   <td><center><b>Players</b> in database: '.$players[0].'</center></td></tr>
   <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Banned</b> accounts: '.$banned[0].'</center></td>
   <td><center><b>Guilds</b> in databese: '.$guilds[0].'</center></td></tr>

</table></td></tr></table>';

///Don't delete this! Please respect my work! I am counting on reputation.
$main_content .= '<div align="right"><small><b>Author of script: <a href="http://otland.net/members/aleh/">Aleh</a></b></small></div><br />';
///Don't delete this! Please respect my work! I am counting on reputation.  

 

 

Pronto.

CrEdItOs.

 

 

Aleh

 

 

2. Best Guild.

 

 

Faça Um Novo Arquivo com o nome frags.php em: C:\xampp\htdocs

 

Cole Isso Dentro:

 

<?php
$main_content .= '<div style="text-align: center; font-weight: bold;">Top 30 frags on ' . $config['server']['serverName'] . '</div>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
       <tr bgcolor="' . $config['site']['vdarkborder'] . '">
               <td class="white" style="text-align: center; font-weight: bold;">Name</td>
               <td class="white" style="text-align: center; font-weight: bold;">Frags</td>
       </tr>';

$i = 0;
foreach($SQL->query('SELECT `p`.`name` AS `name`, COUNT(`p`.`name`) as `frags`
       FROM `killers` k
       LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
       LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id`
WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1
       GROUP BY `name`
       ORDER BY `frags` DESC, `name` ASC
       LIMIT 0,30;') as $player)
{
       $i++;
       $main_content .= '<tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']) . '">
               <td><a href="?subtopic=characters&name=' . urlencode($player['name']) . '">' . $player['name'] . '</a></td>
               <td style="text-align: center;">' . $player['frags'] . '</td>
       </tr>';
}

$main_content .= '</table>';
?>

 

agora va em: latestnews

 

e adicione isso:

 

$main_content .= '<div class="NewsHeadline">
       <div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/news/newsheadline_background.gif)">
               <table border="0">
                       <tr>
                               <td style="text-align: center; font-weight: bold;">
                                       <font color="white">Most powerfull guilds</font>
                               </td>
                       </tr>
               </table>
       </div>
</div>
<table border="0" cellspacing="3" cellpadding="4" width="100%">
       <tr>';

foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`,
       `g`.`logo_gfx_name` AS `logo`, COUNT(`g`.`name`) as `frags`
FROM `killers` k
       LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
       LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id`
       LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id`
       LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id`
WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1
       GROUP BY `name`
       ORDER BY `frags` DESC, `name` ASC
       LIMIT 0, 4;') as $guild)
       $main_content .= '              <td style="width: 25%; text-align: center;">
                       <a href="?subtopic=guilds&action=show&guild=' . $guild['id'] . '"><img src="guilds/' . ((!empty($guild['logo']) && file_exists('guilds/' . $guild['logo'])) ? $guild['logo'] : 'default_logo.gif') . '" width="64" height="64" border="0"/><br />' . $guild['name'] . '</a><br />' . $guild['frags'] . ' kills
               </td>';

$main_content .= '      </tr>
</table>';

 

 

Ta ae.

 

 

Bom Uso.

Editado por 1tyi
Link para o comentário
Compartilhar em outros sites

Tutorial por mim aprovado :button_ok:

Um script "simples" mas ao mesmo tempo bem legal pra encrementar o php.

Concerteza vai ajudar bastante gente que tava procurando isso.

Link para o comentário
Compartilhar em outros sites

Até adicionei essas estatísticas no meu site! ;D

 

Obrigado por trazer o conteúdo ao XTibia.com!

Tutorial movido e aprovado, abraços...

Link para o comentário
Compartilhar em outros sites

  • 1 month later...
  • 5 months later...
  • 4 months later...
  • 2 months later...

OLA CARA BOM DIA NAO SEI SE TOU POSTANDO CERTO MAIS ASSIM TERIA COMO VC MIM FALAR SE TEM COMO COLOCAR DOIS SITES NO XAMPP TIPO SERVER UM E SERVER 2 UM DE TIBIA E UM DE POKE COM SITES DIFERENTE CASO TENHA DAR UM HELP AE TA VLW

DESDE JA AGRADEÇO

Link para o comentário
Compartilhar em outros sites

  • 3 weeks later...

Ola cara, tipow sera q tem como me ajudar eu fiz tudo certinho do jeito ue voce falou, aprece lah nos ite a barra most power full guild, mas nao atualiza, tipow os player com guilds se matam no ot e nao parece nada lah. se me ajudar dou rep +

 

PORRA, ALGUEM ME AJUDA, SERA QUE NINGUEM SABE?

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...