<?php require "inc/functions.php"; autoLoader(); $questions = getAllQuestions(); if (!isQuizStarted()) { //ilk çalıştırma, oturumu başlat startQuiz(count($questions)); } // cevap geldiyse // cevabı kontrol et, değerleri artır if (isset($_POST['answer'])) { if ($_POST['answer'] == $questions[$_SESSION['answeredQuestionCount']]['answer']) { // cevap doğru, işlem yap $_SESSION['correctAnswerCount']++; } $_SESSION['answeredQuestionCount']++; } // sıradaki soruyu seç, göster // son soru görüntüleniyorsa // butonun metnini değiştir if ($_SESSION['answeredQuestionCount'] == $_SESSION['totalQuestionCount'] - 1) { $btnText = "Testi Bitir"; } else { $btnText = "Sonraki Soru"; } // tüm sorular yanıtlandıysa // testi bitir, sonuca yönlendir if ($_SESSION['answeredQuestionCount'] == $_SESSION['totalQuestionCount']) { if (empty($_SESSION['finishTime'])) { $_SESSION['finishTime'] = time();
<?php require "inc/functions.php"; autoLoader(); if (isQuizStarted()) { redirectTo("quiz"); } $questions = getAllQuestions(); include 'inc/header.php'; ?> <div class="well text-center"> <h1>QUIZ</h1> <h3>#lyk2015 PHP - Quiz Projesi</h3> <p>Karşınıza <span class="badge success"><?php echo count($questions); ?> </span> soru gelecek ve sonuçta başarı puanınızı göreceksiniz.</p> <a href="quiz.php" class="btn btn-primary btn-lg">Sınava Başla</a> </div> <?php include 'inc/footer.php';