Example #1
0
    		//exit();
    	} */
}
?>
<html>
<header>
</header>
<body>
<?php 
/* print("question_count=".question_count($quiz_id));
	print(" ");
	print("questions done=".count($_SESSION['quiz_tally_array']));
	print(" ");
	print("questionID=".$_SESSION['questionID']); */
$count = question_count($quiz_id);
if (count($_SESSION['quiz_tally_array']) + 1 < question_count($quiz_id)) {
    get_quiz_question($prevQuestionID);
    $_SESSION['last_id']++;
    if (isset($_POST['choice'])) {
        $choice = $_POST['choice'];
        $correct = is_correct($choice);
        array_push($_SESSION['quiz_tally_array'], $correct);
        /* print("");
        			print_r($_POST);
        			print("");
        			var_dump($_SESSION); */
    }
} else {
    if (isset($_POST['choice'])) {
        array_push($_SESSION['quiz_tally_array'], is_correct($_POST['choice']));
    }
Example #2
0
    }
    $_SESSION['lastQuestion'] = $qid;
    /* print_r($_SESSION['qid_array']); */
}
include 'core/init.php';
$response = "";
/* print_r($_SESSION['answer_array']); */
if (isset($_POST['complete'])) {
    echo "ITS SET!";
}
if (!isset($_SESSION['answer_array']) || count($_SESSION['answer_array']) < 1) {
    $response = "You have not answered any questions yet";
    echo $response;
    exit;
} else {
    $count = question_count();
    /* $countCheck = mysql_query("SELECT id FROM questions")or die(mysql_error());
    		$count = mysql_num_rows($countCheck); */
    $numCorrect = 0;
    foreach ($_SESSION['answer_array'] as $current) {
        if ($current == 1) {
            $numCorrect++;
        }
    }
    $percent = $numCorrect / $count * 100;
    $percent = intval($percent);
    if (isset($_POST['complete']) && $_POST['complete'] == "true") {
        if (!isset($_POST['username']) || $_POST['username'] == "") {
            echo "Sorry, We had an error";
            exit;
        }