From aef98956a04b626315e02c25903000a77a84c4f1 Mon Sep 17 00:00:00 2001 From: chandachewe10 Date: Tue, 27 Sep 2022 11:19:49 +0100 Subject: [PATCH 1/4] Time up for each individual question --- account.php | 259 ++++++++++++++++---------------- dbConnection.php | 2 +- update.php | 375 +++++++++++++++++++++++------------------------ 3 files changed, 314 insertions(+), 322 deletions(-) diff --git a/account.php b/account.php index 2c043b4..95a04b7 100755 --- a/account.php +++ b/account.php @@ -19,8 +19,9 @@ -alert("'.@$_GET['w'].'");';} +alert("'.@$_GET['w'].'");'; +} ?> @@ -37,17 +38,14 @@     Hello, '.$name.' |  Signout'; + include_once 'dbConnection.php'; + echo '    Hello, '.$name.' |  Signout'; }?> @@ -70,9 +68,15 @@ '; + //header("location:dash.php?q=4&step=2&eid=$id&n=$total"); + + //Form for time up + echo '
'; + //time up from ends here + + + } //result display -if(@$_GET['q']== 'result' && @$_GET['eid']) -{ -$eid=@$_GET['eid']; -$q=mysqli_query($con,"SELECT * FROM history WHERE eid='$eid' AND email='$email' " )or die('Error157'); -echo '
+if (@$_GET['q']== 'result' && @$_GET['eid']) { + $eid=@$_GET['eid']; + $q=mysqli_query($con, "SELECT * FROM history WHERE eid='$eid' AND email='$email' ")or die('Error157'); + echo '

Result


'; -while($row=mysqli_fetch_array($q) ) -{ -$s=$row['score']; -$w=$row['wrong']; -$r=$row['sahi']; -$qa=$row['level']; -echo ' + while ($row=mysqli_fetch_array($q)) { + $s=$row['score']; + $w=$row['wrong']; + $r=$row['sahi']; + $qa=$row['level']; + echo ''; -} -$q=mysqli_query($con,"SELECT * FROM rank WHERE email='$email' " )or die('Error157'); -while($row=mysqli_fetch_array($q) ) -{ -$s=$row['score']; -echo ''; -} -echo '
Total Questions'.$qa.'
Total Questions'.$qa.'
right Answer '.$r.'
Wrong Answer '.$w.'
Score '.$s.'
Overall Score '.$s.'
'; - + } + $q=mysqli_query($con, "SELECT * FROM rank WHERE email='$email' ")or die('Error157'); + while ($row=mysqli_fetch_array($q)) { + $s=$row['score']; + echo 'Overall Score '.$s.''; + } + echo '
'; } ?> +if (@$_GET['q']== 2) { + $q=mysqli_query($con, "SELECT * FROM history WHERE email='$email' ORDER BY date DESC ")or die('Error197'); + echo '
'; -$c=0; -while($row=mysqli_fetch_array($q) ) -{ -$eid=$row['eid']; -$s=$row['score']; -$w=$row['wrong']; -$r=$row['sahi']; -$qa=$row['level']; -$q23=mysqli_query($con,"SELECT title FROM quiz WHERE eid='$eid' " )or die('Error208'); -while($row=mysqli_fetch_array($q23) ) -{ -$title=$row['title']; -} -$c++; -echo ''; -} -echo'
S.N.QuizQuestion SolvedRightWrongScore
'.$c.''.$title.''.$qa.''.$r.''.$w.''.$s.'
'; + $c=0; + while ($row=mysqli_fetch_array($q)) { + $eid=$row['eid']; + $s=$row['score']; + $w=$row['wrong']; + $r=$row['sahi']; + $qa=$row['level']; + $q23=mysqli_query($con, "SELECT title FROM quiz WHERE eid='$eid' ")or die('Error208'); + while ($row=mysqli_fetch_array($q23)) { + $title=$row['title']; + } + $c++; + echo ''.$c.''.$title.''.$qa.''.$r.''.$w.''.$s.''; + } + echo''; } //ranking start -if(@$_GET['q']== 3) -{ -$q=mysqli_query($con,"SELECT * FROM rank ORDER BY score DESC " )or die('Error223'); -echo '
+if (@$_GET['q']== 3) { + $q=mysqli_query($con, "SELECT * FROM rank ORDER BY score DESC ")or die('Error223'); + echo '
'; -$c=0; -while($row=mysqli_fetch_array($q) ) -{ -$e=$row['email']; -$s=$row['score']; -$q12=mysqli_query($con,"SELECT * FROM user WHERE email='$e' " )or die('Error231'); -while($row=mysqli_fetch_array($q12) ) -{ -$name=$row['name']; -$gender=$row['gender']; -$college=$row['college']; -} -$c++; -echo '
RankNameGenderCollegeScore
'.$c.''.$name.''.$gender.''.$college.''.$s.''; + $c=0; + while ($row=mysqli_fetch_array($q)) { + $e=$row['email']; + $s=$row['score']; + $q12=mysqli_query($con, "SELECT * FROM user WHERE email='$e' ")or die('Error231'); + while ($row=mysqli_fetch_array($q12)) { + $name=$row['name']; + $gender=$row['gender']; + $college=$row['college']; + } + $c++; + echo '
'.$c.''.$name.''.$gender.''.$college.''.$s.''; + } + echo '
'; } -echo '
';} ?> diff --git a/dbConnection.php b/dbConnection.php index 544e5e0..0f5cd21 100755 --- a/dbConnection.php +++ b/dbConnection.php @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/update.php b/update.php index 9cac8f3..5ba5ee7 100755 --- a/update.php +++ b/update.php @@ -1,224 +1,213 @@ + + + + + +// If Time is Up +if (@$_GET['q']== 'quiz' && @$_GET['step']== 2 && @$_GET['time_up']== 1) { + echo "Good Morning"; + +} From 0b862a5117bf26017c8d45999d580c78d83bf808 Mon Sep 17 00:00:00 2001 From: chandachewe10 Date: Tue, 27 Sep 2022 13:11:19 +0100 Subject: [PATCH 2/4] Hide CountDown if time Expires --- account.php | 70 +++++++++++++++++++++++++++++++++++------------------ time_up.php | 38 +++++++++++++++++++++++++++++ update.php | 13 ++++------ 3 files changed, 90 insertions(+), 31 deletions(-) create mode 100644 time_up.php diff --git a/account.php b/account.php index 95a04b7..6fa0a17 100755 --- a/account.php +++ b/account.php @@ -106,10 +106,10 @@ $rowcount=mysqli_num_rows($q12); if ($rowcount == 0) { echo ''.$c++.''.$title.''.$total.''.$sahi*$total.''.$time.' min -  Start'; +  Start'; } else { echo ''.$c++.''.$title.' '.$total.''.$sahi*$total.''.$time.' min -  Restart'; +  Restart'; } } $c=0; @@ -117,29 +117,52 @@ }?> - + @@ -170,7 +193,7 @@ function secondPassed() { //header("location:dash.php?q=4&step=2&eid=$id&n=$total"); //Form for time up - echo ''; + echo ''; //time up from ends here @@ -178,6 +201,7 @@ function secondPassed() { } //result display if (@$_GET['q']== 'result' && @$_GET['eid']) { + echo ""; $eid=@$_GET['eid']; $q=mysqli_query($con, "SELECT * FROM history WHERE eid='$eid' AND email='$email' ")or die('Error157'); echo '
diff --git a/time_up.php b/time_up.php new file mode 100644 index 0000000..2d0ddbe --- /dev/null +++ b/time_up.php @@ -0,0 +1,38 @@ + 0) { // User has submitted something + $q=mysqli_query($con, "SELECT * FROM history WHERE eid='$eid' AND email='$email' ")or die('Error115'); + + while ($row=mysqli_fetch_array($check_email)) { + $s=$row['score']; + $r=$row['sahi']; + } + $r++; + $s=$s+$sahi; // Total Score + $check_email=mysqli_query($con, "UPDATE `history` SET `score`=$s,`level`=$sn,`sahi`=$r, date= NOW() WHERE email = '$email' AND eid = '$eid'")or die('Error124'); + + // Show results + header("location:account.php?q=result&eid=$eid"); + } + + // If Time elapses on the first page (user has not submitted any question) + $check_email=mysqli_query($con, "INSERT INTO history VALUES('$email','$eid' ,'0','0','0','0',NOW())")or die('Error'); + //Show results + header("location:account.php?q=result&eid=$eid"); +} + + +?> \ No newline at end of file diff --git a/update.php b/update.php index 5ba5ee7..44ddff7 100755 --- a/update.php +++ b/update.php @@ -113,6 +113,7 @@ $total=@$_GET['t']; $ans=$_POST['ans']; $qid=@$_GET['qid']; + $time=@$_GET['time']; $q=mysqli_query($con, "SELECT * FROM answer WHERE qid='$qid' "); while ($row=mysqli_fetch_array($q)) { $ansid=$row['ansid']; @@ -176,9 +177,9 @@ $sun=$s+$sun; $q=mysqli_query($con, "UPDATE `rank` SET `score`=$sun ,time=NOW() WHERE email= '$email'")or die('Error174'); } - header("location:account.php?q=result&eid=$eid"); + header("location:account.php?q=result&eid=$eid&time=$time"); } else { - header("location:account.php?q=result&eid=$eid"); + header("location:account.php?q=result&eid=$eid&time=$time"); } } @@ -187,6 +188,7 @@ $eid=@$_GET['eid']; $n=@$_GET['n']; $t=@$_GET['t']; + $time=@$_GET['time']; $q=mysqli_query($con, "SELECT score FROM history WHERE eid='$eid' AND email='$email'")or die('Error156'); while ($row=mysqli_fetch_array($q)) { $s=$row['score']; @@ -198,7 +200,7 @@ } $sun=$sun-$s; $q=mysqli_query($con, "UPDATE `rank` SET `score`=$sun ,time=NOW() WHERE email= '$email'")or die('Error174'); - header("location:account.php?q=quiz&step=2&eid=$eid&n=1&t=$t"); + header("location:account.php?q=quiz&step=2&eid=$eid&n=1&t=$t&time=$time"); } @@ -206,8 +208,3 @@ -// If Time is Up -if (@$_GET['q']== 'quiz' && @$_GET['step']== 2 && @$_GET['time_up']== 1) { - echo "Good Morning"; - -} From ddbe37fd926f22acc3e6d168c0d57b4e9f9ab780 Mon Sep 17 00:00:00 2001 From: chandachewe10 Date: Tue, 27 Sep 2022 13:53:55 +0100 Subject: [PATCH 3/4] Time up for all questions --- account.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/account.php b/account.php index 6fa0a17..19ed37f 100755 --- a/account.php +++ b/account.php @@ -121,8 +121,14 @@ From 48d193a94f2cdda57134eed2184f1c3793aad8d1 Mon Sep 17 00:00:00 2001 From: chandachewe10 Date: Tue, 27 Sep 2022 15:21:58 +0100 Subject: [PATCH 4/4] Time up for all questions --- account.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/account.php b/account.php index 19ed37f..2343a42 100755 --- a/account.php +++ b/account.php @@ -125,10 +125,9 @@ var startQuiz = urlParams.get('step'); var status = urlParams.get('q'); - if(startQuiz == 2){ - + - var time = 40; //Math.round(duration*60); + var time = //Math.round(duration*60); var saved_countdown = localStorage.getItem('saved_countdown'); @@ -168,7 +167,7 @@ } }, 1000); - } +