-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.php
436 lines (293 loc) · 11.2 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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
<?php
session_start();
require_once("config.php");
if(!isset($_SESSION["un"]))
{
header("Location:login.php");
}
if(isset($_SESSION['un']))
{
$username=$_SESSION['un'];
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Home</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/style.css">
<link rel="icon" type="image/png" href="img/ruet.png">
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
<script src="js/vendor/jquery-1.12.0.min.js"></script>
<script src="js/vendor/jquery-1.12.0.min.js"></script>
<script src="bootstrap-3.3.7/js/bootstrap.min.js"> </script>
<script src="bootstrap-3.3.7/js/bootstrap.js"> </script>
<script src="js/vendor/moment.min.js"></script>
<script>
// Set the date we're counting down to
function call(d,val,st){
//console.log(d);
//console.log(val);
//console.log(st);
var countDownDate = new Date(d).getTime();
var start =new Date(st).getTime();
//console.log(start);
var result;
// Update the count down every 1 second
var x = setInterval(function() {
// Get todays date and time
var now = new Date().getTime();
// Find the distance between now an the count down date
if(start>now)
{
var distance = start - 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"
var result=days + "d " + hours + "h "
+ minutes + "m " + seconds + "s ";
//console.log(result);
document.getElementById(val).innerHTML = "Contest Countdown : "+ days + "d " + hours + "h " + minutes + "m " + seconds + "s ";
}
else if(countDownDate>=now)
{
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"
var result=days + "d " + hours + "h "
+ minutes + "m " + seconds + "s ";
//console.log(result);
document.getElementById(val).innerHTML = "Running : "+ days + "d " + hours + "h "
+ minutes + "m " + seconds + "s ";
}
// If the count down is over, write some text
else if (now>countDownDate) {
clearInterval(x);
document.getElementById(val).innerHTML = "Status : Finished";
}
}, 1000);
return x;
}
</script>
</head>
<body onload="set()">
<!--<script type="text/javascript">var hour=<?php print json_encode(date("H"));?>; call(hour); </script>-->
<div class="main">
<div class="row">
<div class="col-sm-12">
<nav class="shadow navbar navbar-inverse navbar-fixed-top nbar">
<div class="navbar-header">
<a class="navbar-brand lspace" href="home.php">RUET OJ</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse navbar-menubuilder">
<ul class="nav navbar-nav">
<li class="space"><a href="compiler.php"><i class="fa fa-code ispace"></i>Compiler</a></li>
<li class="space"><a href="archive.php"><i class="fa fa-archive ispace"></i>Problem Archive</a></li>
<li class="space"><a href="contest.php"><i class="fa fa-cogs ispace"></i>Contests</a></li>
<li class="space"><a href="#"><i class="fa fa-check-square ispace"></i>Debug</a></li>
<li class="lgspace space"><a href="profile.php?user=<?php echo("$username"); ?>"><i class="fa fa-user ispace"></i><?php echo("$username"); ?></a></li>
<li class="space"><a href="logout.php"><i class="fa fa-power-off ispace"></i>Logout</a></li>
</ul>
</div>
</nav>
</div>
</div>
<div class="row log">
<div class="col-sm-10">
<div class=""><h3 style="text-align:center;">Online Compiler</h3></div>
</div>
<div class="col-sm-1">
</div>
<div class="col-sm-1">
</div>
</div>
<div class="row cspace">
<div class="col-sm-8">
<div class="form-group">
<form action="compile.php" name="f2" method="POST">
<label for="lang">Choose Language</label>
<select class="form-control" name="language">
<option value="c">C</option>
<option value="cpp">C++</option>
<option value="cpp11">C++11</option>
<option value="java">Java</option>
<!--<option value="python2.7">Python2</option>
<option value="python3.2">Python2</option>-->
</select><br><br>
<label for="ta">Write Your Code</label>
<textarea class="form-control" name="code" rows="10" cols="50"></textarea><br><br>
<label for="in">Enter Your Input</label>
<textarea class="form-control" name="input" rows="10" cols="50"></textarea><br><br>
<input type="submit" class="btn btn-success" value="Run Code"><br><br><br>
</form>
<!--<script>
"use strict";
function submitForm(oFormElement)
{
var xhr = new XMLHttpRequest();
var display=document.getElementById('div');
xhr.onload = function(){ display.innerHTML=xhr.responseText; }
xhr.open (oFormElement.method, oFormElement.action, true);
xhr.send (new FormData (oFormElement));
return false;
}
</script>-->
<!--<label for="out">Output</label>
<textarea id='div' class="form-control" name="output" rows="10" cols="50"></textarea><br><br>-->
</div>
</div>
<div class="col-sm-4">
<div style="margin-left:20px" class="pb">Recent And Upcoming Contests</div>
<?php
require_once("connection.php");
date_default_timezone_set("Asia/Dhaka");
$q3="SELECT * FROM rapl_oj_contest ORDER BY date_on DESC LIMIT 0,2";
$sq3=mysqli_query($con,$q3);
$q4="SELECT TIME_FORMAT(end_at,'%H') end_at FROM rapl_oj_contest ORDER BY date_on DESC";
$q5="SELECT TIME_FORMAT(end_at,'%i') end_at FROM rapl_oj_contest ORDER BY date_on DESC";
$q6="SELECT TIME_FORMAT(end_at,'%s') end_at FROM rapl_oj_contest ORDER BY date_on DESC";
$sq4=mysqli_query($con,$q4);
$sq5=mysqli_query($con,$q5);
$sq6=mysqli_query($con,$q6);
$i=0;
while($row=mysqli_fetch_array($sq3))
{
$d=date("Y-m-d");
$t=date("H:i:s");
$m=$row['start_at'];
$nv=$row['start_at'];
$i++;
$demo="demo".$i;
$nr=mysqli_fetch_array($sq4);
$nm=mysqli_fetch_array($sq5);
$ns=mysqli_fetch_array($sq6);
$shr=$nr['end_at'];
$shm=$nm['end_at'];
$shs=$ns['end_at'];
$cur=date('H');
$curm=date('i');
$curs=date('s');
$h=$shr-$cur;
$mt=$shm-$curm;
$scnd=$shs-$curs;
if($scnd<0)
{
$scnd=$scnd+60;
$mt=$mt-1;
}
if($mt<0)
{
$mt=$mt+60;
$h=$h-1;
}
if($h<0)
{
$h=$h+24;
}
$en=$row['end_at'];
$seconds = strtotime($t) - strtotime($m);
$ss= strtotime($en) - strtotime($t);
$min=intval($seconds/60);
$sec=intval($seconds%60);
$hr=intval($min/60);
$m=intval($min%60);
?>
<script type="text/javascript">
var end=<?php print json_encode($en);?>;
var val=<?php print json_encode($i);?>;
var nv=<?php print json_encode($nv);?>;
//console.log("Start" +nv);
call(end,val,nv);
</script>
<?php
echo("<div class=\"xmm\">Contest Name: <a href=\"contestproblem.php?name=$row[cname]\">$row[cname]</a><br><br>Contest Date: $row[date_on] <br><br>Start Time: $row[start_at]<br><br>End Time: $row[end_at] <br><br><div id=$demo></div> <br><br></div>");
/*echo(" <a href=\"save.php?name=$row[table_name]\">$row[table_name]</a><br><br>");
if($row['date_on']==$d && $seconds>=0 && $ss>=0 )
{
echo("<div class=\"xmm\">Contest Name: <a href=\"contestproblem.php?name=$row[cname]\">$row[cname]</a><br><br>Contest Date: $row[date_on] <br><br>Start Time: $row[start_at]<br><br>End Time: $row[end_at] <br><br> Status: <b>Running</b> <br><br>Time Remaining: $h hour $mt miniute $scnd second <br><br></div>");
}
else if($d>$row['date_on'] || ($d==$row['date_on'] && $t>$en))
{
echo("<div class=\"xmm\">Contest Name: <a href=\"contestproblem.php?name=$row[cname]\">$row[cname]</a><br><br>Contest Date: $row[date_on] <br><br>Start Time: $row[start_at]<br><br>End Time: $row[end_at] <br><br>Status: <b>Finished</b><br><br></div>");
}
else
{
echo("<div class=\"xmm\">Contest Name: $row[cname]<br><br>Contest Date: $row[date_on] <br><br>Start Time: $row[start_at]<br><br>End Time: $row[end_at] <br><br>Countdown : <div id=\"demo\"></div><br><br></div>");
}
}
*/
}
?>
</div>
</div>
</div>
<br><br><br>
<div class="area">
<div class="well foot">
<div class="row area">
<div class="col-sm-3">
<!-- BEGIN: Powered by Supercounters.com -->
<center><script type="text/javascript" src="http://widget.supercounters.com/online_i.js"></script><script type="text/javascript">sc_online_i(1360839,"ffffff","e61c1c");</script><br><noscript><a href="http://www.supercounters.com/">Free Online Counter</a></noscript>
</center>
<!-- END: Powered by Supercounters.com -->
</div>
<div class="col-sm-5">
<div class="">
<b>Beta Version-2016</b><br>
<b>Developed By Ashadullah Shawon</b>
</div>
</div>
<div class="col-sm-4">
<?php
date_default_timezone_set("Asia/Dhaka");
$h=date("H");
$i=date("i");
$s=date("s");
?>
<script>
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
document.getElementById('txt').innerHTML =
h + ":" + m + ":" + s;
var t = setTimeout(startTime, 1000);
}
function checkTime(i) {
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}
</script>
<script>
function set(){
//document.getElementById('tx').innerHTML= hour + ":" + min +":" + sec;
document.getElementById('tx').innerHTML="<b>Server Time : "+ moment().format('h:mm:ss a') +"</b>";
var t=setTimeout(set,1000);
}
</script>
<div id="tx"></div>
</div>
</div>
</div>
</div>
</body>
</html>