forked from milindkesar/webappmenti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.php
144 lines (129 loc) · 3.95 KB
/
check.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
<!DOCTYPE html>
<script>
var mins =2;
var secs = mins*60;
function countdown()
{
setTimeout('Decrement()',60);
}
function Decrement(){
if(document.getElementById){
minutes=document.getElementById("minutes");
seconds=document.getElementById("seconds");
if(seconds<59){
seconds.value=secs;
}
else{
minutes.value=getminutes();
seconds.value=getseconds();
}
if(mins<0){
alert('time up');
minutes.value=0;
seconds.value=0;
}
else{
secs--;
setTimeout('Decrement()',1000);
}
}
}
function getminutes(){
mins=Math.floor(secs/60);
return mins;
}
function getseconds(){
return secs - Math.round(mins*60);
}
</script>
<?php
$connect=mysqli_connect("localhost","root","","menti");
if(!$connect){
echo"connection Failed";
}
echo"Connected successfully";
$fetchdata1="SELECT uniqueid from table1";
$result1=mysqli_query($connect,$fetchdata1);
$count=mysqli_num_rows($result1);
$i=0;
$b=0;
$d=0;
$ques=0;
$count2=0;
?>
<form action ="answercheck.php" method ="post">
<body onload="countdown();">
<div>
Time Left ::
<input id="minutes" type="text" style="width: 10px; border: none; font-size: 16px;
font-weight: bold; color: black;"><font size="5"> : </font>
<input id="seconds" type="text" style="width: 20px; border: none; font-size: 16px;
font-weight: bold; color: black;">
<?php
while ($i <= $count)
{
//
// <!-- // <body onload="countdown();">
// <div>
// Time Left ::
// <input id="minutes" type="text" style="width: 10px; border: none; font-size: 16px;
// font-weight: bold; color: black;"><font size="5"> : </font>
// <input id="seconds" type="text" style="width: 20px; border: none; font-size: 16px;
// font-weight: bold; color: black;"> -->
$idform=$_POST["id"];
$fetchdata="SELECT * from table1 LIMIT $i,1";
$result=mysqli_query($connect,$fetchdata);
while( $row=mysqli_fetch_assoc($result))
{
if($_POST["id"]==$row["uniqueid"])
{
// <!-- <body onload="countdown();">
// <div>
// Time Left ::
// <input id="minutes" type="text" style="width: 10px; border: none; font-size: 16px;
// font-weight: bold; color: black;"><font size="5"> : </font>
// <input id="seconds" type="text" style="width: 20px; border: none; font-size: 16px;
// font-weight: bold; color: black;"> -->
$c=0;
$a=0;
$isQues=1;
echo "<br>". $row["question"]."<br>";
// <input type="radio" name="options" value ="submit">
// echo $row["options"]."<br>";
// DECLARE @String VARCHAR(50) = $row["options"], @Delimiter CHAR(1) =','
//$value=SELECT * FROM STRING_SPLIT($row["options"],',')
$value=explode(',',$row["options"]);
$count1=count($value);
while($a<$count1)
{
?>
<input type="radio" name="button[<?php echo $b; ?>]" value="<?php echo $c; ?>">
<?php
echo $value[$a];
$a+=1;
$c+=1;
}
$b+=1;
}
else {
$flag = 1;
}
}
$i+=1;
}
// if($flag==1){
// $q="SELECT question from table1 where uniqueid=$row['uniqueid']";
// $query=mysqli_query($connect,$q);
// while($row=mysqli_fetch_array($query))
// {
// echo $row["question"];
// }
// }
if($flag==1&&$isQues!=1) {
echo" nope..";
}
?>
</div>
<input type="hidden" name="codeid" value="<?php echo $idform; ?>">
<input type ="submit" name="Submit" value="submit">
</form>