Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 35

Website Title :- Quiz_master Roll No :- 280

 File name :- Admin.php

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280

<?php

session_start();

include "connection.php";

if (isset($_SESSION['admin'])) {

header("location: adminhome.php");

if (isset($_POST['password'])) {

$password = mysqli_real_escape_string($conn , $_POST['password']);

$adminpass = '$2y$10$8WkSLFcoaqhJUJoqjg3K8eWixJWswsICf7FTxehKmx8hpmIKYWqju';

if (password_verify($password , $adminpass)) {

$_SESSION['admin'] = "active";

header("Location: adminhome.php");

else {

echo "<script> alert('wrong password');</script>";

?>

<html>

<head>

<title>PHP Quiz</title>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<link rel="stylesheet" type="text/css" href="css/style.css">

</head>

<body>

<header>

<div class="container">

<h1>PHP Quiz</h1>

<a href="index.php" class="start">Home</a>

</div>

</header>

<main>

<div class="container">

<h2>Enter Password</h2>

<form method="POST" action="">

<input type="password" name="password" required="" >

<input type="submit" name="submit" value="send">

</div>

</main>

<footer>

<div class="container">

Made By Ansh Ramani

</div>

</footer>

</body>

</html>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280

 File name :- Index.php

<?php

session_start();

include "connection.php";

?>

<?php

if (isset($_SESSION['id'])) {

header("location: home.php");

?>

<?php

if (isset($_POST['email'])) {

$email = mysqli_real_escape_string($conn , $_POST['email']);

if (filter_var($email, FILTER_VALIDATE_EMAIL)) {

$checkmail = "SELECT * from users WHERE email = '$email'";

$runcheck = mysqli_query($conn , $checkmail) or die(mysqli_error($conn));

if (mysqli_num_rows($runcheck) > 0) {

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
$played_on = date('Y-m-d H:i:s');

$update = "UPDATE users SET played_on = '$played_on' WHERE email = '$email' ";

$runupdate = mysqli_query($conn , $update) or die(mysqli_error($conn));

$row = mysqli_fetch_array($runcheck);

$id = $row['id'];

$_SESSION['id'] = $id;

$_SESSION['email'] = $row['email'];

header("location: home.php");

else {

$played_on = date('Y-m-d H:i:s');

$query = "INSERT INTO users(email,played_on) VALUES ('$email','$played_on')";

$run = mysqli_query($conn, $query) or die(mysqli_error($conn)) ;

if (mysqli_affected_rows($conn) > 0) {

$query2 = "SELECT * FROM users WHERE email = '$email' ";

$run2 = mysqli_query($conn , $query2) or die(mysqli_error($conn));

if (mysqli_num_rows($run2) > 0) {

$row = mysqli_fetch_array($run2);

$id = $row['id'];

$_SESSION['id'] = $id;

$_SESSION['email'] = $row['email'];

header("location: home.php");

else {

echo "<script> alert('something is wrong'); </script>";

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
else {

echo "<script> alert('Invalid Email'); </script>";

}}

?>

<html>

<head>

<title>PHP-Quiz</title>

<link rel="stylesheet" type="text/css" href="css/style.css">

</head>

<body>

<header>

<div class="container">

<h1>PHP-Quiz</h1>

<a href="index.php" class="start">Home</a>

<a href="admin.php" class="start">Admin Panel</a>

</div> </header>

<main>

<div class="container">

<h2>Enter Your Email</h2>

<form method="POST" action="">

<input type="email" name="email" required="" >

<input type="submit" name="submit" value="PLAY NOW">

</div>

</main>

<footer>

<div class="container">

Made by Ansh Ramani

</div> </footer> </body> </html>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280

 File name :- adminhome.php

<?php

session_start();

if (isset($_SESSION['admin'])) {

?>

<!DOCTYPE html>

<html>

<head>

<title>PHP-Quiz</title>

<link rel="stylesheet" type="text/css" href="css/style.css">

</head>

<body>

<header>

<div class="container">

<h1>PHP-Quiz</h1>

<a href="index.php" class="start">Home</a>

<a href="add.php" class="start">Add Question</a>

<a href="allquestions.php" class="start">All Questions</a>

<a href="players.php" class="start">Players</a>

<a href="exit.php" class="start">Logout</a>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
</div>

</header>

<main>

<div class="container">

<h2>Welcome back, Admin</h2>

</div> </main> </body> </html>

<?php }

else {

header("location: admin.php");

?>

 File name :- add.php

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<?php session_start(); ?>

<?php include "connection.php";

if (isset($_SESSION['admin'])) {

if(isset($_POST['submit'])) {

$question =htmlentities(mysqli_real_escape_string($conn , $_POST['question']));

$choice1 = htmlentities(mysqli_real_escape_string($conn , $_POST['choice1']));

$choice2 = htmlentities(mysqli_real_escape_string($conn , $_POST['choice2']));

$choice3 = htmlentities(mysqli_real_escape_string($conn , $_POST['choice3']));

$choice4 = htmlentities(mysqli_real_escape_string($conn , $_POST['choice4']));

$correct_answer = mysqli_real_escape_string($conn , $_POST['answer']);

$checkqsn = "SELECT * FROM questions";

$runcheck = mysqli_query($conn , $checkqsn) or die(mysqli_error($conn));

$qno = mysqli_num_rows($runcheck) + 1;

$query = "INSERT INTO questions(qno, question , ans1, ans2, ans3, ans4, correct_answer) VALUES
('$qno' , '$question' , '$choice1' , '$choice2' , '$choice3' , '$choice4' , '$correct_answer') " ;

$run = mysqli_query($conn , $query) or die(mysqli_error($conn));

if (mysqli_affected_rows($conn) > 0 ) {

echo "<script>alert('Question successfully added'); </script> " ;

else {

"<script>alert('error, try again!'); </script> " ;

?>

<!DOCTYPE html>

<html>

<head>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<title>PHP-Quiz</title>

<link rel="stylesheet" type="text/css" href="css/style.css">

</head>

<body>

<header>

<div class="container">

<h1>PHP-Quiz</h1>

<a href="index.php" class="start">Home</a>

<a href="add.php" class="start">Add Question</a>

<a href="allquestions.php" class="start">All Questions</a>

<a href="players.php" class="start">Players</a>

<a href="exit.php" class="start">Logout</a>

</div>

</header>

<main>

<div class="container">

<h2>Add a question...</h2>

<form method="post" action="">

<p>

<label>Question</label>

<input type="text" name="question" required="">

</p>

<p>

<label>Choice #1</label>

<input type="text" name="choice1" required="">

</p>

<p>

<label>Choice #2</label>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<input type="text" name="choice2" required="">

</p>

<p>

<label>Choice #3</label>

<input type="text" name="choice3" required="">

</p>

<p>

<label>Choice #4</label>

<input type="text" name="choice4" required="">

</p>

<p>

<label>Correct answer</label>

<select name="answer">

<option value="a">Choice #1 </option>

<option value="b">Choice #2</option>

<option value="c">Choice #3</option>

<option value="d">Choice #4</option>

</select>

</p>

<p>

<input type="submit" name="submit" value="Submit">

</p>

</form> </div> </main> </body> </html>

<?php }

else {

header("location: admin.php");

?>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280

 File name :- all_questions.php

<?php session_start(); ?>

<?php include "connection.php";

if (isset($_SESSION['admin'])) {

?>

<!DOCTYPE html>

<html>

<head>

<title>PHP-Quiz</title>

<link rel="stylesheet" type="text/css" href="css/style.css">

<link rel="stylesheet" type="text/css" href="css/style1.css">

</head>

<body>

<header>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<div class="container">

<h1>PHP-Quiz</h1>

<a href="index.php" class="start">Home</a>

<a href="add.php" class="start">Add Question</a>

<a href="allquestions.php" class="start">All Questions</a>

<a href="players.php" class="start">Players</a>

<a href="exit.php" class="start">Logout</a>

</div>

</header>

<h1> All Questions</h1>

<table class="data-table">

<caption class="title">All Quiz questions</caption>

<thead>

<tr>

<th>Q.NO</th>

<th>Question</th>

<th>Option1</th>

<th>Option2</th>

<th>Option3</th>

<th>Option4</th>

<th>Correct Answer </th>

<th>Edit</th>

</tr> </thead> <body>

<?php

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
$query = "SELECT * FROM questions ORDER BY qno DESC";

$select_questions = mysqli_query($conn, $query) or die(mysqli_error($conn));

if (mysqli_num_rows($select_questions) > 0 ) {

while ($row = mysqli_fetch_array($select_questions)) {

$qno = $row['qno'];

$question = $row['question'];

$option1 = $row['ans1'];

$option2 = $row['ans2'];

$option3 = $row['ans3'];

$option4 = $row['ans4'];

$Answer = $row['correct_answer'];

echo "<tr>";

echo "<td>$qno</td>";

echo "<td>$question</td>";

echo "<td>$option1</td>";

echo "<td>$option2</td>";

echo "<td>$option3</td>";

echo "<td>$option4</td>";

echo "<td>$Answer</td>";

echo "<td> <a href='editquestion.php?qno=$qno'> Edit </a></td>";

echo "</tr>";

?>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
</tbody>

</table>

</body>

</html>

<?php }

else {

header("location: admin.php");

?>

 File name :- players.php

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<?php session_start(); ?>

<?php include "connection.php";

if (isset($_SESSION['admin'])) {

?>

<!DOCTYPE html>

<html>

<head>

<title>PHP-Quiz</title>

<link rel="stylesheet" type="text/css" href="css/style.css">

<link rel="stylesheet" type="text/css" href="css/style1.css">

</head>

<body>

<header>

<div class="container">

<h1>PHP-Quiz</h1>

<a href="index.php" class="start">Home</a>

<a href="add.php" class="start">Add Question</a>

<a href="allquestions.php" class="start">All Questions</a>

<a href="players.php" class="start">Players</a>

<a href="exit.php" class="start">Logout</a>

</div>

</header>

<h1> All Players</h1>

<table class="data-table">

<caption class="title">All Quiz players</caption>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<thead>

<tr>

<th>Player Id</th>

<th>Email</th>

<th>Played On</th>

<th>Score</th>

</tr>

</thead>

<tbody>

<?php

$query = "SELECT * FROM users ORDER BY played_on DESC";

$select_players = mysqli_query($conn, $query) or die(mysqli_error($conn));

if (mysqli_num_rows($select_players) > 0 ) {

while ($row = mysqli_fetch_array($select_players)) {

$id = $row['id'];

$email = $row['email'];

$played_on = $row['played_on'];

$score = $row['score'];

echo "<tr>";

echo "<td>$id</td>";

echo "<td>$email</td>";

echo "<td>$played_on</td>";

echo "<td>$score</td>";

echo "</tr>";

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
}

?>

</tbody> </table> </body> </html>

<?php }

else {

header("location: admin.php");

?>

 File name :- home.php

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<?php

session_start();

include "connection.php";

if (isset($_SESSION['id'])) {

$query = "SELECT * FROM questions";

$run = mysqli_query($conn , $query) or die(mysqli_error($conn));

$total = mysqli_num_rows($run);

?>

<html>

<head>

<title>PHP-Quiz</title>

<link rel="stylesheet" type="text/css" href="css/style.css">

</head>

<body>

<header>

<div class="container">

<h1>PHP-Quiz</h1>

</div>

</header>

<main>

<div class="container">

<h2>Welcome to PHP Quiz !</h2>

<p>This is just a simple quiz game to test your knowledge!</p>

<ul>

<li><strong>Number of questions: </strong><?php echo $total; ?></li>

<li><strong>Type: </strong>Multiple Choice</li>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<li><strong>Estimated time for each question: </strong><?php echo $total
* 0.05 * 60; ?> seconds</li>

<li><strong>Score: </strong> &nbsp; +1 point for each correct


answer</li>

</ul>

<a href="question.php?n=1" class="start">Start Quiz</a>

<a href="exit.php" class="add">Exit</a>

</div>

</main>

<footer>

<div class="container">

Made by Ansh Ramani

</div> </footer> </body> </html>

<?php unset($_SESSION['score']); ?>

<?php }

else {

header("location: index.php");

?>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280

 File name :- question.php

<?php

session_start();

include "connection.php";

if (isset($_SESSION['id'])) {

if (isset($_GET['n']) && is_numeric($_GET['n'])) {

$qno = $_GET['n'];

if ($qno == 1) {

$_SESSION['quiz'] = 1;

else {

header('location: question.php?n='.$_SESSION['quiz']);

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
}

if (isset($_SESSION['quiz']) && $_SESSION['quiz'] == $qno) {

$query = "SELECT * FROM questions WHERE qno = '$qno'" ;

$run = mysqli_query($conn , $query) or die(mysqli_error($conn));

if (mysqli_num_rows($run) > 0) {

$row = mysqli_fetch_array($run);

$qno = $row['qno'];

$question = $row['question'];

$ans1 = $row['ans1'];

$ans2 = $row['ans2'];

$ans3 = $row['ans3'];

$ans4 = $row['ans4'];

$correct_answer = $row['correct_answer'];

$_SESSION['quiz'] = $qno;

$checkqsn = "SELECT * FROM questions" ;

$runcheck = mysqli_query($conn , $checkqsn) or die(mysqli_error($conn));

$countqsn = mysqli_num_rows($runcheck);

$time = time();

$_SESSION['start_time'] = $time;

$allowed_time = $countqsn * 0.05;

$_SESSION['time_up'] = $_SESSION['start_time'] + ($allowed_time * 60) ;

else {

echo "<script> alert('something went wrong');

window.location.href = 'home.php'; </script> " ;

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
else {

echo "<script> alert('error');

window.location.href = 'home.php'; </script> " ;

?>

<?php

$total = "SELECT * FROM questions ";

$run = mysqli_query($conn , $total) or die(mysqli_error($conn));

$totalqn = mysqli_num_rows($run);

?>

<html>

<head>

<title>PHP-Quiz</title>

<link rel="stylesheet" type="text/css" href="css/style.css">

</head>

<body>

<header>

<div class="container">

<h1>PHP-Quiz</h1>

</div>

</header>

<main>

<div class= "container">

<div class= "current">Question <?php echo $qno; ?> of <?php echo $totalqn; ?></div>

<p class="question"><?php echo $question; ?></p>

<form method="post" action="process.php">

<ul class="choices">

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<li><input name="choice" type="radio" value="a" required=""><?php echo $ans1; ?></li>

<li><input name="choice" type="radio" value="b" required=""><?php echo $ans2; ?></li>

<li><input name="choice" type="radio" value="c" required=""><?php echo $ans3; ?></li>

<li><input name="choice" type="radio" value="d" required=""><?php echo $ans4; ?></li>

</ul>

<input type="submit" value="Submit">

<input type="hidden" name="number" value="<?php echo $qno;?>">

<br> <br>

<a href="results.php" class="start">Stop Kqiz</a>

</form> </div> </main> </body> </html>

<?php }

else {

header("location: home.php");

?>

 File name :- result.php

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<?php

session_start();

include "connection.php";

if (isset($_SESSION['id'])) {

?>

<?php if(!isset($_SESSION['score'])) {

header("location: question.php?n=1");

?>

<html>

<head>

<title>PHP Quiz</title>

<link rel="stylesheet" type="text/css" href="css/style.css">

</head>

<body>

<header>

<div class="container">

<h1>PHP Quiz</h1>

</div>

</header>

<main>

<div class= "container">

<h2>Congratulations!</h2>

<p>You have successfully completed the test</p>

<p>Total points: <?php if (isset($_SESSION['score'])) {

echo $_SESSION['score'];

}; ?> </p>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<a href="question.php?n=1" class="start">Start Again</a>

<a href="home.php" class="start">Go Home</a>

</div>

</main>

</body>

</html>

<?php

$score = $_SESSION['score'];

$email = $_SESSION['email'];

$query = "UPDATE users SET score = '$score' WHERE email = '$email'";

$run = mysqli_query($conn , $query) or die(mysqli_error($conn));

?>

<?php unset($_SESSION['score']); ?>

<?php unset($_SESSION['time_up']); ?>

<?php unset($_SESSION['start_time']); ?>

<?php }

else {

header("location: home.php");

?>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280

 File name :- process.php


<?php
session_start();
include "connection.php";
if (isset($_SESSION['id'])) {

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

if ($_POST) {
$newtime = time();
if ( $newtime > $_SESSION['time_up']) {
echo "<script>alert('time up');
window.location.href='results.php';</script>";
}
else {
$_SESSION['start_time'] = $newtime;
$qno = $_POST['number'];
$_SESSION['quiz'] = $_SESSION['quiz'] + 1;
$selected_choice = $_POST['choice'];
$nextqno = $qno+1;

$query = "SELECT correct_answer FROM questions WHERE qno= '$qno' ";


$run = mysqli_query($conn , $query) or die(mysqli_error($conn));
if(mysqli_num_rows($run) > 0 ) {
$row = mysqli_fetch_array($run);
$correct_answer = $row['correct_answer'];
}
if ($correct_answer == $selected_choice) {
$_SESSION['score']++;
}

$query1 = "SELECT * FROM questions ";


$run = mysqli_query($conn , $query1) or die(mysqli_error($conn));
$totalqn = mysqli_num_rows($run);

if ($qno == $totalqn) {
header("location: results.php");
}
else {
header("location: question.php?n=".$nextqno);
}

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
}
}
else {
header("location: home.php");
}
}
else {
header("location: home.php");
}
?>

 File name :- edit.php

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
<?php session_start(); ?>
<?php include "connection.php";
if (isset($_SESSION['admin'])) {
?>

<?php
if (isset($_GET['qno'])) {
$qno = mysqli_real_escape_string($conn , $_GET['qno']);
if (is_numeric($qno)) {
$query = "SELECT * FROM questions WHERE qno = '$qno' ";
$run = mysqli_query($conn, $query) or die(mysqli_error($conn));
if (mysqli_num_rows($run) > 0) {
while ($row = mysqli_fetch_array($run)) {
$qno = $row['qno'];
$question = $row['question'];
$ans1 = $row['ans1'];
$ans2 = $row['ans2'];
$ans3 = $row['ans3'];
$ans4 = $row['ans4'];
$correct_answer = $row['correct_answer'];
}
}
else {
echo "<script> alert('error');
window.location.href = 'allquestions.php'; </script>" ;
}
}
else {
header("location: allquestions.php");
}
}

?>
<?php
if(isset($_POST['submit'])) {
$question =htmlentities(mysqli_real_escape_string($conn , $_POST['question']));
$choice1 = htmlentities(mysqli_real_escape_string($conn , $_POST['choice1']));
$choice2 = htmlentities(mysqli_real_escape_string($conn , $_POST['choice2']));
$choice3 = htmlentities(mysqli_real_escape_string($conn , $_POST['choice3']));
$choice4 = htmlentities(mysqli_real_escape_string($conn , $_POST['choice4']));
$correct_answer = mysqli_real_escape_string($conn , $_POST['answer']);

$query = "UPDATE questions SET question = '$question' , ans1 = '$choice1' , ans2= '$choice2' , ans3 =
'$choice3' , ans4 = '$choice4' , correct_answer = '$correct_answer' WHERE qno = '$qno' ";
$run = mysqli_query($conn , $query) or die(mysqli_error($conn));
if (mysqli_affected_rows($conn) > 0 ) {
echo "<script>alert('Question successfully updated');
window.location.href= 'allquestions.php'; </script> " ;
}
else {

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
"<script>alert('error, try again!'); </script> " ;
}
}

?>

<!DOCTYPE html>
<html>
<head>
<title>PHP-Quiz</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>

<body>
<header>
<div class="container">
<h1>PHP-Quiz</h1>
<a href="index.php" class="start">Home</a>
<a href="add.php" class="start">Add Question</a>
<a href="allquestions.php" class="start">All Questions</a>
<a href="exit.php" class="start">Logout</a>

</div>
</header>

<main>
<div class="container">
<h2>Add a question...</h2>
<form method="post" action="">

<p>
<label>Question</label>
<input type="text" name="question" required="" value="<?
php echo $question; ?>">
</p>
<p>
<label>Choice #1</label>

<input type="text" name="choice1" required="" value="<?php echo $ans1; ?>">

</p>
<p>
<label>Choice #2</label>

<input type="text" name="choice2" required="" value="<?php echo $ans2; ?>">

</p>

<p>

<label>Choice #3</label>

<input type="text" name="choice3" required="" value="<?php echo $ans3; ?>">

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280
</p>

<p>

<label>Choice #4</label>

<input type="text" name="choice4" required="" value="<?php echo $ans4; ?>">

</p>

<p>

<label>Correct answer</label>

<select name="answer" >

<option value="a">Choice #1 </option>


<option value="b">Choice #2</option>
<option value="c">Choice #3</option>
<option value="d">Choice #4</option>
</select>
</p>

<p>

<input type="submit" name="submit" value="Submit">

</p> </form> </div> </main> </body> </html>

<?php }

else {
header("location: admin.php");
}
?>

 File name :- exit.php


<?php

session_start();

session_destroy();

header("location: index.php");

?>

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280

 File name :- connection.php


<?php

$conn = mysqli_connect("localhost", "root", "", "php-kuiz") or die("could not connect" .


mysqli_error($conn) ) ;

?>

 File name :- php-quiz.sql


SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

START TRANSACTION;

SET time_zone = "+00:00";

--

-- Database: `php-kuiz`

--

-- --------------------------------------------------------
--
-- Table structure for table `questions`
--
CREATE TABLE `questions` (

`qid` int(11) NOT NULL,

`qno` int(11) NOT NULL,

`question` text NOT NULL,

`ans1` text NOT NULL,

`ans2` text NOT NULL,

`ans3` text NOT NULL,

`ans4` text NOT NULL,

`correct_answer` varchar(1) NOT NULL

) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280

--
-- Dumping data for table `questions`
--

INSERT INTO `questions` (`qid`, `qno`, `question`, `ans1`, `ans2`, `ans3`, `ans4`, `correct_answer`) VALUES

(9, 5, 'What is a correct way to add a comment in PHP?', '&lt;!--&hellip;--&gt;', '/*&hellip;*/', '*\\..\\*',
'&lt;comment&gt;&hellip;&lt;/comment&gt;', 'b'),

(8, 3, 'The PHP syntax is most similar to:', 'Perl and C', 'VBscript', 'Javascript', 'none of these', 'a'),

(7, 2, 'How do you write \"Hello World\" in PHP?', 'echo \"Hello World\";', 'Document.Write(\"Hello
World\");', '\"Hello World\";', 'none of these', 'a'),

(6, 1, 'What does PHP stand for?', 'Personal Hypertext Processor', 'Private Home Page', 'Personal Home
Page', 'PHP: Hypertext Preprocessor', 'a'),

(5, 4, 'How do you get information from a form that is submitted using the &quot;get&quot; method?',
'$_GET[];', 'Request.Form;', 'Request.QueryString;', 'none of these', 'a'),

(10, 6, 'When using the POST method, variables are displayed in the URL:', 'True', 'False', 'Can\'t say',
'none of these', 'b'),

(11, 7, ' Which of the following function is used to get the size of a file?', 'fopen()', 'fread()', 'fsize()',
'filesize()', 'd'),

(12, 8, 'Which of the following is used to delete a cookie?', 'setcookie()', '$_COOKIE variable', 'isset()
function', 'none of the above', 'a');

-- --------------------------------------------------------

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280

--
-- Table structure for table `users`
--

CREATE TABLE `users` (

`id` int(11) NOT NULL,

`email` varchar(225) NOT NULL,

`played_on` varchar(225) NOT NULL,

`score` int(11) NOT NULL DEFAULT 0

) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `email`, `played_on`, `score`) VALUES

(83, 'pallav@abc.com', '2022-08-05 15:57:31', 4),

(1, 'anshramani1212@gmail.com', '2022-08-05 16:06:20', 7);

--
-- Indexes for dumped tables
--

Name :- Ansh Ramani / TYBCA - SEM-5


Website Title :- Quiz_master Roll No :- 280

-- Indexes for table `questions`


--
ALTER TABLE `questions`

ADD PRIMARY KEY (`qid`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`

ADD PRIMARY KEY (`id`);

--

-- AUTO_INCREMENT for table `questions`


--
ALTER TABLE `questions`

MODIFY `qid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`

MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=84;

COMMIT;

Name :- Ansh Ramani / TYBCA - SEM-5

You might also like