source: trunk/pages/spolek.php

Last change on this file was 705, checked in by george, 15 years ago
  • Opraveno: Nově načítat informace o hráčích přímo ze samostatných sloupců tabulky namísto sloupce zrušeného data.
File size: 4.9 KB
Line 
1<?php
2
3function count_days($a, $b)
4{
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);
10}
11
12$Realm = new Realm($System, $_COOKIE['RealmIndex']);
13$db2 = $Realm->CharactersDatabase;
14$id = (isset($_GET['id'])) ? $_GET['id'] : 0;
15if($id != 0)
16{
17 $guild_id = $id;
18 $DbResult = $db2->query('SELECT `guildid`, `name`, FROM_UNIXTIME(`createdate`) AS `createdate` FROM `guild` WHERE `guildid` = '.$guild_id.' LIMIT 1');
19 $guild_data = $DbResult->fetch_assoc();
20 $members = $db2->query('SELECT `guild_member`.`guid`, `guild_member`.`rank` AS `mrank`, `characters`.`name`, `characters`.`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` AS `k1` ON `k1`.`guid`=`characters`.`guid` WHERE `guild_member`.`guildid` = '.$guild_id.' AND `guild_member`.`guid`=`characters`.`guid` ORDER BY `mrank`');
21 $total_members = $members->num_rows;
22 $DbResult = $db2->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');
23 $online_mem = $DbResult->fetch_assoc();
24
25 // guild info
26 $date_arr = explode(' ', $guild_data['createdate']);
27 $date = explode('-', $date_arr[0]);
28 $time_stp = explode(':', $date_arr[1]);
29 $time = mktime($time_stp[0], $time_stp[1], $time_stp[2], $date[1], $date[2], $date[0]);
30 $human_date = date('d.m.Y H:i:s', $time);
31 //echo('<a href="'.$html->Link('/spolky/').'">&lt;- Zpět na výpis</a><br />');
32 echo('<table class="BaseTable">
33 <tr>
34 <td colspan="2" style="font-size: x-large;">Spolek '.$guild_data['name'].'</td>
35 </tr>
36 <tr>
37 <th>Datum založení: </th>
38 <td>'.$human_date.'</td>
39 </tr>
40 <tr>
41 <th>Celkem členů: </th>
42 <td>'.$total_members.' (Online : '.$online_mem['online_mem'].')</td>
43 </tr>');
44 $DbResult = $db->query('SELECT `Homepage` FROM `GuildInfo` WHERE `Guild`='.$guild_id.' AND `Realm`='.$Realm->Id);
45 $DbRow = $DbResult->fetch_assoc();
46 $Homepage = $DbRow['Homepage'];
47 if($Homepage != '')
48 {
49 echo(' <tr>
50 <th>Webové stránky: </th>
51 <td><a href="http://'.$Homepage.'/">'.$Homepage.'</a></td>
52 </tr>
53');
54 }
55 echo('</table><br />');
56
57
58 // members info
59 echo('<table class="BaseTable">
60 <tr>
61 <th align="center">Jméno</th>
62 <th align="center">Rasa</th>
63 <th align="center">Třída</th>
64 <th align="center">Úroveň</th>
65 <th align="center">Hodnost</th>
66 <th align="center">Poslední přihlášení (dny)</th>
67 <th align="center">Online</th>
68 </tr>');
69 while($member = $members->fetch_row())
70 {
71 $query = $db2->query('SELECT `race`,`class`,`online`, `account`, `logout_time`, `level`, `gender` FROM `characters` WHERE `guid` = '.$member[0].' LIMIT 1;');
72 $online = $query->fetch_assoc();
73 $accid = $online['account'];
74
75 $LogoutTime = count_days($online['logout_time'], time());
76 $LogoutTimeColorList = array(0 => '#0000CC', 5 => '#FFFF00', 15 => '#FF8000', 30 => '#FF0000', 60 => '#FF00FF', 90 => '#8000FF');
77 $LogoutTimeColor = '#009900';
78 foreach($LogoutTimeColorList as $Time => $Color)
79 {
80 if($LogoutTime > $Time) $LogoutTimeColor = $Color;
81 }
82
83 $Level = $online['level'];
84 $LevelColorList = array(9 => '#858585', 19 => '#339900', 29 => '#3300CC', 39 => '#5552FF', 49 => '#FF8000', 59 => '#FF0000', 69 => '#FF00CC', 70 => '#FFF000');
85 $LevelColor = '#FFFFFF';
86 foreach($LevelColorList as $Index => $Color)
87 {
88 if($Level > $Index) $LevelColor = $Color;
89 }
90
91 if($online['gender'] == 0) $gender = 0;
92 else $gender = 1;
93 echo('<tr>'.
94 '<td align="center">'.$member[2].'</td>'.
95 '<td align="center"><img src="'.$html->Link('/imgs/icons/'.$online['race'].'-'.$gender.'.gif').'" alt="pohlaví" /></td>'.
96 '<td align="center"><img src="'.$html->Link('/imgs/icons/'.$online['class'].'.gif').'" alt="třída" /></td>'.
97 '<td align="center" style="color: '.$LevelColor.'">'.$Level.'</td>'.
98 '<td align="center">'.$member[4].' ('.$member[1].')</td>'.
99 '<td align="center" style="color: '.$LogoutTimeColor.'">'.$LogoutTime.'</td>'.
100 '<td align="center">'.(($online['online']) ? '<img src="'.$html->Link('/imgs/inc/on.gif').'" alt="online" />' : '<img src="'.$html->Link('/imgs/inc/off.gif').'" alt="offline" />').'</td>'.
101 '</tr>');
102 }
103 echo('</table>');
104} else echo('<meta http-equiv="refresh" content="0;url='.$html->Link('/spolky/').'">');
105
106?>
Note: See TracBrowser for help on using the repository browser.