PHP Classes

File: start.php

Recommend this page to a friend!
  Classes of Martijn Waeyenbergh   PHP Quiz Application   start.php   Download  
File: start.php
Role: Example script
Content type: text/plain
Description: start
Class: PHP Quiz Application
Show quizzes using questions read from an INI file
Author: By
Last change:
Date: 9 months ago
Size: 954 bytes
 

Contents

Class file image Download
<?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>