<!-- This is the source of the Job Interview web page. You are free to edit the web page content area -->
<?php require("includes/header.php"); ?>
<!-- Your Website page contents should be here -->
<?php
$q1 = $_POST['q1'];
$q2 = $_POST['q2'];
$q3 = $_POST['q3'];
$q4 = $_POST['q4'];
$q5 = $_POST['q5'];
$q6 = $_POST['q6'];
$q7 = $_POST['q7'];
$q8 = $_POST['q8'];
$q9 = $_POST['q9'];
$q10 = $_POST['q10'];
$a1 = "clone";
$a2 = "monitor";
$a3 = "keyboard";
$a4 = "hard disk drive";
$a5 = "RAM";
$a6 = "application software";
$a7 = "processor";
$a8 = "BIOS";
$a9 = "CMOS";
$a10 = "windows 8";
$email = $_POST['emailsend'];
?>
<!-- Ensure the user inputs an email address -->
<?php
//For 1 being correct
if (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
$grade = 100;
//Grades of 90
} elseif (($q1 == $a1)&&($q2 != $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
$grade = 90;
} elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 != $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
$grade = 90;
} elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 != $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
$grade = 90;
} elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 != $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
$grade = 90;
} elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 != $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
$grade = 90;
} elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 != $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
$grade = 90;
} elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 != $a8)&&($q9 == $a9)&&($q10 == $a10)) {
$grade = 90;
} elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 != $a9)&&($q10 == $a10)) {
$grade = 90;
} elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 != $a10)) {
$grade = 90;
//STOP 90 Grades
} elseif (($q1 == $a1)&&($q2 != $a2)&&($q3 != $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
$grade = 80;
} else{
$grade = 0;
}
?>
<?php
switch ($grade) {
case 100:
echo "
<center><h2>
Congratulations , you have passed the interview. Your score is 100%<br />
Your result will be sent to your email address<br /></h2><br /><i>" .$email.
"</i></center>";
break;
case 90:
echo "
<center><h2>
You scored 90% and you will be considered for the job. Kindly wait while we process the entries. Your result will be sent to your email address</h2><br /><i>".$email."</i></center>";
break;
case 80:
echo "
<center><h2>
You scored 80% and you will be considered for the job. Kindly wait while we process the entries. Your result will be sent to your email address</h2><br /><i>".$email."</i></center>";
break;
case 0:
echo "Sorry you failed the interview! We are sorry you didn't get the Job, <br /> You can try again by registering with our next batch.
The link below will take you to the registration page.<br /><br /><br />
<a href=\"registration.php\">Return to the registration page</a>";
break;
default:
echo "There is no result for you, this could be because you have not answered our questions";
break;
}
?>
<!-- Updating the database with the result scores per applicant -->
<?php
//$query = "INSERT INTO interview (email, result) VALUES ('$email', '$score');";
//$result = mysql_query($query);
/*if (!$result) {
die("Database query error" . mysql_error());
}*/
?>
<!-- End of Database Query -->
<!-- /Your Website page contents ends here -->
<?php require("includes/footer.php"); ?>