Дополнение к инструкции.)
[cswowd.git] / map / find.php
blob84c2ae21eada2cca80c7be3fbb8398222de11dce
1 <?php
2 include("../conf.php");
3 include ("zone_tables.php");
4 mysql_connect($config['hostname'],$config['username'],$config['password']) or die("Unable to connect to the database. Maybe the server is down.");
5 mysql_select_db($config['dbName']) or die(mysql_error());
7 ?>
8 <style type="text/css">
9 <!--
10 body {
11 background-color: #808080;
13 body,td,th {
14 color: #FFFFFF;
15 font-size: 12px;
17 a:link {
18 color: #FFFFFF;
20 a:visited {
21 color: #FFFFFF;
23 a:hover {
24 color: #FFFFFF;
26 a:active {
27 color: #FF0000;
29 -->
30 </style>
31 <?php
32 $name = @$_REQUEST['name'];
33 $name = mysql_real_escape_string($name);
34 $entry = intval(@$_REQUEST['entry']);
36 if ($name == "" and $entry=="") { die(); }
37 $background = "map.jpg";
39 echo "<table width=\"100%\" border=\"0\">";
40 echo "<tr>Поиск существ</tr>";
41 if ($name !="") $res = mysql_query("SELECT * FROM `creature_template` WHERE name like '%$name%' ORDER BY `name`") or die(mysql_error());
42 else if ($entry!="") $res = mysql_query("SELECT * FROM `creature_template` WHERE entry = '$entry' ORDER BY `name`") or die(mysql_error());
44 while ($row=mysql_fetch_array($res))
46 $res2 = mysql_query("SELECT * FROM `creature` WHERE id = '$row[entry]'") or die(mysql_error());
47 $count= mysql_num_rows($res2);
48 $row2=mysql_fetch_array($res2);
50 if ($row2['map']==0 OR $row2['map']==1 OR $row2['map']==530)
51 $map = get_zone_name($row2['map'],$row2['position_x'],$row2['position_y']);
52 else
53 $map = get_map_name($row2['map']);
54 echo "<tr>";
55 echo "<td><img src=img/human.gif></td>";
56 echo "<td><$row[minlevel]-$row[maxlevel]></td>";
57 if ($count==0) echo "<td>$row[name]</td>";
58 else echo "<td><a href=\"gps2.php?id=$row[entry]\" target=\"zzz\">$row[name]";
59 if ($map!="") echo "<br><font color=#F0F00F size=-2>&lt;$map&gt;</font>";
60 echo "</a></td>";
61 echo "<td>$count</td>";
62 echo "</tr>";
64 echo "</table>";
66 echo "<table width=\"100%\" border=\"0\">";
67 echo "<tr>Поиск обьектов</tr>";
68 if ($name!="")
69 $res = mysql_query("SELECT * FROM `gameobject_template` WHERE name like '%$name%' ORDER BY `name`") or die(mysql_error());
70 else if ($entry!="")
71 $res = mysql_query("SELECT * FROM `gameobject_template` WHERE entry = '$entry' ORDER BY `name`") or die(mysql_error());
72 while ($row=mysql_fetch_array($res))
74 $row['name']=str_replace("'","",$row['name']);
75 $res2 = mysql_query("SELECT * FROM `gameobject` WHERE id = '$row[entry]'") or die(mysql_error());
76 $count= mysql_num_rows($res2);
77 echo "<tr>";
78 echo "<td><img src=img/iron.gif></td>";
79 if ($count==0) echo "<td>$row[name]</td>";
80 else echo "<td><a href=\"gps2.php?id=$row[entry]&where=gameobject\" target=\"zzz\">$row[name]</a></td>";
81 echo "<td>($count)</td>";
82 echo "</tr>";
84 echo "</table>";