Changeset 577 for trunk/pages/guilda.php


Ignore:
Timestamp:
Apr 29, 2009, 9:04:21 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Vyčítání položek ze sloupce Data u postav je nyní nastavování přes konfigurační soubor. Nutno synchronizovat např. dle minimanageru souboru scripts/defines.php při každé změně verze herního klienta.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pages/guilda.php

    r547 r577  
    11<?php
    2 $id = (isset($_GET["id"])) ? $db->real_escape_string($_GET["id"]) : 0;
    3 function count_days( $a, $b )
     2
     3function count_days($a, $b)
    44{
    5         $gd_a = getdate( $a );
    6         $gd_b = getdate( $b );
    7         $a_new = mktime( 12, 0, 0, $gd_a['mon'], $gd_a['mday'], $gd_a['year'] );
    8         $b_new = mktime( 12, 0, 0, $gd_b['mon'], $gd_b['mday'], $gd_b['year'] );
    9         return round( abs( $a_new - $b_new ) / 86400 );
     5        $gd_a = getdate($a);
     6        $gd_b = getdate($b);
     7        $a_new = mktime(12, 0, 0, $gd_a['mon'], $gd_a['mday'], $gd_a['year']);
     8        $b_new = mktime(12, 0, 0, $gd_b['mon'], $gd_b['mday'], $gd_b['year']);
     9        return round(abs($a_new - $b_new) / 86400);
    1010}
    11 if ($id != 0)
     11
     12$db->select_db($Config['Mangos']['DatabaseCharacters']);
     13$id = (isset($_GET['id'])) ? $_GET['id'] : 0;
     14if($id != 0)
    1215{
    13   $db -> select_db($db_characters);
    1416  $guild_id = $id;
    1517  $guild_data = $db -> query("SELECT `guildid`, `name`, `createdate` FROM `guild` WHERE `guildid` = ".$guild_id." LIMIT 1;") -> fetch_array();
    16   $members = $db -> query("SELECT guild_member.guid, guild_member.rank AS mrank, `characters`.name, SUBSTRING_INDEX(SUBSTRING_INDEX(`characters`.`data`, ' ', 35), ' ', -1) AS level, (SELECT rname FROM guild_rank WHERE guildid =".$guild_id." AND rid = mrank+1) AS rname, guild_member.pnote, guild_member.offnote FROM guild_member,`characters` LEFT JOIN guild_member k1 ON k1.`guid`=`characters`.`guid` WHERE guild_member.guildid = ".$guild_id." AND guild_member.guid=`characters`.guid ORDER BY mrank");
     18  $members = $db -> query("SELECT guild_member.guid, guild_member.rank AS mrank, `characters`.name, SUBSTRING_INDEX(SUBSTRING_INDEX(`characters`.`data`, ' ', ".$Config['Mangos']['CharacterDataOffset']['Level']." + 1), ' ', -1) AS level, (SELECT rname FROM guild_rank WHERE guildid =".$guild_id." AND rid = mrank+1) AS rname, guild_member.pnote, guild_member.offnote FROM guild_member,`characters` LEFT JOIN guild_member k1 ON k1.`guid`=`characters`.`guid` WHERE guild_member.guildid = ".$guild_id." AND guild_member.guid=`characters`.guid ORDER BY mrank");
    1719  $total_members = $members -> num_rows;
    1820  $members_data = $members -> fetch_array();
    1921  $online_mem = $db -> query("SELECT count(*) AS online_mem  FROM `guild_member`, `characters`, `guild` WHERE guild.guildid = ".$guild_id." AND guild_member.guildid = guild.guildid AND guild_member.guid = characters.guid AND characters.online = 1;") -> fetch_array();;
    2022  // guild info
    21   $date_arr = explode(" ",$guild_data["createdate"]);
    22   $date = explode("-",$date_arr[0]);
    23   $time_stp = explode(":",$date_arr[1]);
    24   $time = mktime($time_stp[0],$time_stp[1],$time_stp[2],$date[1],$date[2],$date[0]);
    25   $human_date = date ("d.m.Y H:i:s",$time);
    26   echo "<a href=\"?page=guildy\">&lt;- Zpět na výpis</a><br />";
    27   echo "
    28   <table border=\"1\">
     23  $date_arr = explode(' ', $guild_data['createdate']);
     24  $date = explode('-', $date_arr[0]);
     25  $time_stp = explode(':', $date_arr[1]);
     26  $time = mktime($time_stp[0], $time_stp[1], $time_stp[2], $date[1], $date[2], $date[0]);
     27  $human_date = date('d.m.Y H:i:s', $time);
     28  echo('<a href="?page=guildy">&lt;- Zpět na výpis</a><br />');
     29  echo('<table border="1">
    2930    <tr>
    30       <td colspan=\"2\"><font size=\"5\">Guilda : ".$guild_data["name"]."</font></td>
     31      <td colspan="2"><font size="5">Guilda : '.$guild_data['name'].'</font></td>
    3132    </tr>
    3233    <tr>
    3334      <th>Datum založení: </th>
    34       <td>".$human_date."</td>
     35      <td>'.$human_date.'</td>
    3536    </tr>
    3637    <tr>
    3738      <th>Celkem členů: </th>
    38       <td>".$total_members." (Online : ".$online_mem["online_mem"].")</td>
     39      <td>'.$total_members.' (Online : '.$online_mem['online_mem'].')</td>
    3940    </tr>
    40   </table>
    41   ";
     41  </table>');
     42 
    4243  // members info
    43   echo "
    44   <table border=\"1\">
     44  echo('<table border="1">
    4545    <tr>
    46       <th align=\"center\">Jméno</th>
    47       <th align=\"center\">Rasa</th>
    48       <th align=\"center\">Class</th>
    49       <th align=\"center\">Úroveň</th>
    50       <th align=\"center\">Rank</th>
    51       <th align=\"center\">Poslední přihlášení (Dny)</th>
    52       <th align=\"center\">Online</th>     
    53     </tr>
    54   ";
    55   while ($member = $members -> fetch_row())
    56   {
    57    
    58     $query = $db -> query("SELECT `race`,`class`,`online`, `account`, `logout_time`, SUBSTRING_INDEX(SUBSTRING_INDEX(`characters`.`data`, ' ', 53+1), ' ', -1) AS level, mid(lpad( hex( CAST(substring_index(substring_index(data,' ',".(36+1)."),' ',-1) as unsigned) ),8,'0'),4,1) as gender FROM `characters` WHERE `guid` = '".$member[0]."' LIMIT 1;");
     46      <th align="center">Jméno</th>
     47      <th align="center">Rasa</th>
     48      <th align="center">Class</th>
     49      <th align="center">Úroveň</th>
     50      <th align="center">Rank</th>
     51      <th align="center">Poslední přihlášení (Dny)</th>
     52      <th align="center">Online</th>     
     53    </tr>');
     54  while($member = $members->fetch_row())
     55  {   
     56    $query = $db->query("SELECT `race`,`class`,`online`, `account`, `logout_time`, SUBSTRING_INDEX(SUBSTRING_INDEX(`characters`.`data`, ' ', ".$Config['Mangos']['CharacterDataOffset']['Level']."+1), ' ', -1) AS level, mid(lpad( hex( CAST(substring_index(substring_index(data,' ',".($Config['Mangos']['CharacterDataOffset']['Gender'] + 1)."),' ',-1) as unsigned) ),8,'0'),4,1) as gender FROM `characters` WHERE `guid` = '".$member[0]."' LIMIT 1;");
    5957    $online = $query -> fetch_array();
    6058          $accid = $online["account"];
     
    145143    ";
    146144  }
    147 echo "</table>";
    148 
    149 
    150 
    151 
    152 
    153 
    154 }
    155 else
    156 {echo "<meta http-equiv=\"refresh\" content=\"0;url=?page=guildy\">";}
     145  echo('</table>');
     146} else echo('<meta http-equiv="refresh" content="0;url=?page=guildy">');
    157147 
    158  
    159  
    160  
    161 
    162 
    163 
    164 
    165148?>
Note: See TracChangeset for help on using the changeset viewer.