Fehler: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Programme\xampp\htdocs\projekte\Pages\search.php on line 142
- Code: Select all
You can't find a server that fits your needs?
Use the search tool! :)
<form method="get">
<table>
<tr>
<td>Server name:</td>
<td><input type='text' name='q' value='<?=@$_GET['q']?>'></td>
</tr>
<tr>
<td>Location:</td>
<td>
<?
if (isset($_GET['u']))
{
?>
<select name='l'>
<option <? if ($_GET['l'] == "All") { echo "selected"; } ?>>All</option>
<option <? if ($_GET['l'] == "Europe") { echo "selected"; } ?>>Europe</option>
<option <? if ($_GET['l'] == "North America") { echo "selected"; } ?>>North America</option>
<option <? if ($_GET['l'] == "South America") { echo "selected"; } ?>>South America</option>
<option <? if ($_GET['l'] == "Africa") { echo "selected"; } ?>>Africa</option>
<option <? if ($_GET['l'] == "Asia") { echo "selected"; } ?>>Asia</option>
<option <? if ($_GET['l'] == "Oceania") { echo "selected"; } ?>>Oceania</option>
</select>
<?
}
else
{
?>
<select name='l'>
<option selected>All</option>
<option>Europe</option>
<option>North America</option>
<option>South America</option>
<option>Africa</option>
<option>Asia</option>
<option>Oceania</option>
</select>
<?
}
?>
</td>
</tr>
<td>Client Version:</td>
<td>
<?
if (isset($_GET['u']))
{
?>
<select name='cl'>
<option <? if ($_GET['cl'] == "All") { echo "selected"; } ?>>All</option>
<option <? if ($_GET['cl'] == "7.1") { echo "selected"; } ?>>7.1</option>
<option <? if ($_GET['cl'] == "7.4") { echo "selected"; } ?>>7.4</option>
<option <? if ($_GET['cl'] == "7.5") { echo "selected"; } ?>>7.5</option>
<option <? if ($_GET['cl'] == "7.6") { echo "selected"; } ?>>7.6</option>
</select>
<?
}
else
{
?>
<select name='cl'>
<option selected>All</option>
<option>7.1</option>
<option>7.4</option>
<option>7.5</option>
<option>7.6</option>
</select>
<?
}
?>
</td>
</tr>
<tr>
<td>Connection:</td>
<td>
<?
if (isset($_GET['c']))
{
?>
<select name='c'>
<option <? if ($_GET['c'] == "All") { echo "selected"; } ?>>All</option>
<option <? if ($_GET['c'] == "0.5") { echo "selected"; } ?> value="0.5">More than 0.5Mbit</option>
<option <? if ($_GET['c'] == "5") { echo "selected"; } ?> value="5">More than 5Mbit</option>
<option <? if ($_GET['c'] == "10") { echo "selected"; } ?> value="10">More than 10Mbit</option>
</select>
<?
}
else
{
?>
<select name='c'>
<option selected>All</option>
<option value="0.5">More than 0.5Mbit</option>
<option value="5">More than 5Mbit</option>
<option value="10">More than 10Mbit</option>
</select>
<?
}
?>
</td>
</tr>
<tr>
<td>Hide offline servers</td>
<td><input type='checkbox' value='1' name='o' <? if (isset($_GET['o'])) {$oln = "&o=1"; echo "checked"; }else{$oln = "";} ?>></td>
</tr>
</table>
<input type='submit' value='Search' name='u'>
<input type='hidden' name='search' value='1'>
</form>
<p>
<?
if (isset($_GET['u']))
{
echo "<b><u>Search results:</u></b><p>";
$pquery = trim(htmlentities($_GET['q'], ENT_QUOTES));
$sql = "SELECT * FROM servers";
$query = 0;
$online = 0;
$notfull = 0;
$location = 0;
if (! empty($pquery))
{
$sql .= " WHERE name LIKE '%".$pquery."%'";
$query = 1;
}
if (isset($_GET['o']))
{
if ($query == 1){$sql .= " AND ";}
else {$sql .= " WHERE ";}
$online = 1;
$sql .= "online = '1'";
}
if ($_GET['l']!="All")
{
if ($query == 1 || $notfull == 1 || $online == 1){$sql .= " AND ";}
else {$sql .= " WHERE ";}
$location = 1;
$sql .= "location = '".$_GET['l']."'
}
if ($_GET['cl']!="All")
{
if ($query == 1 || $notfull == 1 || $online == 1){$sql .= " AND ";}
else {$sql .= " WHERE ";}
$client_version = 1;
$sql .= "client_version = '".$_GET['cl']."'
}
if ($_GET['c']!="All")
{
if ($query == 1 || $notfull == 1 || $online == 1 || $location == 1){$sql .= " AND ";}
else {$sql .= " WHERE ";}
if ($_GET['c']=="0.5")
{
$sql .= "connection != '< 0.5'";
}
elseif ($_GET['c']=="5")
{
$sql .= "connection != '< 0.5' AND connection != '0.5' AND connection != '1' AND connection != '2' AND connection != '2.5'";
}
elseif ($_GET['c']=="10")
{
$sql .= "connection == '> 10'";
}
}
if (isset($_GET['p'])) {$page = strip_tags($_GET['p']);}
else {$page = 1;}
$Servers_per_page = 10;
$maxperpage = $Servers_per_page;
$page1 = ($page*$maxperpage)-$maxperpage;
$number_of_servers = mysql_num_rows(mysql_query($sql));
$maxpage = ceil($number_of_servers/$Servers_per_page);
$sql .= " LIMIT ".$page1.", ".$maxperpage;
$sql2 = mysql_query($sql) or die(mysql_error()."<p>".$sql);
$out = "";
$pagen = $_SERVER['PHP_SELF']."?search&q=".$pquery."&l=".$_GET['l'].$oln."&c=".$_GET['c']."u=Search&";
if ($page > 1 && $number_of_servers > $page1 && $page != $maxpage)
{
$out = "<center><a href='".$pagen."p=".($page-1)."'>Past <</a> <b>".$page."/".$maxpage."</b> <a href='".$pagen."p=".($page+1)."'>> Next</a></center>";
}
elseif ($page == 1 && $page != $maxpage && $maxpage != 0)
{
$out = "<center><b>".$page."/".$maxpage."</b> <a href='".$pagen."p=".($page+1)."'>> Next</a></center>";
}
elseif ($page != 1 && $page == $maxpage)
{
$out = "<center> <a href='".$pagen."p=".($page-1)."'>Past <</a> <b>".$page."/".$maxpage."</b></center>";
}
echo "<b>Found:</b> ".$number_of_servers." servers.<br />";
echo $out;
?>
<table id='table1'>
<tr>
<td class='online'></td>
<td class='name'><b>Name</b></td>
<td class='client'><b>Client</b></td>
<td class='ip'><b>IP</b></td>
<td class='uptime'><b>Up-time</b></td>
<td class='players'><b>Players</b></td>
<td class='desc'><b>Description</b></td>
</tr>
<?
while ($serverrow = mysql_fetch_array($sql2))
{
if (strlen($serverrow['description'])>50)
{
$desc = substr($serverrow['description'], 0, 50)."...";
}
else
{
$desc = $serverrow['description'];
}
?>
<tr>
<td class='online'><?if ($serverrow['online'] == 1){ echo "<img src='images/online.gif'>"; }else{ echo "<img src='images/offline.gif'>";}?></td>
<td class='name'><a href='<?=$_SERVER['PHP_SELF']?>?viewserver&s=<?=$serverrow['id']?>'><?=$serverrow['name']?></a></td>
<td class='client'><?=$serverrow['client_version']?></td>
<td class='ip'><?=$serverrow['ip']?></td>
<td class='uptime'><?=$serverrow['uptime_avarage']?> %</td>
<td class='players'><?=$serverrow['players_online']?> / <?=$serverrow['players_max']?></td>
<td class='desc'><?=$desc?></td>
</tr>
<?
}
if ($number_of_servers == 0)
{
?>
<tr>
<td colspan='6' align='center'>Couldn't find any servers matching your query.</td>
</tr>
<?
}
echo "</table>";
echo $out;
}
?>