-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfactions.php
71 lines (60 loc) · 2.29 KB
/
factions.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
<?php
/** If the parameter 'isearch' is set, queries for the factions matching 'iname' and displays them, along with a faction search form.
* If only one and only one faction is found then this faction is displayed.
* If 'isearch' is not set, displays a search faction form.
* If 'iname' is not set then it is equivalent to searching for all factions.
* For compatbility with Wikis and multi-word searches, underscores are treated as jokers in 'iname'.
*/
include('./includes/constantes.php');
include('./includes/config.php');
include($includes_dir.'mysql.php');
include($includes_dir.'functions.php');
$isearch = (isset($_GET['isearch']) ? $_GET['isearch'] : '');
$iname = (isset($_GET[ 'iname']) ? $_GET[ 'iname'] : '');
if($isearch != "")
{
if($iname == "")
{
$name = "";
}
else
{
$name = str_replace('_','%',addslashes($iname));
}
$Query="SELECT $tbfactionlist.id,$tbfactionlist.name
FROM $tbfactionlist
WHERE $tbfactionlist.name like '%".$name."%'
ORDER BY $tbfactionlist.name
LIMIT ".(LimitToUse($MaxFactionsReturned) + 1);
$QueryResult = mysql_query($Query) or message_die('factions.php','MYSQL_QUERY',$Query,mysql_error());
if(mysql_num_rows($QueryResult) == 1)
{
$row = mysql_fetch_array($QueryResult);
header("Location: faction.php?id=".$row["id"]);
exit();
}
}
/** Here the following holds :
* $QueryResult : factions queried for if any query was issued, otherwise it is not defined
* $iname : previously-typed query, or empty by default
* $isearch is set if a query was issued
*/
$Title="Faction Search";
$XhtmlCompliant = TRUE;
include($includes_dir.'headers.php');
print "<center><table border='0' width='0%'><form method='GET' action='".$PHP_SELF."'>\n";
print "<tr>\n";
print "<td nowrap='1'><b>Search : </b></td>\n";
print "<td><input type='text' value=\"$iname\" size='30' name='iname'/></td>\n";
print "</tr>";
print "<tr align='center'>";
print "<td nowrap='1' colspan='2'><input type='submit' value='Search' name='isearch' class='form'/></td>\n";
print "</tr>\n";
print "</form></table></center>\n";
print "\n";
if(isset($QueryResult))
{
PrintQueryResults($QueryResult, $MaxFactionsReturned, "faction.php", "faction", "factions", "id", "name");
}
include($includes_dir."footers.php");
?>