PHP Classes

PHP Quiz Application: Show quizzes using questions read from an INI file

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 73 All time: 10,232 This week: 54Up
Version License PHP version Categories
quizgenerator 1.0Freeware5PHP 5, Content management, Applications
Description 

Author

This class can show quizzes using questions read from an INI file.

It can scan a directory with INI files that define the questions of the quiz.

It provides a page showing the available quizzes and links to the respective pages.

The class can show the question and possible answers in each quiz page as links to the quiz question result page.

It can also display a page showing if the user picked the right answer to a quiz.

Picture of Martijn Waeyenbergh
  Performance   Level  
Name: Martijn Waeyenbergh <contact>
Classes: 7 packages by
Country: Belgium Belgium
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Example

<?php
   
require_once("class.quiz.php");
   
$quiz = new quiz();

    if(!isset(
$_GET['quiz']) && !empty($_GET['quiz'])){
       
header("Location:index.php");
    }

    if(!isset(
$_SESSION['round'])){
       
$_SESSION['round'] = 1;
    }

    if(!isset(
$_SESSION['quiz'])){
       
$_SESSION['quiz'] = $_GET['quiz'];
    }

    if(!isset(
$_SESSION['score'])){
       
$_SESSION['score'] = 0;
    }

   
/*echo "<pre>";
    print_r($_SESSION);
    echo "</pre>";
    $quiz = parse_ini_file("./quizes/" . $_SESSION['quiz'], true);
    echo "<pre>";
    print_r($quiz);
    echo "</pre>";*/

?>
<!DOCTYPE html>
<html>
<head>
    <title>Quiz : <?php echo $quiz->prettyName($_GET['quiz']) ?></title>
    <link rel="stylesheet" type="text/css" href="./css/style.css">
</head>
<body>
    <div class='wrapper'>
        <h1><?= $quiz->prettyName($_GET['quiz']) ?></h1>
        <hr>
        <?= $quiz->toonvraag(); ?>
<hr style='clear:both;'>
        <a href='index.php'>Back to Quiz Selector</a>
    </div>
</body>
</html>


  Files folder image Files (7)  
File Role Description
Files folder imagecss (1 file)
Files folder imagequizes (2 files)
Accessible without login Plain text file answer.php Example answer
Plain text file class.quiz.php Class quiz class
Accessible without login Plain text file index.php Example index
Accessible without login Plain text file start.php Example start

  Files folder image Files (7)  /  css  
File Role Description
  Accessible without login Plain text file style.css Data stylesheet

  Files folder image Files (7)  /  quizes  
File Role Description
  Accessible without login Plain text file General_knowledge.ini Data QuizExpamle1
  Accessible without login Plain text file Modern_history.ini Data QuizExpamle2

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:73
This week:0
All time:10,232
This week:54Up