if isset _GET test if isset _GET number toCheck _GET number -2 if _GET

 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
if (isset($_GET['test'])) {
if (isset($_GET['number'])) {
$toCheck = $_GET['number']-2;
if ($_GET['number'] == '11') {
if ($_GET['answer'] == '1') {
if ($_SESSION['questions'][$toCheck][1] == 'true') $_SESSION['correctAnswers']++;
} elseif ($_GET['answer'] == '0') {
if ($_SESSION['questions'][$toCheck][1] == 'false') $_SESSION['correctAnswers']++;
} else {
header('location: 404');
}
$correctAnswers = $_SESSION['correctAnswers'];
session_destroy();
$finish = true;
} else {
$toAsk = $_GET['number']-1;
if ($_GET['number'] > 1) $toCheck = $_GET['number']-2;
else $toCheck = false;
$askOk = true;
if (isset($_GET['answer'])) {
if ($_GET['answer'] == '1') {
if ($_SESSION['questions'][$toCheck][1] == 'true') $_SESSION['correctAnswers']++;
} elseif ($_GET['answer'] == '0') {
if ($_SESSION['questions'][$toCheck][1] == 'false') $_SESSION['correctAnswers']++;
} else {
header('location: 404');
}
}
}
}
}