PHP Classes

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

Recommend this page to a friend!
  Info   View files Example   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-12-19 (5 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 70 All time: 10,268 This week: 84Up
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
Age: 44
All time rank: 311617 in Belgium Belgium
Week rank: 311 Up3 in Belgium Belgium Up
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  
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  /  css  
File Role Description
  Accessible without login Plain text file style.css Data stylesheet

  Files folder image Files  /  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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:70
This week:0
All time:10,268
This week:84Up