-
Notifications
You must be signed in to change notification settings - Fork 0
/
pro.php
38 lines (27 loc) · 950 Bytes
/
pro.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
<?php
include ('data.php');
session_start();
$score=0;
$ansuser=$_POST['answer']; /* If a user answers a question, it compares with a value in the database and a value is added...*/
$trutable=$_POST['questionid'];
$tru_ans=mysqli_query($con,"select * from javab where questionid=$trutable AND trueans=1");
$tru_answer=mysqli_fetch_assoc($tru_ans);
$t_user=$tru_answer['id'];
if($t_user==$ansuser){
$_SESSION ['score']++;
}
else{
$_SESSION['score']--;
}
$co = mysqli_query($con, "select * from soal "); /* If the number of questions sent by the user
is more than the number of questions in the database, you
will see the final page and scores. */
$numquestion = mysqli_num_rows($co);
$d = $_POST['questionid'];
$d++;
if ($d > $numquestion) {
header('location: final.php');
} else {
header("location: 121.php?z=$d");
}
?>