File manager - Edit - /home/autoph/public_html/portal/includes/exam/pod_exam_essay_form.php
Back
<?php $examID = $_GET['xid']; $trainingID = $_GET['tid']; $userID = $user_data['emp_id']; $addTime = $_GET['nu']; $examType = $_GET['examType']; $checkExpiredDate = mysql_result(mysql_query("SELECT `date_finished` FROM `pod_exam_taken` WHERE `employee_id`='$empID' AND `exam_id`='$examID' AND `type`='$examType'"),0); $currentDateTime = date("m/d/Y H:i:s"); if($currentDateTime >=$checkExpiredDate && !empty($checkExpiredDate)){ echo "<div style='padding:20px;width:900px;height:450px;left:240px;top:100px;position:absolute;border:1px solid red;border-radius:15px;background:white;z-index:100'>"; echo "<center><p style='font-family:Calibri Light;font-size:20px;color:red;padding:20px;'>Your session has already been expired.</p><p style='font-family:Calibri Light;font-size:40px;color:red'>Good Luck ".$user_data['u_fname']."!</p></center><br><br>"; echo "<center><a href='exam_portal.php?tid=".$_GET['tid']."&content=true' style='cursor:pointer;color:lightgray;' > <input class='titleBlue' style='cursor:pointer;background-color:lightgray;border:1px lightgray solid;border-radius:5px;width:120px;height:30px;color:green;font-size:20px;font-weight:normal;margin:10px;padding;5px;border-radius:200px 200px 200px 200px; font-weight:normal' type='button' value=' Continue >'></a></center>"; echo "</div>"; } if(isset($_GET['nu'])){ date_default_timezone_set('Asia/Singapore'); $currentDate = date("m/d/Y H:i:s"); $currentDate_timestamp = strtotime($currentDate); $endDateTime = strtotime("+".$addTime." Minutes", $currentDate_timestamp); $packageEndDateTime = date("m/d/Y H:i:s", $endDateTime); echo "<div style='padding:20px;width:900px;height:450px;left:240px;top:100px;position:absolute;border:1px solid red;border-radius:15px;background:white;z-index:100'>"; echo "<center><p style='font-family:Calibri Light;font-size:20px;color:red;padding:20px;'>You are about to start the ".$_GET['trn']." part of the ".$title ." exam. You only have <b style='font-size:20px;color:blue'>".$_GET['nu']."</b> minutes to complete and answer all questions. </p><p style='font-family:Calibri Light;font-size:40px;color:red'>Good Luck ".$user_data['u_fname']."!</p></center><br><br>"; echo "<center><a href='exam_portal.php?tid=".$_GET['tid']."&content=true&xid=".$_GET['xid']."&trn=".$_GET['trn']."&pg=".$_GET['pg']."&examType=".$_GET['examType']."' style='cursor:pointer;color:lightgray;' > <input class='titleBlue' style='cursor:pointer;background-color:lightgray;border:1px lightgray solid;border-radius:5px;width:120px;height:30px;color:green;font-size:20px;font-weight:normal;margin:10px;padding;5px;border-radius:200px 200px 200px 200px; font-weight:normal' type='button' value=' Continue >'></a></center>"; echo "</div>"; $chkIfPrevExist = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `pod_exam_taken` WHERE `exam_id`='$examID' AND `training_id`='$trainingID' AND `employee_id`='$userID' AND `type`='$examType'"),0); if($chkIfPrevExist != '0' ){ }else{ $sql="INSERT INTO `pod_exam_taken` (`id`,`employee_id`,`exam_id`,`training_id`,`date_started`,`time_started`,`date_finished`,`time_finished`,`type`,`chk_required`) VALUES('','$userID','$examID','$trainingID','$toDate','$currentTime','$packageEndDateTime','$packageEndDateTime','$examType','YES')"; if(!mysql_query($sql)){ die('Error: ' . mysql_error()); } } } //SAVE ANSWERS if(isset($_POST['submitAnswer'])){ $questionID=$_POST['recID']; $examID=$_POST['myXID']; $trainingID=$_POST['myTRID']; $myAnswer=$_POST['myAnswer']; //$correctAnswer=$_POST['correctAnswer']; $SysMessage='Answer saved...'; $myAnswer = mysql_real_escape_string($myAnswer); $chkIfExist = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `pod_exam_true_false_answer` WHERE `exam_id`='$examID' AND `training_id`='$trainingID' AND `question_id`='$questionID' AND `employee_id`='$empID' AND `ex_type`='$examType'"),0); //echo "<br><br><br>CHECK IF EXIST: ".$chkIfExist . "QID: ".$questionID. "ANSWER ".$myAnswer; //break; if($chkIfExist != '0' ){ mysql_query("UPDATE `pod_exam_true_false_answer` SET `my_answer`='$myAnswer',`score`='$score' WHERE `exam_id`='$examID' AND `training_id`='$trainingID' AND `question_id`='$questionID' AND `employee_id`='$empID' AND `ex_type`='$examType'"); }else{ $sql="INSERT INTO `pod_exam_true_false_answer` (`id`,`employee_id`,`exam_id`,`question_id`,`training_id`,`correct_answer`,`my_answer`,`score`,`date`,`time`,`ex_type`) VALUES('','$empID','$examID','$questionID','$trainingID','0','$myAnswer','$score','$toDate','$currentTime','$examType')"; if(!mysql_query($sql)){ die('Error: ' . mysql_error()); } } } echo "<div class='ContinueMSG' style='top:70px;left:12.5%;width:75%;height:520px;position:absolute;z-index:9;border:1px solid red;background:white'>"; echo "<div style='height:25px;border-bottom:1px solid lightgray;width:100%;padding:3px' class='lightGradient'> ".$xmType.": ".$xmTitle." <a href='exam_portal.php?tid=".$_GET['tid']."&content=true&examType=".$_GET['examType']."'><div style='top:3px;left:98%;position:absolute;z-index:3;background:orange;padding-left:5px;padding-right:5px'> <center>X</center> </div></a> </div>"; //START OF CODE--====================================================================================================== echo "<p style='font-size:16px;color:red;padding:20px;padding-bottom:5px;border:0px solid red;padding-left:70px'> <b style='float:right;font-family:Calibri Light;font-size:16px;color:red;font-weight:normal'>Exam will End at exactly ".$checkExpiredDate ."</b> </p>"; echo "<center> <table style='background:white;width:97%;border-collapse:collapse;>"; echo "<tr style='background:white'>"; echo "<td align='center' valign='top' style='width:35%;background:white;border:1px solid lightgray;font-family:Calibri'>"; echo "<div style='height:420px;border-bottom:1px solid lightgray;width:100%;padding:0px;overflow:auto;padding-top:0px'>"; echo "<p class='lightGradient' style='font-family:calibri light;font-size:16px;text-align:left;padding:3px'>YOUR ESSAY QUESTION:</p3>"; $qq = mysql_query("SELECT * FROM `pod_exam_essay` WHERE `exam_id`='$examID' ORDER BY `id` ASC"); while($arow=mysql_fetch_array($qq)){ echo "<div style='width:99.5%;padding:6px;font-family:Calibri Light;font-size:16px;margin:2px;border:0px solid lightgray;text-align:left'>"; echo $arow['question']; echo "</div>"; } echo "</div>"; echo "</td>"; echo "<td align='center' style='width:65%;background:white;border:1px solid lightgray;font-family:Calibri'>"; echo "<div style='height:420px;border-bottom:1px solid lightgray;width:100%;padding:0px;overflow:auto;padding-top:0px'>"; echo "<p class='lightGradient' style='font-family:calibri light;font-size:16px;text-align:left;padding:3px'>TYPE YOUR ANSWER IN THE TEXT BOX BELOW</p3>"; $qq = mysql_query("SELECT * FROM `pod_exam_essay` WHERE `exam_id`='$examID' ORDER BY `id` ASC"); while($row=mysql_fetch_array($qq)){ $queID = $row['id']; $prevAnswer = mysql_result(mysql_query("SELECT `my_answer` FROM `pod_exam_true_false_answer` WHERE `training_id`='$trainingID' AND `question_id`='$queID' AND `employee_id`='$empID' AND `exam_id`='$examID' AND `ex_type`='$examType'"),0); echo "<div style='width:99.5%;padding:2px;font-family:Calibri Light;font-size:14px;margin:2px;border:0px solid lightgray;text-align:left'>"; echo "<form action='' method='POST'>"; echo "<input type='hidden' name='recID' value='".$row['id']."'>"; echo "<input type='hidden' name='myTRID' value='".$row['training_id']."'>"; echo "<input type='hidden' name='myXID' value='".$row['exam_id']."'>"; echo "<input type='hidden' name='correctAnswer' value='".$row['answer_tag']."'>"; echo "<textarea type='text' rows='15' required name='myAnswer' style='background:white;text-align:left;padding:20px;width:100%;font-family:calibri light;font-size:14px;color:red;font-weight:normal;border:1px solid lightgray';>".$prevAnswer."</textarea>"; echo "<br><br><input type='submit' class='lightGradient' name='submitAnswer' value='Submit and Close' style='float:right;width:150px;font-family:calibri light;font-size:14px;height:26px;border:1px solid lightgray';>"; echo " "; echo "</form>"; echo "</div>"; } echo "<b style='font-size:12px;color:red;font-weight:normal'>".$SysMessage."</b>"; echo "</div>"; echo "</td>"; echo "</tr>"; echo "</table></center>"; //END OF CODE=================================================================================================================== echo "</div>"; ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings