Jump to content

A point in the right direction :)


lanceox

Recommended Posts

H guys,

I have created a quiz, however what i would like to do is have something that keeps an eye on the quiz.  For example if someone is taking the quiz however get 4 incorrect answers in a row then it will abort the quiz.

 

is it something like a for loop for example.... im not sure?

 

The code i already got is a basic quiz however im just looking on expaning it more.

 

Thanks for any help, i appreciate it!

 

<?php 
session_start();

$_SESSION['dclty']  = $_POST['dclty'];

?>
<?php
if ($_SESSION['dclty'] == "beg")
?>
<script>
window.open("extrahelp.php", height=300,width=300);
</script>
<?php
if ($_SESSION['dclty'] == "int")
?>
<script>
window.open("pointers.php", height=300,width=300);
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Forensics E-learning Package</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="wrapper">
<div id="header">
<div id="toplinks">

</div>
</div>
<div id="menu">
	<ul>
		<li><a class="selected" href="home.html">Home</a></li>
		<li><a href="initialquiz.php">Initial Quiz</a></li>
		<li><a href="about.php">About</a></li>

	</ul>
  </div>
<div id="content">
	<div id="main">
        <h1>Initial Quiz</h1><BR />
        <form name="Forensics Test" method="post" action="detection.php">
        <h1>Protection</h1>
<hr />
<b>1. What does an IDS do? <BR /><BR /></b>
<UL>
<? if($attempted == true && !isset($q1)) { echo 'bgcolor="#FFFFCC"'; } ?>
<input type="radio" name="q1" id="q1a" value="1" />An IDS evaluates a suspected intrusion once it has taken place and signals an alarm<BR><? if($q1 == "1"){echo "checked=\"checked\"";} ?>
<input type="radio" name="q1" id="q1b" value="2">An IDS blocks intrusions before it happens and signal an alarm<BR><? if($q1 == "1"){echo "checked=\"checked\"";} ?>
<input type="radio" name="q1" id="q1c" value="3">An IDS blocks all intrusions before it happens and monitors the network, however does not signal an alarm.<BR><? if($q1 == "1"){echo "checked=\"checked\"";} ?></UL><hr />
<b>2. What does a Firewall do?<BR /><BR></b>
<UL>
<? if($attempted == true && !isset($q2)) { echo 'bgcolor="#FFFFCC"'; } ?>
<input type="radio" name="q2" id="q2a" value="1">Firewalls limit access once the intrusion is within a network and then signals an alarm.<BR><? if($q2 == "1"){echo "checked=\"checked\"";} ?>
<input type="radio" name="q2" id="q2b" value="2">Firewalls limit access between networks to prevent intrusion and do not signal an attack.<BR><? if($q2 == "1"){echo "checked=\"checked\"";} ?>
<input type="radio" name="q2" id="q2c" value="3">Firewalls limit access to a network and prevent all intrusions. An alarm to the user is raised.<br><? if($q2 == "1"){echo "checked=\"checked\"";} ?></UL><hr />
<p><b>3. What does Tripwire do?</b> </p>
<UL>
<? if($attempted == true && !isset($q3)) { echo 'bgcolor="#FFFFCC"'; } ?>
<input type="radio" name="q3" id="q3a" value="1">Tripwire does not protect from intrusions however signals an alarm to the user that network intrusions are occurring.<BR><? if($q3 == "1"){echo "checked=\"checked\"";} ?>
<input type="radio" name="q3" id="q3b" value="2">Tripwire does not perform system integrity checks in terms of file change, however does prevent access to a network unless otherwise stated.<BR><? if($q3 == "1"){echo "checked=\"checked\"";} ?>
<input type="radio" name="q3" id="q3c" value="3">Tripwire helps identify changes in files. Tripwire records a set of information about all the important files in your server in case of a change.</p><? if($q3 == "1"){echo "checked=\"checked\"";} ?>
<BR>
</UL><hr />
<p><b>4. What type of files does a traditional anti-virus protect you from?</b> </p>
<UL>
  <? if($attempted == true && !isset($q4)) { echo 'bgcolor="#FFFFCC"'; } ?>
  <input type="radio" name="q4" id="q4a" value="1">Viruses and tracking cookies<BR><? if($q4 == "1"){echo "checked=\"checked\"";} ?>
  <input type="radio" name="q4" id="q4b" value="2">Rootkits and Viruses<BR><? if($q4 == "1"){echo "checked=\"checked\"";} ?>
  <input type="radio" name="q4" id="q4c" value="3">Worms and Rootkits<BR><? if($q4 == "1"){echo "checked=\"checked\"";} ?>
</UL><hr />
<p><b>5. What does an Anti-root kit protect you from?</b> </p>
<UL>
  <? if($attempted == true && !isset($q5)) { echo 'bgcolor="#FFFFCC"'; } ?>
  <input type="radio" name="q5" id="q5a" value="1">Anti-rootkit protects from only viruses, key loggers and backdoors.<BR><? if($q5 == "1"){echo "checked=\"checked\"";} ?>
  <input type="radio" name="q5" id="q5b" value="2">Anti-rootkit protects from viruses, backdoors, spyware and key loggers as a collection.<BR><? if($q5 == "1"){echo "checked=\"checked\"";} ?>
  <input type="radio" name="q5" id="q5c" value="3">Anti-rootkit protects from only viruses and backdoors.<BR><? if($q5 == "1"){echo "checked=\"checked\"";} ?>
</UL>
<HR><BR /><BR />
<input type="submit" value="Go to Next Section" />
</form>


          
        
        </div>
	<div id="right">
	<h2>Right Menu</h2>
	<div class="rightitem">
		<ul>
		<li><a class="selected" href="home.html">Home</a></li>
		<li><a href="initialquiz.php">Initial Quiz</a></li>
		<li><a href="about.php">About</a></li>
		</ul>
	</div>
  </div>
  </div>
<div class="clearbottom"></div>
<div id="footer">
	<p id="legal"> </p>
</div>
</div>
</div>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/231402-a-point-in-the-right-direction/
Share on other sites

The only way I can think of is if you put the questions into an array and it generates a new question after the previous one is answered. Then you could count wrong answers to kill the quiz. something like this for the counter:

$wrong_count = "0";

if($wrong_count > 3){
  //code to stop quiz}
}else{
//code to pull new question and continue quiz
}

 

Have it increment the counter when the user picks a wrong answer using $wrong_count++;

Thanks for the reply.  I have never reall used arrays.

 

How would i output the questions from the array with a submit button (i.e. so it can be submitted through a form) for example

 

Thanks any help would be great, pretty new to php thats all. :)

 

Lance

 

 

Hey cheers for advice,

 

Yeah thats exactly what i want to happen but the only problem is that all the question must be answered first were as i want the questions to be answered seperately so i could run some form of if statement were if they get 4 questions wrong in a row then it will abort.  Just havnt got a clue how i can make it happen.

 

will35010 recommended an array but i wouldnt know how to output those questions from the array into a form so each question can be submitted...

 

pretty Confusing...

 

Lance

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.