-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathquestion.php
27 lines (26 loc) · 941 Bytes
/
question.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
<?php
header("Content-Type: text/html; charset=utf-8");
require("server.php");
$data = getData();
if ($data["stage"] === 0)
header("Location:index.php");
//Define user
$user = $data["users"][$_GET["user"]];
//Get all questions
$questions = getQuestions();
//Check for the last question
if ($user["currentQuestion"] == count($questions))
{
//Go to the last page if user passed through all question
header("Location:wait.php?user=".$_GET["user"]."&message=вы%20ответили%20на%20все%20вопросы,<br>набрав%20".$user["score"]."%20балл(а/ов).&stage=2");
return;
}
//Get needed question
$questionText = $questions[$user["questions"][$user["currentQuestion"]]]["text"];
//Send question text
echo "<script>var questionText=\"".$questionText."\";";
//Send user's id
echo "var user=\"".$_GET["user"]."\";</script>";
include("view/question/frame.html");
include("jsconnections.html");
?>