示例#1
0
require '../modules/variables.php';
if (isset($_GET['id'])) {
    // check if id is empty
    if ($_GET['id'] == "") {
        // tell user it is invalid
        $url_id = 0;
    } else {
        // give the real id
        $url_id = $_GET['id'];
    }
} else {
    // tell user id is missing
    $url_id = 0;
}
$quiz = new Quiz($url_id);
$quiz_state = $quiz->exists();
if ($quiz_state) {
    ?>
<title>Quizroo Quiz: <?php 
    echo $quiz->quiz_name;
    ?>
</title>
<meta property="og:title" content="<?php 
    echo $quiz->quiz_name;
    ?>
" />
<meta property="og:type" content="article" />
<meta property="og:image" content="<?php 
    echo $VAR_URL . "quiz_images/imgcrop.php?w=50&amp;h=50&amp;f=" . $quiz->quiz_picture;
    ?>
" /> 
示例#2
0
<?php

require '../modules/quizrooDB.php';
require '../modules/uploadFunctions.php';
require "../modules/quiz.php";
if (isset($_GET['step'])) {
    // now check whether this quiz actually belongs to this user
    if (isset($_GET['id'])) {
        $quiz = new Quiz($_GET['id']);
        if ($quiz->exists() && $quiz->isOwner($member->id)) {
            $quiz_state = true;
            // unpublish the quiz
            $quiz->unpublish($member->id);
            $unikey = $quiz->quiz_key;
        } else {
            $quiz_state = false;
            unset($quiz);
        }
    } else {
        $quiz_state = false;
        unset($quiz);
    }
    if ($quiz_state) {
        // THE FIRST STEP (Returning): Quiz Information
        switch ($_GET['step']) {
            case 1:
                // populate the categories
                $query_listCat = "SELECT cat_id, cat_name FROM q_quiz_cat";
                $listCat = mysql_query($query_listCat, $quizroo) or die(mysql_error());
                $row_listCat = mysql_fetch_assoc($listCat);
                $totalRows_listCat = mysql_num_rows($listCat);
    }
} else {
    // attempt to extract the other id parameter
    $url_vars = explode('&', $_SERVER["QUERY_STRING"]);
    $url_id = 0;
    foreach ($url_vars as $test_id) {
        if (is_numeric($test_id)) {
            $url_id = $test_id;
            break;
        }
    }
}
$valid = false;
$quiz = new Quiz($url_id);
// check if quiz exists
if ($quiz->exists()) {
    // check if quiz has questions!
    if ($quiz->numQuestions() > 0) {
        $valid = true;
    } else {
        $valid = false;
    }
}
if (!$valid) {
    if ($quiz->exists()) {
        header("Location: previewQuiz.php?id=" . $quiz->quiz_id);
    } else {
        header("Location: previewQuiz.php");
    }
} else {
    ?>
<?php

require "inc/header-php.php";
require "../modules/quiz.php";
require '../modules/variables.php';
$quiz = new Quiz($_POST['quiz_id']);
if (!$quiz->exists()) {
    header("Location: previewQuiz.php");
} else {
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<![if !IE]><html xmlns="http://www.w3.org/1999/xhtml"><![endif]>
<!--[if lt IE 9]><html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"><![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Quizroo: <?php 
    echo $quiz->quiz_name;
    ?>
</title>
<?php 
    include "inc/header-css.php";
    ?>
<link href="css/quiz.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="fb-root"></div>
<?php 
    include "../modules/statusbar.php";
    include "../modules/resultEngine.php";
    include "inc/footer-js.php";
示例#5
0
<?php
require('../modules/quizrooDB.php'); 
require('../modules/quiz.php');

// check whether such a quiz exists
$quiz = new Quiz($_GET['id']);

if($quiz->exists()){
	// check if member is the owner of this quiz
	if($quiz->isOwner($member->id)){
		// prepare the formatted status
		switch($quiz->isPublished){
			case 0: $status = '<span class="draft">Unpublished Draft</span>'; break;
			case 1: $status = '<span class="published">Published</span>'; break;
			case 2: $status = '<span class="modified">Unpublished Modification</span>'; break;
			case 3: $status = '<span class="archived">Archived</span>'; break;
			default: $status = 'Limbo :/'; break;
		}
		
		// get average options
		// check the number of questions
		$numQuestions = $quiz->getQuestions("count");
		// check the number of options
		$listQuestion = explode(',', $quiz->getQuestions());
		$totalOptions = 0;
		
		if($numQuestions != 0){
			$questionState = true;
			$optionState = true;
			foreach($listQuestion as $question){
				// check the number of options for this question