forked from ThatCasualMatt/OpenParser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewencounters.php
More file actions
99 lines (90 loc) · 6.02 KB
/
Copy pathviewencounters.php
File metadata and controls
99 lines (90 loc) · 6.02 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
//INCLUDE THE CONFIGURATION / CONNECT TO DATABASE
include('config.php');
//GET URL VARIABLES FROM URL AND SET OTHER VARIABLES
if(isset($_GET['galaxy']) && is_numeric($_GET['galaxy'])){
$galaxy = $_GET['galaxy'];
} else {
$galaxy = "";
}
if(isset($_GET['race'])){
$race = mysql_real_escape_string($_GET['race']);
} else {
$race = "";
}
if(isset($_GET['type'])){
$type = mysql_real_escape_string($_GET['type']);
} else {
$type = "";
}
$results = 0;
if(($galaxy !== "") && ($race === "") && ($type ==="")){
$results = mysql_query("SELECT * FROM planets WHERE galaxy = '$galaxy' AND slot LIKE '%e' AND player NOT LIKE 'territory' ORDER BY galaxy ASC, system ASC, slot ASC") or die(mysql_error());
} elseif (($galaxy !== "") && ($race !== "") && ($type ==="")){
$results = mysql_query("SELECT * FROM planets WHERE galaxy = '$galaxy' AND slot LIKE '%e' AND player = '$race' ORDER BY galaxy ASC, system ASC, slot ASC") or die(mysql_error());
} elseif(($galaxy !== "") && ($race !== "") && ($type !=="")){
$results = mysql_query("SELECT * FROM planets WHERE galaxy = '$galaxy' AND planet = '$type' AND slot LIKE '%e' AND player = '$race' ORDER BY galaxy ASC, system ASC, slot ASC") or die(mysql_error());
} elseif(($galaxy === "") && ($race !== "") && ($type !=="")){
$results = mysql_query("SELECT * FROM planets WHERE planet = '$type' AND slot LIKE '%e' AND player = '$race' ORDER BY galaxy ASC, system ASC, slot ASC") or die(mysql_error());
} elseif(($galaxy === "") && ($race !== "") && ($type ==="")){
$results = mysql_query("SELECT * FROM planets WHERE slot LIKE '%e' AND player = '$race' ORDER BY galaxy ASC, system ASC, slot ASC") or die(mysql_error());
}
//BUILD THE PAGE
include('headinclude.php');
include('navigation.php'); ?>
<div class="well">
Encounter Search
<span style="float:right;"><a href="search.php">New search</a></span>
<div class="explain" style="align:center; font-size:100%">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get" style="margin:8px 0 0 0;">
Galaxy: <select name="galaxy" onChange="this.form.submit()" style="width:100px;">
<option value="" <?php if($galaxy===""){echo 'selected="selected"';}?>>-----</option>
<?php
for($i=1; $i <= $galaxy_count; $i++) {
echo '<option value="'.$i.'" '; if($galaxy==="$i"){echo 'selected="selected"';} echo '>'.$i.'</option>';
}
echo '</select>
NPC Race: <select name="race" onChange="this.form.submit()">
<option value=""'; if($race === ""){echo 'selected="selected"';}echo'>-----</option>';
echo '<option value="Krug" '; if($race==="Krug"){echo 'selected="selected"';} echo '>Krug</option>';
echo '<option value="Urcath" '; if($race==="Urcath"){echo 'selected="selected"';} echo '>Urcath</option>';
echo '<option value="Seekers" '; if($race==="Seekers"){echo 'selected="selected"';} echo '>Seekers</option>';
echo'</select>
Encounter Type: <select name="type" onChange="this.form.submit()">';
echo '<option value=""'; if($type === ""){echo 'selected="selected"';}echo'>-----</option>';
if($race === "Krug" || $race === "Urcath"){
echo '<option value="Abandoned Cruiser" '; if($type==="Abandoned Cruiser"){echo 'selected="selected"';} echo '>Abandoned Cruiser</option>';
echo '<option value="Abandoned Warship" '; if($type==="Abandoned Warship"){echo 'selected="selected"';} echo '>Abandoned Warship</option>';
echo '<option value="Small Enemy Fleet" '; if($type==="Small Enemy Fleet"){echo 'selected="selected"';} echo '>Small Enemy Fleet</option>';
echo '<option value="Enemy Fleet" '; if($type==="Enemy Fleet"){echo 'selected="selected"';} echo '>Enemy Fleet</option>';
echo '<option value="Large Enemy Fleet" '; if($type==="Large Enemy Fleet"){echo 'selected="selected"';} echo '>Large Enemy Fleet</option>';
echo '<option value="Floating Colony" '; if($type==="Floating Colony"){echo 'selected="selected"';} echo '>Floating Colony</option>';
echo '<option value="Large Floating Colony" '; if($type==="Large Floating+Colony"){echo 'selected="selected"';} echo '>Large Floating Colony</option>';
} elseif ($race === "Seekers") {
echo '<option value="Abanndoned Cruiser" '; if($type==="Abandoned Cruiser"){echo 'selected="selected"';} echo '>Abandoned Cruiser</option>';
echo '<option value="Abandoned Warship" '; if($type==="Abandoned Warship"){echo 'selected="selected"';} echo '>Abandoned Warship</option>';
echo '<option value="Large Abandoned Warship" '; if($type==="Large Abandoned Warship"){echo 'selected="selected"';} echo '>Large Abandoned Warship</option>';
echo '<option value="Abandoned Leviathan" '; if($type==="Abandoned Leviathan"){echo 'selected="selected"';} echo '>Abandoned Leviathan</option>';
echo '<option value="Large Abandoned Leviathan" '; if($type==="Large Abandoned Leviathan"){echo 'selected="selected"';} echo '>Large Abandoned Leviathan</option>';
echo '<option value="Abandoned Colossus Platform" '; if($type==="Abandoned Colossus Platform"){echo 'selected="selected"';} echo '>Abandoned Colossus Platform</option>';
}
echo'</select>
</form>
</div>';
echo '<table width="100%" class="table-striped" id="tablelist">
<thead><tr>
<th align="left">NPC Race</th>
<th align="left">Encounter</th>
<th align="left">Coordinates</td>
<th align="right">Time Added</th>
</tr></thead><tbody>';
if($results !== 0){
while($planets = mysql_fetch_assoc($results)){
echo "<tr><td>".stripslashes($planets['player'])."</td>";
echo "<td>".stripslashes($planets['planet'])."</td>";
echo "<td><a href=".$game_url."/galaxy/show?current_planet=".$currentplanet."&galaxy=".$planets['galaxy']."&solar_system=".$planets['system'].">[".$planets['galaxy'].":".$planets['system'].":".$planets['slot']."]</a></span></td>";
echo "<td align=\"right\">".date("m-d-Y H:i:s",$planets['timeupdated'])."</td>";
echo"</tr>"; }} ?>
</tbody></table>
</div>
<?php include('footinclude.php');