-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathques.php
executable file
·169 lines (146 loc) · 3.21 KB
/
ques.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
<?php
session_start();
$_SESSION['quesno']=$_GET["id"];
?>
<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js"></script>
<script>
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
function submission()
{
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){ // ajax module
var str=xmlhttp.responseText;
var res=str.split(",");
var i;
for(i=0;i<res.length;i=i+1)
{
var tab=document.getElementById("qdisp");
tab.rows[i+1].cells[1].innerHTML=res[i]+"<hr>";
}
}
}
var str="update.php?u=1";
xmlhttp.open("GET", str, true);
xmlhttp.send(null);
}
scoreboard();
submission();
function scoreboard()
{
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){ // ajax module
var str=xmlhttp.responseText;
var res=str.split(",");
var i;
for(i=0;i<res.length;i=i+1)
{
var tab1=document.getElementById("scorecard");
var temp=res[i].split(" ");
tab1.rows[i+1].cells[0].innerHTML=temp[0]+"<hr>";
tab1.rows[i+1].cells[1].innerHTML=temp[1]+"<hr>";
}
}
}
var str="update.php?u=2";
xmlhttp.open("GET", str, true);
xmlhttp.send(null);
}
//setInterval(function(){submission()}, 5000);
setInterval(function(){scoreboard()}, 1000);
function loadques()
{
var s= "ques/"+<?php echo $_SESSION['quesno']?>+".txt" ;
$(document).ready(function(){
$("#ques").load(s);
});
}
loadques();
function loadprev()
{
var q=<?php echo $_SESSION['quesno']?>;
if(q!=0)
{
q=q-1;
location.href = "ques.php?id=<?php echo $_SESSION['quesno']-1?>";
}
else
location.href = "ques.php?id=2";
}
</script>
<style>
body
{
background: #563c55 url(images/blurred.jpg) no-repeat center top;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
</style>
<link rel="stylesheet" type="text/css" href="css/home.css" />
</head>
<body>
<div>
<a href="home.php"><input id= "home_button" class="myButton" type="button" value=" Home "></a>
</div>
<div id="main">
<div id="ques">
<!--block to load question_____________________________________-->
<!--block to load question ends_____________________________________-->
</div>
<div id=upload_form>
<form action="upload.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" class="upload1"><br><br>
<input class="myButton" type="submit" name="submit" value="Submit">
</form>
</div>
<div id="instr">
</div>
</div>
<div id="sidebar">
<p>LEADERBOARD</p>
<table id="scorecard" cellspacing=20 style="font-size:30px;" align="center">
<tr>
<td>NAME</td>
<td>SCORE</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</div>
</body>
</html>