T201704210853
This commit is contained in:
@@ -15,6 +15,7 @@ class Question
|
||||
private $answers;
|
||||
private $category_id;
|
||||
private $category;
|
||||
private $token;
|
||||
|
||||
function __construct($db, $uid, $qid) {
|
||||
$question_details = $db->query('SELECT "question", "answer0", "answer1", "answer2", "answer3", "Categories_ID"
|
||||
@@ -34,6 +35,8 @@ class Question
|
||||
$this->category = $c;
|
||||
$db->query('UPDATE "Games" SET "current_right_answer" = $1, "current_category" = $2 WHERE "ID" = $3',
|
||||
array($ca_position, $cid, $uid));
|
||||
$this->token = md5(uniqid(rand(), true));
|
||||
$db->query('UPDATE "Games" SET "current_token" = $1 WHERE "ID" = $2', array($this->token, $uid));
|
||||
}
|
||||
|
||||
public static function get_next_question($db, $uid) {
|
||||
@@ -51,7 +54,8 @@ class Question
|
||||
'categoryID' => $this->category_id,
|
||||
'categoryName' => $this->category,
|
||||
'question' => $this->question,
|
||||
'answers' => $this->answers
|
||||
'answers' => $this->answers,
|
||||
'token' => $this->token
|
||||
);
|
||||
return $question_object;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user