This repository has been archived by the owner on Nov 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
itemsrch.php
76 lines (62 loc) · 2.51 KB
/
itemsrch.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
67
68
69
70
71
72
73
74
75
76
<?php
// ****************************************************************************
//
// ZZJ Audit Tool v1.0
// Copyright (C) 2010 ZigZagJoe ([email protected])
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// ****************************************************************************
// item search page
?>
<html>
<head>
<title>Item Search</title>
</head>
<body>
<form action="itemsrch.php" method="get">
<input type="text" size=50 name="srch" value="<?php if (isset($_GET['srch'])) echo $_GET['srch']; ?>">
<input type="submit" value="Search">
</form>
<?php
require_once("eve.php");
$Db = new eveDb($sql, $sql_u, $sql_p, $db);
if (isset($_GET['srch'])) {
$srch = $_GET['srch'];
if (strlen($srch) < 3)
die("Enter at least 3 letters!</body></html>");
if (strpos($srch, "group:") !== false) {
$sql = "SELECT typeName, typeID FROM ".DB_PREFIX."invTypes WHERE groupId = ".mysql_real_escape_string(substr($srch,strpos($srch, "group:")+6))." ORDER BY typeName";
} else if (strpos($srch, "race:") !== false) {
$sql = "SELECT typeName, typeID FROM ".DB_PREFIX."invTypes WHERE raceId = ".mysql_real_escape_string(substr($srch,strpos($srch, "race:")+5))." ORDER BY typeName";
} else
$sql = "SELECT typeName, typeID FROM ".DB_PREFIX."invTypes WHERE typeName LIKE '%".mysql_real_escape_string($srch)."%' ORDER BY typeName";
$result = $Db->query($sql);
echo "Results for '".$srch."': ";
if (!$result) {
echo "No items found.<br>";
} else {
echo mysql_num_rows($result). " found ";
echo "<br>\n";
while ($row = mysql_fetch_assoc($result)) {
echo "<a name=\"".$row['typeID']."\" href=\"itemview.php?id=" . $row['typeID'] . "&srch=".$srch."\">".$row['typeName']."</a><br>";
}
mysql_free_result($result);
}
}
$Db->close();
?>
</body>
</html>