<html> <head> <style> body { background-image: url("real.jpg"); } .row { font-size: 20px; } </style> </head> <?php $answers = \App\answer::where('author_id', '=', $_SESSION["user"])->get(); $values = []; $k = 0; foreach ($answers as $answer) { $values[$k] = $answer->ques_id; $k++; } $question = \App\question::where('author', '!=', $_SESSION["user"])->whereNotIn('id', $values)->get(['id', 'question', 'opt1', 'opt2', 'opt3', 'opt4', 'points']); echo ' <div class="jumbotron"> <div class="container"> <h1>THE OFFICIAL QUIZ PAGE</h1> <p>The questions present below are the questions submitted by other users. </p> <p>The users have two options. Either they can play the quiz or they can submit a question of their own. </p> <p>The user score will be updated and stored dynamically. </p> <p>So what are you waiting for? Go Ahead. GOOD LUCK </p>
public function display($id) { //echo ($id); $id = urldecode($id); $question = question::where('question', $id)->get()->first(); $topic = topic::where('id', $question->topic_id)->get()->first(); $answer = answer::where('question', $id)->get(); if ($answer !== null) { $name = DB::select('select name, users.id,answer, question, preffered, upvoted , downvoted from users inner join answers on users.id=answers.user_id'); return view('show.answer', compact('question', 'topic', 'name')); // return $answer; } else { return view('show.answer', compact('question', 'topic')); } //return $id; }
$signinurl = ""; $login = "******"; $loginurl = url("logout"); $login_failure = 0; } } if ($login_failure) { echo ' <script> window.location="' . url("/") . '"; </script> '; } else { include 'navbar.php'; $answer = \App\answer::where('ques_id', '=', $quesid)->where('author_id', '=', $_SESSION["user"])->get(); if (count($answer)) { echo ' <div class="row"> <div class="col-sm-2 col-xs-2 " ></div> <div class="alert alert-info col-sm-8 col-xs-8 text-center" > <strong>Question you are trying to answer is already answered</strong></div> </div>'; } else { $question = \App\question::where('id', '=', $quesid)->first(); if ($ans == $question->correct) { echo ' <div class="row"> <div class="col-sm-2 col-xs-2 " ></div> <div class="alert alert-success col-sm-12 col-xs-8 text-center" > <strong>Right Answer! ' . $question->points . ' points added to your score.</strong></div> <div class="alert alert-success col-sm-12 col-xs-8 text-center" > <strong>Keep going. Continue the same form.</strong></div> </div>';