-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
289 lines (268 loc) · 10.7 KB
/
index.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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<?php
require_once('config.php');
require_once('core/controller.Class.php');
include('./server.php');
$resultt = mysqli_query($conn, "SELECT * FROM timer ORDER BY question_number DESC LIMIT 1");
while($res = mysqli_fetch_array($resultt)) {
$dated = $res['date'];
$h = $res['h'];
$m = $res['m'];
$s = $res['s'];
}
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>V-Quiz</title>
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
/>
<!--jQuery library-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!--Latest compiled and minified JavaScript-->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- Custom CSS -->
<link href="style1.css" rel="stylesheet" />
</head>
<body>
<?php if(isset($_COOKIE['id']) && isset($_COOKIE['sess'])){
$Controller = new Controller;
if($Controller -> checkUserStatus($_COOKIE['id'], $_COOKIE['sess'])){?>
<div
class="navbar navbar-inverse navbar-fixed-top"
style="background-color: #345657"
>
<div class="container-fluid">
<div class="navbar-header">
<button
type="button"
class="navbar-toggle"
data-toggle="collapse"
data-target="#myNavbar"
>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="" style="font-size: 25px; color: white"
>V-Quiz</a
>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li>
<a href=""
><button
class="btn b1"
style="margin-top: -10px; margin-right: -10px; color: #345657"
>
<?php
$quer = "SELECT * FROM questions ORDER BY question_number DESC LIMIT 1";
$resul = mysqli_query($conn, $quer);
while($r=mysqli_fetch_array($resul)){
$date=date_create($r['date']);
echo "<p style='color: white'> This Que is Posted On: ".date_format($date,"d M Y")."</p>";
}
?>
</button></a
>
</li>
<li>
<a href=""
><button
class="btn b1"
style="margin-top: -10px; margin-right: -10px; color: #345657"
>
<p id="demo" style="color: white"></p>
</button></a
>
<script>
console.log("This is Timer")
var countDownDate = <?php
echo strtotime("$dated $h:$m:$s" ) ?> * 1000;
var now = <?php echo time() ?> * 1000;
// Update the count down every 1 second
var x = setInterval(function() {
now = now + 1000;
// Find the distance between now an the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result in an element with id="demo"
document.getElementById("demo").innerHTML = days + "d " + hours + "h " +
minutes + "m " + seconds + "s ";
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "EXPIRED";
}
}, 1000);
</script>
</li>
<li>
<a
href="logout.php"
style="font-size: 30px; margin-top: -10px; color: white"
><span class="glyphicon glyphicon-log-out"></span
></a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-sm-10 col-sm-offset-1 above">
<h1 style="color: #c8c8c8">WELCOME <?php echo $Controller -> printData(intval($_COOKIE['id']));?></h1>
<?php
$query= "SELECT * FROM questions ORDER BY question_number DESC LIMIT 1";
$result = mysqli_query($conn, $query)or die(mysqli_error($conn));
while($row=mysqli_fetch_array($result)){ ?>
<h2 style="color: #c8c8c8">Today Quiz Question: <?php echo $row['question_number']; ?></h2>
<h5 style="color: #c8c8c8">posted on: <?php
$que=$row['question_number'];
$query1= "SELECT * FROM questions WHERE question_number='$que' ";
$result1= mysqli_query($conn, $query1)or die(mysqli_error($conn));
while($row1=mysqli_fetch_array($result1)){
$date=date_create($row1['date']);
echo date_format($date,'d M Y');
} ?></h5>
<button style="width:100%; background: none; border:none;" id="myBtn"><div class="">
<h4 style="color: #c8c8c8">
<textarea class="current" readonly style="background:none; resize:none; border:none; size:max-content;"><?php echo $row['question']; ?></textarea>
</h4>
</div></button>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<textarea name="" readonly style="border:none; resize: none;width: 100%; height: 100%; size:max-content;"><?php echo $row['question']; ?></textarea>
</div>
</div>
<script>
var modal = document.getElementById("myModal");
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks on the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</div>
<div class="container">
<div class="col-sm-12">
<form action="user_upload.php" id="usrform" method="POST" enctype="multipart/form-data" >
<div class="col-sm-4" style="left: 0">
<div class="upload">
<h3 style="color: #c8c8c8">To Upload your Solution:-</h3>
<form action="user_upload.php" method="POST">
<input type="hidden" name='que' value=<?php echo $que; ?> readonly>
<a
class="btn b2"
style="
margin-top: 5px;
margin-right: 10px;
width: 280px;
background-color: white;
"
><input type="file" id="myfile" name="myfile"
/></a>
<br /><br />
<button
type="submit"
name="solution"
class="btn b2"
style="margin-top: 5px; background-color: #345657; color: white"
>Upload</button
>
</form>
</div>
</div>
</form>
<?php } ?>
<div class="col-sm-4"></div>
<div
class="col-sm-4"
style="background-color: transparent; height: auto; color: #c8c8c8"
>
<h3>Note:-</h3>
<p>1.) Please upload before submission time.</p>
<p>2.) There will be the winners for every quiz</p>
<p>3.) Save file in .c/.java/.py</p>
<p>3.) Then zip all your files and upload</p>
</div>
</div>
</div>
<br />
<br />
<br />
<center>
<a href="user-previous.php"
><button
style="
background-color: #e4ded7;
margin-top: 10px;
border-radius: 25px;
width: 80%;
color: #345657;
"
>
<center><h4>Click here to see all Previous Questions</h4></center>
</button></a
>
</center>
<br>
<br>
<br>
<br>
<footer>Developed by CSI VIT-AP</footer>
</body>
<?php }
}else{ ?>
<body style="background-color: beige;">
<div class="container">
<div class="row row_style">
<div class="col-xs-8">
<div class="login-div">
<form>
<div class="logo"></div>
<div class="sub-title">EVENT LOGIN</div>
<div class="fields">
<!-- <div class="username">
<input type="username" name="email" class="user-input" placeholder="Email"/>
</div>
<div class="password">
<input type="password" name="password" class="pass-input" placeholder="Password"/>
</div> -->
</div>
<!-- <input type="submit" name="login" value="Login" class="loginin-button">
<br> <br> -->
<button onclick="window.location = '<?php echo $login_url; ?>'" type="button" class="loginin-button">Login with Google</button>
<div class="link">
<a href="signup.php" style="text-decoration: none;">New Member? Please Sign up</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<footer> Developed by CSI VIT-AP </footer>
</body>
<?php } ?>
</html>