Требование: PHP => 5.3, часть 2
[cswowd.git] / module / userpage / user_kabinet.php
blob79048249f15d14f7bd0f82f1eaf9e8214eecfe9c
1 <?php
2 if (@$config == NULL) die ("");
4 include_once("include/player_data.php");
5 include_once("include/functions.php");
6 include_once("include/map_data.php");
7 include_once("include/info_table_generator.php");
9 if (isset($_SESSION['account_id']))
11 echo '
12 <table class="report" cellpadding="6" cellspacing="1" border="0" width="100%" align="center">
13 <tr>
14 <td class="alt2" valign="top" nowrap="nowrap">
15 <div class="smallfont"><a href="#"><strong>Добро пожаловать, '.$_SESSION['username'].'</strong><br></a>
16 <a href="?user">Мой кабинет</a> | <a href="?user=logout">Выход</a>
17 </div>
18 </td>
19 </tr>
20 </table>';
21 $id = $_SESSION['account_id'];
22 $rows = $cDB->select("SELECT * FROM `characters` WHERE `account` = ?d", $id);
24 echo "<table class=report width=500>";
25 echo "<tbody>";
26 if($rows)
28 echo "<tr>";
29 echo "<th>$lang[player_level]</th>";
30 echo "<th width=1%></th>";
31 echo "<th width=100%>$lang[player_name]</th>";
32 echo "<th>$lang[player_race]</th>";
33 echo "<th>$lang[player_class]</th>";
34 echo "<th>$lang[player_zone]</th>";
35 echo "</tr>\n";
36 foreach ($rows as $player)
38 $imgsize=32;
39 $char_data = explode(' ',$player['data']);
40 $powerType =($char_data[UNIT_FIELD_BYTES_0]>>24)&255;
41 $gender =($char_data[UNIT_FIELD_BYTES_0]>>16)&255;
42 $class =($char_data[UNIT_FIELD_BYTES_0]>> 8)&255;
43 $race =($char_data[UNIT_FIELD_BYTES_0]>> 0)&255;
44 $level = $char_data[UNIT_FIELD_LEVEL];
46 $map_name = getMapNameFromPoint($player['map'], $player['position_x'], $player['position_y'], $player['position_z']);
47 $area_name = getAreaNameFromPoint($player['map'], $player['position_x'], $player['position_y'], $player['position_z']);
48 $extra_name = "";
49 if ($area_name)
51 $extra_name = "<br><font size=-2>".$map_name."</font>";
52 $map_name = "&bdquo;".str_replace(' ','&nbsp;', $area_name)."&ldquo;";
54 else
55 $map_name = "&bdquo;".str_replace(' ','&nbsp;',$map_name)."&ldquo;";
57 $map_name = "<a href=\"map/map.php?x=$player[position_x]&y=$player[position_y]&map=$player[map]\">".$map_name."</a>".$extra_name;
58 echo "<tr>";
59 echo "<td align=center>$level</td>";
60 echo "<td class=pfaction><img width=$imgsize src=\"".getFactionImage($race)."\"></td>";
61 echo "<td class=player><A href=?player=$player[guid]>$player[name]</a></td>";
62 echo "<td class=prace><img width=$imgsize src=\"".getRaceImage($race,$gender)."\"></td>";
63 echo "<td class=pclass><img width=$imgsize src=\"".getClassImage($class)."\"></td>";
64 echo "<td class=zone>$map_name</td>";
65 echo "</tr>\n";
68 else
69 echo "<tr><td colSpan=6 align=center>".$lang['user_no_char_present']."</td></tr>";
70 echo "</tbody></table>";