Example #1
0
                <div class="col-xs-8 col-sm-8 col-md-8 col-lg-10 scrollit">
                    <div class="panel-group" id="accordion">
                    <?php 
global $questions_html;
echo $questions_html;
?>
                                             
                    </div>
                </div>
                <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 fixed " style="font-family: 'Titillium Web', sans-serif;">
                    <div class="row ">
                        <div class="well well-sm">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <b>Welcome!! <?php 
echo get_test_username();
?>
</b>
                                </div>
                                <div class="panel-body">
                                    <p>Questions Answered : <ans id="answered_questions" >0</ans></p>
                                    <p>Questions Unanswered : <unans id="unanswered_questions">
                                    <?php 
global $questions_array;
echo $questions_array["number_of_questions"];
?>
</p>                                     
                                </div>
                            </div>
                        </div>
                    </div>
Example #2
0
<?php

require_once "../includes/db_connect.php";
require_once "../includes/functions.php";
require_once "../includes/session.php";
$test_name = get_test_name();
$test_user_name = get_test_username();
if (is_null($test_name) || is_null($test_user_name)) {
    $_SESSION["message_test_time_not_correct"] = "You are logged out and test has endend. :P";
    redirect_to("../tests/error.php");
}
$file = fopen("../tests/" . $test_name . "/" . $test_user_name . ".txt", "wb");
$content_to_write = "";
// calculate the result
$number_of_questions = $_COOKIE[md5("number_of_questions")];
$score = 0;
$number_of_correct_ans = 0;
$number_of_wrong_ans = 0;
$number_of_unattempted_questions = 0;
$data_to_write = "";
$correct_ans = "";
$marks = "";
for ($i = 1; $i <= $number_of_questions; $i++) {
    $your_ans = "";
    $correct_ans = $_COOKIE[md5("correct_ans" . $i)];
    if (isset($_COOKIE[$i])) {
        $user_response = md5($_COOKIE[$i]);
        $marks = $_COOKIE[md5("marks" . $i)];
        $negative_marks = $_COOKIE[md5("negative_marks" . $i)];
        $your_ans = $_COOKIE[$i];
        if (strcmp($correct_ans, $user_response) == 0) {