';
+ //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']) {
+ echo "";
+ $eid=@$_GET['eid'];
+ $q=mysqli_query($con, "SELECT * FROM history WHERE eid='$eid' AND email='$email' ")or die('Error157');
+ echo '
';
-}
-$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 '
';
-
+ }
+ $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 '
S.N.
Quiz
Question Solved
Right
Wrong
Score
';
-$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'
';
+ $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 '
Rank
Name
Gender
College
Score
';
-$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.'
';
+ $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/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 9cac8f3..44ddff7 100755
--- a/update.php
+++ b/update.php
@@ -1,224 +1,210 @@
+
+
+
+
+