Advertisement
joerex101

answers.php

Sep 9th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.18 KB | None | 0 0
  1. <!-- This is the source of the Job Interview web page. You are free to edit the web page content area -->
  2. <?php require("includes/header.php"); ?>
  3. <!-- Your Website page contents should be here -->
  4. <?php
  5.     $q1 = $_POST['q1'];
  6.     $q2 = $_POST['q2'];
  7.     $q3 = $_POST['q3'];
  8.     $q4 = $_POST['q4'];
  9.     $q5 = $_POST['q5'];
  10.     $q6 = $_POST['q6'];
  11.     $q7 = $_POST['q7'];
  12.     $q8 = $_POST['q8'];
  13.     $q9 = $_POST['q9'];
  14.     $q10 = $_POST['q10'];
  15.     $a1 = "clone";
  16.     $a2 = "monitor";
  17.     $a3 = "keyboard";
  18.     $a4 = "hard disk drive";
  19.     $a5 = "RAM";
  20.     $a6 = "application software";
  21.     $a7 = "processor";
  22.     $a8 = "BIOS";
  23.     $a9 = "CMOS";
  24.     $a10 = "windows 8";
  25.     $email = $_POST['emailsend'];
  26. ?>
  27. <!-- Ensure the user inputs an email address -->
  28. <?php
  29. //For 1 being correct
  30.     if (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
  31.         $grade = 100;
  32.         //Grades of 90
  33.     } elseif (($q1 == $a1)&&($q2 != $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
  34.         $grade = 90;
  35.     } elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 != $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
  36.         $grade = 90;
  37.     } elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 != $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
  38.         $grade = 90;
  39.     } elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 != $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
  40.         $grade = 90;
  41.     } elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 != $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
  42.         $grade = 90;
  43.     } elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 != $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
  44.         $grade = 90;
  45.     } elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 != $a8)&&($q9 == $a9)&&($q10 == $a10)) {
  46.         $grade = 90;
  47.     } elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 != $a9)&&($q10 == $a10)) {
  48.         $grade = 90;
  49.     } elseif (($q1 == $a1)&&($q2 == $a2)&&($q3 == $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 != $a10)) {
  50.         $grade = 90;
  51.         //STOP 90 Grades
  52.     } elseif (($q1 == $a1)&&($q2 != $a2)&&($q3 != $a3)&&($q4 == $a4)&&($q5 == $a5)&&($q6 == $a6)&&($q7 == $a7)&&($q8 == $a8)&&($q9 == $a9)&&($q10 == $a10)) {
  53.         $grade = 80;
  54.     } else{
  55.         $grade = 0;
  56.     }
  57. ?>
  58. <?php
  59.     switch ($grade) {
  60.         case 100:
  61.             echo "
  62.             <center><h2>
  63.             Congratulations  , you have passed the interview. Your score is 100%<br />
  64.             Your result will be sent to your email address<br /></h2><br /><i>" .$email.
  65.             "</i></center>";
  66.             break;
  67.         case 90:
  68.             echo "
  69.             <center><h2>
  70.             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>";
  71.             break;
  72.         case 80:
  73.             echo "
  74.             <center><h2>
  75.             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>";
  76.             break;
  77.         case 0:
  78.             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.
  79.             The link below will take you to the registration page.<br /><br /><br />
  80.             <a href=\"registration.php\">Return to the registration page</a>";
  81.             break;
  82.         default:
  83.             echo "There is no result for you, this could be because you have not answered our questions";
  84.             break;
  85.     }
  86.  
  87.  
  88. ?>
  89. <!-- Updating the database with the result scores per applicant -->
  90. <?php
  91.     //$query = "INSERT INTO interview (email, result) VALUES ('$email', '$score');";
  92.     //$result = mysql_query($query);
  93.     /*if (!$result) {
  94.         die("Database query error" . mysql_error());
  95.     }*/
  96. ?>
  97. <!-- End of Database Query -->
  98. <!-- /Your Website page contents ends here -->
  99. <?php require("includes/footer.php"); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement