-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameobject_search.php
66 lines (63 loc) · 1.33 KB
/
gameobject_search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
include "db-config";
include "menu.php";
include "gameobject_menu.php";
?>
<script type="text/javascript" src="gameobject_search.js"></script>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form_ins" onsubmit="return search(this)">
<input type="hidden" value="" name="x">
<?php
$x=$_POST['x'];
?>
<table>
<tr>
<td>Entry</td>
<td>Name</td>
</tr>
<tr>
<td><input type="text" name="entry" style="width:125px;"></td>
<td><input type="text" name="name"></td>
<td><input type="submit" value="Search"></td>
</tr>
</table>
<div class="scroll">
<table border="1">
<tr>
<td>Entry</td>
<td>Name</td>
<td>type</td>
<td>faction</td>
</tr>
<tr>
<td>
<?php
$entry=$_POST['entry'];
$name=$_POST['name'];
$where="WHERE 1=1";
if ($entry)
{
$where.=" AND entry=$entry";
}
if ($name)
{
$name=str_replace("'", "\'", $name);
$where.=" AND name LIKE '%$name%'";
}
$query=mysql_query("SELECT * FROM gameobject_template $where");
while ($row=mysql_fetch_array($query) AND $x==1)
{
echo "
<tr><td>{$row['entry']}
</td><td>".htmlspecialchars($row['name'])."
</td><td>".htmlspecialchars($row['type'])."
</td><td>".htmlspecialchars($row['faction'])."
<td><a href=\"gameobject_template.php?entry={$row['entry']}\">Edit</a></td>
</td></tr>
";
}
?>
</td>
</tr>
</table>
</div>
</form>