forked from zilveer/Multiplayer-PHP-Ajax-Games
/
flashsearchdos.php
62 lines (47 loc) · 1.54 KB
/
flashsearchdos.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
<?php
require "globals.php";
$search=mysql_escape($_POST['search']);
$page=mysql_escape($_POST['page']);
if($search == "")
{
echo "<h1>Search Games</h1><center>Please type in the most accurate game title description to find your favourite games.<br>
<form action=flashsearchdos.php?page=search method=post>Game Title: <input type=text name=search> <input type=submit value='Search'></form></center>";
}
else
{
// Strip HTML tags
$search = strip_tags($search);
// Find games
$sql = "SELECT game FROM flash2 WHERE game LIKE '%$search%' ORDER BY game DESC LIMIT 10";
$countmatches = mysql_num_rows(mysql_query("$sql"));
$findgames = mysql_query("SELECT imagename,game,id FROM flash2 WHERE game LIKE '%$search%' ORDER BY game DESC LIMIT 10");
echo "<center><h1>Search Results</h1>
We have found $countmatches matches for your search results. The more specific the search phrase, the better your results will be.<br><br>
<table border=0 cellspacing=10 cellpadding=0 border=0><tr>";
$counter = 0;
while($game = mysql_fetch_array($findgames))
{
// Next row
if($counter == 3)
{
echo "</tr><tr>";
// Reset counter
$counter = 0;
}
echo "<td><table>
<tr>
<td>
<font size=1><a href=game.php?id=$game[id] title=\"$game[game]\"><center>
<img src=/arcadefiles/{$game['imagename']} height=60 width=60></a><br />
<li><a href=game.php?id=$game[id] title=\"$game[game]\">$game[game]</center></a>
<li><a href=highscores.php?id=$game[id]>View High Scores</a></center>
</font></td>
</tr>
</table></td>";
$counter ++;
}
echo "</tr></table>";
}
print"<br /><br />";
$h->endpage();
?>