-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.php
More file actions
158 lines (139 loc) · 6.66 KB
/
user.php
File metadata and controls
158 lines (139 loc) · 6.66 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
include_once './includes/db_connect.php';
include_once './includes/functions.php';
sec_session_start();
checkSessionTimeExpiry($mysqli);
echo '<script>var sessId = '.$_SESSION['sess_id'].'</script>';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>REP Xword user page</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/jumbotron.css" rel="stylesheet">
<script src="https://js.pusher.com/3.1/pusher.min.js"></script>
<!-- Bootstrap core JavaScript-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="css/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="css/js/ie10-viewport-bug-workaround.js"></script>
<script>
$(function () {
$('#leaveSession').click(function () {
sessionStorage.removeItem('startTime');
sessionStorage.removeItem('answered');
sessionStorage.removeItem('attempts');
sessionStorage.removeItem('noOfQuestions');
});
});
</script>
</head>
<body>
<?php if ((login_check($mysqli) == true)) : ?>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="./index.php" style="color:white;">REP Crossword User Page</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<div class="navbar-right navbar-form" style="color:white;">
<?php loginNavBarAction($mysqli); ?>
<a class="btn btn-success" href="includes/logout.php" role="button">Log out</a>
</div>
</div><!--/.navbar-collapse -->
</div>
</nav>
<div class="jumbotron">
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-8 col-md-offset-2">
<h3>Available sessions</h3>
<table id="sessionsOnline" class="table table-striped">
<thead>
<tr>
<th>Session ID</th>
<th>Crossword ID</th>
<th>Available From</th>
<th>End time</th>
<th>Online</th>
<th>Teams</th>
</tr>
</thead>
<tbody>
<?php availSessionCheck($mysqli); ?>
</tbody>
</table>
<?php if (!userInSession($mysqli)) : ?>
<form action="includes/sessionJoin.php" id="sessionJoin" method="post">
<div class="form-group">
<div class="col-xs-12 col-md-8 col-md-offset-2">
<div class="row">
<div class="col-xs-8 col-md-9">
<select class="form-control" name="sessionJoin" form="sessionJoin" style="display: inline-block">
<?php sessionCheckD($mysqli); ?>
</select>
</div>
<div class="col-xs-4 col-md-3">
<input type="submit" class="btn btn-primary btn-sm" name="joinSession" value="Join Session" style="display: inline-block">
</div>
</div></div></div>
</form>
<?php elseif(gateCheck($mysqli)) : ?>
<form action="../XWordPuzzleStandAlone/main_xword.php">
<input type="submit" class="btn btn-primary btn-sm" value="Resume puzzle">
</form>
<?php else : ?>
You have joined a session. Please wait for the gate to open... <br>
Click <a href="./includes/leaveSession.php" id="leaveSession">here</a> to leave the session.
<?php endif; ?>
<script>
//********* HERE IS THE LIVE GATE PUSH SYSTEM ********
console.log(sessId);
var pusher = new Pusher('bcaaf0a9f48c5ad4601b', {
cluster: 'ap1',
encrypted: true
});
var channelT = pusher.subscribe(sessId.toString());
channelT.bind('gateOpen', function (data) {
if (data.gateStatus == 'open') {
alert('Gate is ' + data.gateStatus);
window.location.href = "XWordPuzzleStandAlone/main_xword.php";
}
});
</script>
<div class="row">
<div class="col-xs-12 col-md-12">
<br> <p>
Read the following instructions before commencing on the crossword:<br>
• Click an empty white tile in the crossword grid and a question box will appear.<br>
• Type your answer in the provided box and click Enter.<br>
• Repeat the above steps until you have filled in the entire puzzle grid.<br>
• You have a maximum of two attempts. (3 marks for the first attempt and 2 marks for the 2nd attempt)<br>
• At the end of the game you may check your answers by clicking on the check answers button.<br>
(Hyphens, punctuation marks, and spaces between words should not be entered in this crossword) <br>
</p>
</div></div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<hr>
<p>© 2016 Product of REP
</p>
</div>
</div>
<!--**********************************************************************-->
<!-- For the case of wrong login -->
<?php else :
echo '<script>';
echo 'window.location.href="./index.php"';
echo '</script>';
endif;
?>
</body>
</html>