Changeset 556 for trunk/pages/gmlog.php


Ignore:
Timestamp:
Mar 29, 2009, 6:45:56 PM (16 years ago)
Author:
george
Message:
  • Opraveno: Formátování stránek a validace XHTML.
  • Opraveno: Opakované připojování k databází při zobraznení gmlogu. Chybně umístěný obrázek.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pages/gmlog.php

    r551 r556  
    11<?php
    2 $gmlog = "/a/mangos1/logs/GM_Commands.log"; //CESTA K GM LOGU
    3 $config = "../gh_system/conn.php"; //CESTA KE CONN.PHP
     2
     3$gmlog = $Config['Mangos']['GMCommandsLog'];
    44$pocet_radku = 50; //KOLIK RADKU Z LOGU SE BUDE ZOBRAZOVAT
    55
    6 echo"<table align=center bordercolor='black' border=2><tr><td align=center><strong>Cas</strong><td align=center><strong>Příkaz</strong><td align=center><strong>GM</strong><td align=center><strong>Vybrán</strong></tr>";
     6echo('<img src="imgs/gm.jpg" alt="gm" /><br />');
     7echo('<table class="gmlog"><tr><th>Čas</th><th>Příkaz</th><th>GM</th><th>Vybrán</th></tr>');
    78
    8 
    9 
    10 
    11 echo('<img src="imgs/gm.jpg" alt="gm">');
    12 include($config);
    139$data = file($gmlog);
    1410$radku = count($data);
    1511$i = 0;
    16 echo "<br />";
    1712
    18 while($i < $pocet_radku){
    19 $radek = $radku-1;
    20 $pole=explode(" ",$data[$radek]);
     13$db->select_db($Config['Mangos']['DatabaseCharacters']);
    2114
    22 if($pole[3]=="announce"):
    23 $prikaz = "announce ...";
    24 else:
    25 $prikaz=explode("[","$pole[3] $pole[4] $pole[5] $pole[6] $pole[7] $pole[8] $pole[9]");
    26 $prikaz = $prikaz[0];
    27 endif;
     15while($i < $pocet_radku)
     16{
     17  $radek = $radku - 1;
     18  $pole = explode(' ', $data[$radek]);
    2819
    29 $prikaz_pole=explode("[","$pole[3] $pole[4] $pole[5] $pole[6] $pole[7] $pole[8] $pole[9]");
    30 $hrac_pole=explode("Player:",$data[$radek]);
    31 $hrac=explode(" ",$hrac_pole[1]);
    32 $vybran_pole=explode("Selected:",$data[$radek]);
    33 $vybran=explode(" ",$vybran_pole[1]);
     20  if($pole[3] == 'announce') $prikaz = 'announce ...';
     21  else
     22  {
     23    $prikaz = explode('[', $pole[3].' '.$pole[4].' '.$pole[5].' '.$pole[6].' '.$pole[7].' '.$pole[8].' '.$pole[9]);
     24    $prikaz = $prikaz[0];
     25  }
    3426
    35 if($vybran[1]=="player"):
    36 $guid_pole=explode("GUID:",$vybran_pole[1]);
    37 $guid=explode(")]",$guid_pole[1]);
     27  $prikaz_pole = explode('[', $pole[3].' '.$pole[4].' '.$pole[5].' '.$pole[6].' '.$pole[7].' '.$pole[8].' '.$pole[9]);
     28  $hrac_pole = explode('Player:', $data[$radek]);
     29  $hrac = explode(' ', $hrac_pole[1]);
     30  $vybran_pole = explode('Selected:', $data[$radek]);
     31  $vybran = explode(' ', $vybran_pole[1]);
    3832
    39 mysql_connect($SQL_Server, $SQL_Uzivatel, $SQL_Heslo);
    40   mysql_select_db($Databaze_characters);
    41   mysql_query("SET NAMES 'utf8'");
    42    $pocet = mysql_num_rows(mysql_query("SELECT guid FROM characters where guid=$guid[0]"));
    43    if($pocet!=0):
    44   $query = mysql_query("SELECT * FROM characters where guid=$guid[0]");
    45            while ($radek = mysql_fetch_array($query) ) {
    46            $vybran_radek = $radek['name'];
    47            $vybran = "hráč $vybran_radek";
    48            }
    49 else:
    50 $vybran = "<i>neznámý hrác</i>";
    51 endif;
    52 else:
    53 $vybran = $vybran[1];
    54 endif;
     33  if($vybran[1] == 'player')
     34  {
     35    $guid_pole = explode('GUID:', $vybran_pole[1]);
     36    $guid = explode(')]', $guid_pole[1]);   
     37   
     38    $DbResult = $db->query('SELECT name FROM characters WHERE guid='.$guid[0]);
     39    if($DbResult->num_rows > 0)
     40    {
     41      $radek = $DbResult->fetch_assoc();
     42      $vybran_radek = $radek['name'];
     43      $vybran = 'hráč '.$vybran_radek;
     44    } else $vybran = '<i>neznámý hráč</i>';
     45  } else $vybran = $vybran[1];
    5546
    56 echo"<tr><td align=center>$pole[0] $pole[1]<td align=center>$prikaz<td align=center>$hrac[1]<td align=center>$vybran</tr>";
    57 $i = $i+1;
    58 $radku = $radku-1;
     47  echo('<tr><td>'.$pole[0].' '.$pole[1].'</td><td>'.$prikaz.'</td><td>'.$hrac[1].'</td><td>'.$vybran.'</td></tr>');
     48  $i = $i + 1;
     49  $radku = $radku - 1;
    5950}
    60 echo"</table>";
     51echo('</table>');
    6152
    6253?>
Note: See TracChangeset for help on using the changeset viewer.