Changeset 577 for trunk/pages/online.php
- Timestamp:
- Apr 29, 2009, 9:04:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/pages/online.php
r567 r577 1 1 <?php 2 2 3 // razeni 4 $order_by = (isset($_GET["order"])) ? $db->real_escape_string($_GET["order"]) : "name"; 5 $dir = (isset($_GET["dir"])) ? $db->real_escape_string($_GET["dir"]) : "down"; 6 $order_dir = ($dir == "up") ? "ASC" : "DESC"; 7 $dir = ($dir == "down") ? "up" : "down"; 8 $dir_img = ($dir == "down") ? "<img src=\"imgs/inc/up.gif\">" : "<img src=\"imgs/inc/down.gif\">"; 3 $order_by = (isset($_GET['order'])) ? $db->real_escape_string($_GET['order']) : 'name'; 4 $dir = (isset($_GET['dir'])) ? $db->real_escape_string($_GET['dir']) : 'down'; 5 $order_dir = ($dir == 'up') ? 'ASC' :'DESC'; 6 $dir = ($dir == 'down') ? 'up' : 'down'; 7 $dir_img = ($dir == 'down') ? '<img src="imgs/inc/up.gif" alt="vzestupně" />' : '<img src="imgs/inc/down.gif" alt="sestupně"/>'; 9 8 10 function MakeLink ($show,$sort)9 function MakeLink($show, $sort) 11 10 { 12 global $dir 13 if (isset($_GET["order"]) AND $_GET["order"] == $sort)11 global $dir, $dir_img; 12 if(isset($_GET['order']) and $_GET['order'] == $sort) 14 13 { 15 $arrow = $dir_img ."";14 $arrow = $dir_img; 16 15 } 17 16 else 18 17 { 19 $arrow = "";18 $arrow = ''; 20 19 } 21 return $arrow."<a href=\"?page=online&order=".$sort."&dir=".$dir."\">".$show."</a>";22 } 23 echo " 24 Ve hře se právě nachází ".$server -> MangosOnline()." hráčů.25 <center>26 <table border= \"1\" width=\"540\">20 return($arrow.'<a href="?page=online&order='.$sort.'&dir='.$dir.'">'.$show.'</a>'); 21 } 22 23 echo('Ve hře se právě nachází '.$server->MangosOnline().' hráčů.'. 24 '<center> 25 <table border="1" width="540"> 27 26 <tr> 28 <th align= \"center\">Frakce</th>29 <th align= \"center\">".MakeLink("Nick","name")."</th>30 <th align= \"center\">".MakeLink("Rasa","race")."</th>31 <th align= \"center\">".MakeLink("Class","class")."</th>32 <th align= \"center\">".MakeLink("Lvl","level")."</th>33 <th align= \"center\">".MakeLink("Mapa","map")."</th>34 <th align= \"center\">".MakeLink("Honory","highest_rank")."<br />".MakeLink("Aréna body","arena_points")."</th>35 </tr>36 "; 37 $db -> select_db($db_characters);38 $sql = $db -> query("SELECT guid,name,race,class,zone,map, 39 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1648+1), ' ', -1) AS UNSIGNED) AS highest_rank,40 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 53+1), ' ', -1) AS UNSIGNED) AS level,41 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1649+1), ' ', -1) AS UNSIGNED) AS arena_points,42 mid(lpad( hex( CAST(substring_index(substring_index(data,' ',36+1),' ',-1) as unsigned) ),8,'0'),4,1) AS gender43 FROM `characters` WHERE `online`= 1 ORDER BY `".$order_by."` $order_dir;");44 while($row = $sql -> fetch_array())27 <th align="center">Frakce</th> 28 <th align="center">'.MakeLink('Nick', 'name').'</th> 29 <th align="center">'.MakeLink('Rasa', 'race').'</th> 30 <th align="center">'.MakeLink('Class', 'class').'</th> 31 <th align="center">'.MakeLink('Lvl', 'level').'</th> 32 <th align="center">'.MakeLink('Mapa', 'map').'</th> 33 <th align="center">'.MakeLink('Honory', 'highest_rank').'<br />'. 34 MakeLink('Aréna body', 'arena_points').'</th></tr>'); 35 36 $db->select_db($Config['Mangos']['DatabaseCharacters']); 37 $sql = $db->query('SELECT guid, name, race, class, zone, map, '. 38 'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['HonorPoints'].'+1), " ", -1) AS UNSIGNED) AS highest_rank, '. 39 'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['Level'].' + 1), " ", -1) AS UNSIGNED) AS level, '. 40 'CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, " ", '.$Config['Mangos']['CharacterDataOffset']['ArenaPoints'].' + 1), " ", -1) AS UNSIGNED) AS arena_points, '. 41 'mid(lpad( hex( CAST(substring_index(substring_index(data, " ", '.$Config['Mangos']['CharacterDataOffset']['Gender'].' + 1), " ", -1) as unsigned) ), 8, 0), 4, 1) AS gender '. 42 'FROM `characters` WHERE `online`= 1 ORDER BY `'.$order_by.'` '.$order_dir); 43 while($row = $sql->fetch_assoc()) 45 44 { 46 $aliance = array (1, 3, 4, 7, 11); 47 $frakce = (in_array($row["race"],$aliance))?"<img src=\"imgs/inc/a.gif\">":"<img src=\"imgs/inc/h.gif\">"; 48 $gender = ($row["gender"] == 0)?"m":"f"; 49 echo " 50 <tr> 51 <td align=\"center\">".$frakce."</td> 52 <td align=\"center\">".$row["name"]."</td> 53 <td align=\"center\"><img src=\"imgs/icons/".$player -> GetPlayerRace($row["race"])."-".$gender.".gif\"></td> 54 <td align=\"center\"><img src=\"imgs/icons/".$player -> GetPlayerClass($row["class"]).".gif\"></td> 55 <td align=\"center\">".$row["level"]."</td> 56 <td align=\"center\">".$server -> MapName($row["map"])."<br />(".$server -> ZoneName($row["zone"]).")</td> 57 <td align=\"center\">".$row["highest_rank"]."<br />".$row["arena_points"]."</td> 58 </tr> 59 "; 60 61 62 63 45 $aliance = array(1, 3, 4, 7, 11); 46 $frakce = (in_array($row['race'], $aliance)) ? '<img src="imgs/inc/a.gif" alt="aliance"/>' : '<img src="imgs/inc/h.gif" alt="horda" />'; 47 $gender = ($row['gender'] == 0) ? 'm' : 'f'; 48 echo('<tr> 49 <td align="center">'.$frakce.'</td> 50 <td align="center">'.$row['name'].'</td> 51 <td align="center"><img src="imgs/icons/'.$player->GetPlayerRace($row['race']).'-'.$gender.'.gif" alt="rasa" /></td> 52 <td align="center"><img src="imgs/icons/'.$player->GetPlayerClass($row['class']).'.gif" alt="třída" /></td> 53 <td align="center">'.$row['level'].'</td> 54 <td align="center">'.$server->MapName($row['map']).'<br />('.$server->ZoneName($row['zone']).')</td> 55 <td align="center">'.$row['highest_rank'].'<br />'.$row['arena_points'].'</td></tr>'); 64 56 } 65 echo "</table></center>"; 66 67 68 57 echo('</table></center>'); 69 58 70 59 ?>
Note:
See TracChangeset
for help on using the changeset viewer.