Example #1
0
        $_SESSION['quiz']['score'] += 10;
        echo 'Correct answer!!';
    } else {
        $ansArr = explode(';', $answer['answers']);
        echo "Wrong answer!! \n Correct Answer : " . $ansArr[$answer['correct_answer']];
    }
    exit;
} else {
    if ($_REQUEST['action'] == 'manage_user') {
        array_walk($_POST, 'escapeString');
        $user_id = $model->updateUser($_POST);
        if ($_SESSION['quiz']['user_id'] > 0) {
            //if user already logged in,then its score is already added on submit quiz action
        } else {
            $_SESSION['quiz']['user_id'] = $user_id;
            $model->addScore($user_id, $_SESSION);
            echo 'Your name will now show in ranking. Thanks!!';
        }
        exit;
    } else {
        if ($_REQUEST['action'] == 'joker_used') {
            $question_id = $_POST['id'];
            $_SESSION['quiz']['joker_used'] += 1;
            echo $_SESSION['quiz']['joker_used'];
            exit;
        } else {
            if ($_REQUEST['action'] == 'next_question') {
                $setQz = setQuiz();
                $last_question = $setQz[0];
                $question = $setQz[1];
                require_once $dir . 'html/quiz.php';
Example #2
0
 /**
  * Declares an association between this object and a Model object.
  *
  * @param      Model $v
  * @return     Score The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setModel(Model $v = null)
 {
     if ($v === null) {
         $this->setModelId(NULL);
     } else {
         $this->setModelId($v->getId());
     }
     $this->aModel = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Model object, it will not be re-added.
     if ($v !== null) {
         $v->addScore($this);
     }
     return $this;
 }