Changeset 104 for guildy.php
- Timestamp:
- Oct 7, 2007, 1:15:56 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guildy.php
r28 r104 9 9 $RanksCZ = array('Pán cechu', 'Veterán', 'Vrchní správce', 'Pomocný dùstojník', 'PR dùstojník', 'Dùstojník', 'Proslavený èlen', 'Èlen', 'Zelenáè', 'Nováèek'); 10 10 11 $order_by = (isset($_GET['order_by'])) ? $Database->real_escape_string($_GET['order_by']) : "name"; 12 13 $dir = (isset($_GET['dir'])) ? $Database->real_escape_string($_GET['dir']) : 1; 14 $order_dir = ($dir) ? "ASC" : "DESC"; 15 $dir = ($dir) ? 0 : 1; 16 17 function HeaderText($Text, $Column) 18 { 19 global $dir, $order_by, $GuildId; 20 echo('<th><a href="?order_by='.$Column.'&dir='.$dir.'">'.($order_by==$Column ? '<img src="images/online_player/arr_'.($dir ? 'up' : 'dw').'.gif" /> ' : '').$Text.'</a></th>'); 21 } 22 23 function HeaderTextGuild($Text, $Column) 24 { 25 global $dir, $order_by, $GuildId; 26 echo('<th><a href="?guild='.$GuildId.'&order_by='.$Column.'&dir='.$dir.'">'.($order_by==$Column ? '<img src="images/online_player/arr_'.($dir ? 'up' : 'dw').'.gif" /> ' : '').$Text.'</a></th>'); 27 } 28 11 29 $Database->select_db('mangos'); 12 30 if(!array_key_exists('guild', $_GET)) 13 31 { 14 32 echo('<h3>Seznam guild:</h3><div align="center">'); 15 echo('<table class="TableGuilda" border="1" cellpadding="3" cellspacing="0"><tr><th>Název</th><th>Poèet èlenù</th><th>Souèet levelù</th><th>Souèet bodù cti</th><th>Webové stránky</th></tr>'); 33 echo('<table class="TableGuilda" border="1" cellpadding="3" cellspacing="0"><tr>'); 34 HeaderText('Název', 'name'); 35 HeaderText('Poèet èlenù', 'member_count'); 36 HeaderText('Souèet levelù', 'guild_level'); 37 HeaderText('Souèet bodù cti', 'guild_honor'); 38 HeaderText('Webové stránky', 'name'); 39 echo('</tr>'); 16 40 // DB_Query(' COUNT(guild_member.guildid) as member_count FROM guild JOIN guild_member ON guild_member.guildid = guild.guildid GROUP BY guild.name ORDER BY member_count DESC'); 17 $Result = $Database->query('SELECT `guild`.name, guild.guildid, COUNT(`guild_member`.`guildid`) as member_count, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 35), " ", -1)) as guild_level, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 1421), " ", -1)) as guild_honor FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `character` ON `character`.`guid`= `guild_member`.`guid` GROUP BY guild.name ORDER BY guild.name');41 $Result = $Database->query('SELECT `guild`.name, guild.guildid, COUNT(`guild_member`.`guildid`) as member_count, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 35), " ", -1)) as guild_level, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 1421), " ", -1)) as guild_honor FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `character` ON `character`.`guid`= `guild_member`.`guid` GROUP BY guild.name ORDER BY '.$order_by.' '.$order_dir); 18 42 while($Guild = $Result->fetch_array()) 19 43 { … … 22 46 echo('</table></div>'); 23 47 } else { 24 $ _GET['guild']= addslashes($_GET['guild']);25 $Result = $Database->query('SELECT `guild`.name, guild.guildid, guild.leaderguid, COUNT(`guild_member`.`guildid`) as member_count, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 35), " ", -1)) as guild_level, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 1421), " ", -1)) as guild_honor FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `character` ON `character`.`guid`= `guild_member`.`guid` WHERE guild.guildid='.$ _GET['guild'].' GROUP BY guild.name');48 $GuildId = addslashes($_GET['guild']); 49 $Result = $Database->query('SELECT `guild`.name, guild.guildid, guild.leaderguid, COUNT(`guild_member`.`guildid`) as member_count, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 35), " ", -1)) as guild_level, SUM(SUBSTRING_INDEX(SUBSTRING_INDEX(`character`.`data`, " ", 1421), " ", -1)) as guild_honor FROM `guild` JOIN `guild_member` ON `guild_member`.`guildid` = `guild`.`guildid` JOIN `character` ON `character`.`guid`= `guild_member`.`guid` WHERE guild.guildid='.$GuildId.' GROUP BY guild.name'); 26 50 if($Result->num_rows > 0) 27 51 { … … 34 58 echo('Vedoucí guildy: '.$GuildMaster['name'].'<br>'); 35 59 echo('<table class="TableGuilda" border="1" cellpadding="1" cellspacing="0">'); 36 echo('<tr><th>Jméno</th><th>Level</th><th>Hodnost</th><th>Body cti</th></tr>'); 60 echo('<tr>'); 61 HeaderTextGuild('Jméno', 'name'); 62 HeaderTextGuild('Úroveò', 'level'); 63 HeaderTextGuild('Hodnost', 'rank'); 64 HeaderTextGuild('Body cti', 'honor'); 65 echo('</tr>'); 37 66 //echo('<tr><td colspan="2" Class="TdGuilda">Informace: '.$Guild['public_info'].'</td></tr>'); 38 67 … … 41 70 while($GuildRank = $Result->fetch_array()) $GuildRanks[$GuildRank['rid']] = $GuildRank; 42 71 43 $Result = $Database->query('SELECT guild_member.rank, guild_member.guid, SUBSTRING_INDEX(SUBSTRING_INDEX(character.data," ", 35), " ", -1)*1 as level, SUBSTRING_INDEX(SUBSTRING_INDEX(character.data," ", 1421), " ", -1)*1 as honor, character.name FROM guild_member JOIN `character` ON guild_member.guid = character.guid AND guild_member.guildid='.$Guild['guildid'].' ORDER BY character.name');72 $Result = $Database->query('SELECT guild_member.rank, guild_member.guid, SUBSTRING_INDEX(SUBSTRING_INDEX(character.data," ", 35), " ", -1)*1 as level, SUBSTRING_INDEX(SUBSTRING_INDEX(character.data," ", 1421), " ", -1)*1 as honor, character.name FROM guild_member JOIN `character` ON guild_member.guid = character.guid AND guild_member.guildid='.$Guild['guildid'].' ORDER BY '.$order_by.' '.$order_dir); 44 73 while($Member = $Result->fetch_array()) 45 74 {
Note:
See TracChangeset
for help on using the changeset viewer.