Changeset 577 for trunk/pages/guilda.php
- Timestamp:
- Apr 29, 2009, 9:04:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/pages/guilda.php
r547 r577 1 1 <?php 2 $id = (isset($_GET["id"])) ? $db->real_escape_string($_GET["id"]) : 0; 3 function count_days( $a, $b)2 3 function count_days($a, $b) 4 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);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 10 } 11 if ($id != 0) 11 12 $db->select_db($Config['Mangos']['DatabaseCharacters']); 13 $id = (isset($_GET['id'])) ? $_GET['id'] : 0; 14 if($id != 0) 12 15 { 13 $db -> select_db($db_characters);14 16 $guild_id = $id; 15 17 $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"); 17 19 $total_members = $members -> num_rows; 18 20 $members_data = $members -> fetch_array(); 19 21 $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();; 20 22 // 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\"><- 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"><- Zpět na výpis</a><br />'); 29 echo('<table border="1"> 29 30 <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> 31 32 </tr> 32 33 <tr> 33 34 <th>Datum založení: </th> 34 <td> ".$human_date."</td>35 <td>'.$human_date.'</td> 35 36 </tr> 36 37 <tr> 37 38 <th>Celkem členů: </th> 38 <td> ".$total_members." (Online : ".$online_mem["online_mem"].")</td>39 <td>'.$total_members.' (Online : '.$online_mem['online_mem'].')</td> 39 40 </tr> 40 </table> 41 ";41 </table>'); 42 42 43 // members info 43 echo " 44 <table border=\"1\"> 44 echo('<table border="1"> 45 45 <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;"); 59 57 $online = $query -> fetch_array(); 60 58 $accid = $online["account"]; … … 145 143 "; 146 144 } 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">'); 157 147 158 159 160 161 162 163 164 165 148 ?>
Note:
See TracChangeset
for help on using the changeset viewer.