Ejemplo n.º 1
0
<?php

session_start();
require './shared_methods_and_data.php';
echo "<html><head>";
echo "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\">";
echo "</head>";
echo "<body>";
$my_result = get_user_result($_SESSION["user_name"]);
if ($my_result == $winner_score) {
    echo "<img src = \"http://dl.dropbox.com/u/12312508/New%20Bitmap%20Image.bmp\" />";
    echo "You WON! Take the above QR code to get your Prize :)";
} else {
    echo "You lost this competition. Try your luck next game!";
}
echo "</body>";
echo "</html>";
Ejemplo n.º 2
0
if ($current_question[0] == "WAIT") {
    //In this case, the time of availability of the next question will be the second element(index 1)
    //in the current question array
    $time_left = $current_question[1] - time() - 1;
    echo 'Score : ' . get_user_result($_SESSION['user_name']) . "<br />";
    echo $_SESSION['last_answer'];
    echo "<br />";
    echo " <p>Please wait <div id=\"timer_display\"></div> seconds until the next question becomes available!</p>";
    echo "<script>setTimeout(\"timer(" . $time_left . ")\",1000); </script> ";
} elseif ($current_question[0] == "ENDED") {
    echo "<script type=\"text/javascript\"> window.location.href=\"display_results.php\";</script>";
} else {
    echo "<table width=\"100%\" height=\"100%\">";
    echo "<tr height=\"10%\"><td>";
    echo "<p align=\"center\"> ";
    echo 'Score : ' . get_user_result($_SESSION['user_name']) . "<br />";
    echo $_SESSION['last_answer'];
    echo "<br />";
    $_SESSION['current_question'] = $current_question[0];
    echo "</p>";
    echo "</td></tr>";
    echo "<tr height=\"40%\"><td>";
    echo "<p align=\"center\"> " . $current_question[0] . "</p>";
    echo "</td></tr>";
    echo "<tr height=\"16%\" width=\"100%\"><td>";
    echo "<a href=\"javascript:send_answer('" . $current_question[1] . "')\" class=\"button orange\">" . $current_question[1] . "</a>";
    echo "</td></tr>";
    echo "<tr height=\"16%\"><td>";
    echo "<a href=\"javascript:send_answer('" . $current_question[2] . "')\" class=\"button orange\"> " . $current_question[2] . "</a>";
    echo "</td></tr>";
    echo "<tr height=\"18%\"><td>";
function add_points_for_user($user_name)
{
    //Import variables
    global $sql_user_name;
    global $sql_password;
    global $db_name;
    global $results_table;
    global $questions_table;
    global $init_result;
    global $question_validity_time;
    global $points_per_question;
    update_sql_table($results_table, "user_name", $user_name, "user_result", get_user_result($user_name) + $points_per_question);
}