-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgames.php
119 lines (106 loc) · 3.98 KB
/
games.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
include_once("session.php");
include_once("classes.php");
session_start();
// Get this from $_SESSION
$me = $_SESSION["user"]->getName();
if( !$_SESSION['user']->isLoggedIn() ){
header('location: index.php');
}
$conn = new Database();
$result = $conn->queryTable("select * from getGames('$me');");
if( isset ($_POST['games'] ) ){
foreach( $_POST['games'] as $game )
{
$split = split('#', $game);
$game = pg_escape_string($split[0]);
$console = pg_escape_string($split[1]);
if( !$conn->queryTrueFalse("select likeGame('$me','$game','$console');") ){
die('Please contact benson');
} else{
header('Location: question.php');
}
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>eHarbinger</title>
<link rel="stylesheet" type="text/css" href="css/meg.css">
<script type='text/javascript' src='//code.jquery.com/jquery-1.7.1.js'></script>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
var $rows = $('#table tr');
$('#search').keyup(function() {
var val = '^(?=.*\\b' + $.trim($(this).val()).split(/\s+/).join('\\b)(?=.*\\b') + ').*$',
reg = RegExp(val, 'i'),
text;
$rows.show().filter(function() {
text = $(this).text().replace(/\s+/g, ' ');
return !reg.test(text);
}).hide();
});
});//]]>
</script>
</head>
<body>
<section id = 'banner'>
<div class = 'inner split'>
<form action="userauth.php" method="post">
<button> Log Out </button>
<input type="hidden" name="type" value="logout">
</form>
<section>
<h2> Pick Any Games </h2>
</section>
<section>
<p> In order to match you with other players, click on each game you love to play.</p>
</section>
</div>
</section>
<section class = 'wrapper'>
<form method='post'>
<?php
/* include_once("session.php");
include_once("classes.php");
session_start();
// Get this from $_SESSION
$me = $_SESSION["user"]->getName();
if( !$_SESSION['user']->isLoggedIn() ){
header('location: index.php');
}
$conn = new Database();
$result = $conn->queryTable("select * from getGames('$me');");
if( isset ($_POST['games'] ) ){
foreach( $_POST['games'] as $game )
{
$split = split('#', $game);
$game = pg_escape_string($split[0]);
$console = pg_escape_string($split[1]);
if( !$conn->queryTrueFalse("select likeGame('$me','$game','$console');") ){
die('Please contact benson');
} else{
header('refresh: 0');
}
}
}
*/
$i=1;
echo "<input type='text' id='search' placeholder='Type to search' autofocus='autofocus' autocomplete='off'>";
echo "<table id='table'>";
foreach( $result as $row ){
$gameName=$row['gamename'];
$gameConsole=$row['gameconsole'];
echo "<tr><td><input type='checkbox' name='games[]' value='$gameName#$gameConsole' id='$i'><label for='$i'><font color='black'>$gameName</font> ON <font color='black'>$gameConsole</font></label><br/></td></tr>\n";
$i++;
}
echo "</table>";
?>
<input type='submit' value='Submit'>
</form>
</section>
</body>
<footer><?php include('footer.html');?></footer>
</html>