ok

Mini Shell

Direktori : /home2/selectio/public_html/tnpsctestbatch.com/quiz/
Upload File :
Current File : /home2/selectio/public_html/tnpsctestbatch.com/quiz/ajay-mock-exam.php

<?php include "header.php";?>


<style>
    
    .ps-5 {
    padding-left: 3rem!important;
    padding-bottom: 8% !important;
}
.text-color:hover {
  color: green;
}

.multisteps_form { 
  
    min-height: 15.75rem; !important
}

#prevBtn{
    display:none;
}


.leaderboard {
  position: absolute;
  top: 28%;
  left: 13%;
  transform: translate(-50%, -50%);
  width: 285px;
  height: 308px;
  background-color:white ;
  border-radius: 10px;
  box-shadow: 0 7px 30px rgba(62, 9, 11, .3);



  h1 {
    font-size: 18px;
    color: black;
    padding: 12px 13px 18px;

    & svg {
      width: 25px;
      height: 26px;
      position: relative;
      top: 3px;
      margin-right: 6px;
      vertical-align: baseline;
    }

  }

  ol {
    counter-reset: leaderboard;

    li {
      position: relative;
      z-index: 1;
      font-size: 14px;
      counter-increment: leaderboard;
      padding: 18px 10px 18px 50px;
      cursor: pointer;
      backface-visibility: hidden;
      transform: translateZ(0) scale(1.0, 1.0);


      &::before {
        content: counter(leaderboard);
        position: absolute;
        z-index: 2;
        top: 15px;
        left: 15px;
        width: 20px;
        height: 20px;
        line-height: 20px;
        color: #c24448;
        background: #fff;
        border-radius: 20px;
        text-align: center;
      }

      mark {
        position: absolute;
        z-index: 2;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        padding: 18px 10px 18px 50px;
        margin: 0;
        background: none;
        color: #fff;

        &::before, &::after {
          content: '';
          position: absolute;
          z-index: 1;
          bottom: -11px;
          left: -9px;
          border-top: 10px solid #c24448;
          border-left: 10px solid transparent;
          transition: all .1s ease-in-out;
          opacity: 0;
        }

        &::after {
          left: auto;
          right: -9px;
          border-left: none;
          border-right: 10px solid transparent;
        }
      }

      small {
        position: relative;
        z-index: 2;
        display: block;
        text-align: right;
      }

      &::after {
        content: '';
        position: absolute;
        z-index: 1;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #fa6855;
        box-shadow: 0 3px 0 rgba(0, 0, 0, .08);
        // transform: scaleX(1.06) scaleY(1.03);
        transition: all .3s ease-in-out;
        opacity: 0;
      }

      &:nth-child(1) {
        background: #fa6855;
        &::after {
          background: #fa6855;
        }
      }

      &:nth-child(2) {
        background: #e0574f;
        &::after {
          background: #e0574f;
          box-shadow: 0 2px 0 rgba(0, 0, 0, .08);
        }

        & mark {
          &::before, &::after {
            border-top: 6px solid #ba4741;
            bottom: -7px;
          }
        }
      }

      &:nth-child(3) {
        background: #d7514d;
        &::after {
          background: #d7514d;
          box-shadow: 0 1px 0 rgba(0, 0, 0, .11);
        }

        & mark {
          &::before, &::after {
            border-top: 2px solid #b0433f;
            bottom: -3px;
          }
        }
      }

      &:nth-child(4) {
        background: #cd4b4b;
        &::after {
          background: #cd4b4b;
          box-shadow: 0 -1px 0 rgba(0, 0, 0, .15);
        }

        & mark {
          &::before, &::after {
            top: -7px;
            bottom: auto;
            border-top: none;
            border-bottom: 6px solid #a63d3d;;
          }
        }
      }

      &:nth-child(5) {
        background: #c24448;
        border-radius: 0 0 10px 10px;
        &::after {
          background: #c24448;
          box-shadow: 0 -2.5px 0 rgba(0, 0, 0, .12);
          border-radius: 0 0 10px 10px;
        }

        & mark {
          &::before, &::after {
            top: -9px;
            bottom: auto;
            border-top: none;
            border-bottom: 8px solid #993639;
          }
        }
      }

    }

    // hover
    li:hover {
      z-index: 2;
      overflow: visible;

      &::after {
        opacity: 1;
        transform: scaleX(1.06) scaleY(1.03);
      }

      & mark {
        &::before, &::after {
          opacity: 1;
          transition: all .35s ease-in-out;
        }
      }
    }

  }
}

* {
  //display: none;
}

.the-most {
  position: fixed;
  z-index: 1;
  bottom: 0;
  left: 0;
  width: 50vw;
  max-width: 200px;
  padding: 10px;
  
  img {
    max-width: 100%;
  }
}

.skippedquiz{
    top: 28%;
    left: 85%;
    position: absolute;
    transform: translate(-50%, -50%);
    width: 285px;
    height: 308px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 7px 30px rgba(62, 9, 11, .3);
}

.skipped_number{
    padding: 17px;
    margin-top: 10px;
    background-color: red;
    color: white;
    font-weight: 800;

}

.atten_number{
    padding: 17px;
    margin-top: 10px;
    background-color: green;
    color: white;
    font-weight: 800;

}

.list_type{
    color:white;
}

</style>

<?php
 $test_type = $_GET['exam_id'];
setcookie("exam_type", $test_type, time() + 2 * 24 * 60 * 60, '/', 'tnpsctestbatch.com' );
$user_id = "";

if(isset($_SESSION['user_exam'])){
    
    error_log("session is working");
    
    $exam_session_id = $_SESSION['user_exam']['id'];
}else{
     $exam_session_id = $_COOKIE['users_id'];
}




if(isset($_SESSION['user_exam'])) {
   /* echo ("<script LANGUAGE='JavaScript'>
    window.alert('Please Login');
    window.location.href='https://tnpsctestbatch.com/login.php';
    </script>"); 
	exit;*/
	
	$user_id = $_SESSION['user_exam']['id'];
}
$date = date('Y-m-d');

$quiz_titile="";

if($_GET['exam_id']==1){
    $quiz_titile="<span>TNPC Group 1</span>";
}else if($_GET['exam_id']==2){
    $quiz_titile="<span>TNPC Group 2/2A</span>";
}else{
    $quiz_titile="<span>TNPC Group 4</span>";
}
 ?>
 
 

<div class="container">
    <div class="row">
        <div class="col-md-2">
            <div class="leaderboard">
              <h1>
                <svg class="ico-cup">
                  <use xlink:href="#cup"></use>
                </svg>
                Top Ranking
              </h1>
              <ol style="list-style-type: none; padding-left: 0px;">
                  
                  <?php
                    $top_ranking = $pdo->prepare("SELECT tbl_mock_test.*,tbl_mock_test_result.*,COUNT(tbl_mock_test_result.user_id) AS ranking, 
                        tbl_students.name AS user_name FROM tbl_mock_test INNER JOIN tbl_mock_test_result ON tbl_mock_test.id = tbl_mock_test_result.question_id 
                        AND tbl_mock_test.correct_answer = tbl_mock_test_result.select_option INNER JOIN tbl_students ON tbl_students.id = tbl_mock_test_result.user_id 
                        GROUP BY tbl_mock_test_result.user_id ORDER BY ranking DESC LIMIT 10 ");
                		$top_ranking->execute(array());
                		$ranking_result = $top_ranking->fetchAll(PDO::FETCH_ASSOC);
                		$total_rank = $top_ranking->rowCount();
                    if($total_rank>0){
                     
                     foreach ($ranking_result as $ranking_datas){
                         
                    
                  ?>
                <li style="background-color:red; border-bottom: 1px solid white;">
                  <mark style="font-size: 16px;font-weight: 600;"> <?= $ranking_datas['user_name'] ?> </mark>
                  <small style="color: white;font-weight: 600;font-size: 16px;"> <?= $ranking_datas['ranking'] ?> </small>
                </li>
                
                <?php 
                     }
                      
                  } 
                  ?>
             
              </ol>
            </div>
            
            
            <svg style="display: none;">
              <symbol id="cup" x="0px" y="0px"
            	 width="25px" height="26px" viewBox="0 0 25 26" enable-background="new 0 0 25 26" xml:space="preserve">
            <path fill="#F26856" d="M21.215,1.428c-0.744,0-1.438,0.213-2.024,0.579V0.865c0-0.478-0.394-0.865-0.88-0.865H6.69
            	C6.204,0,5.81,0.387,5.81,0.865v1.142C5.224,1.641,4.53,1.428,3.785,1.428C1.698,1.428,0,3.097,0,5.148
            	C0,7.2,1.698,8.869,3.785,8.869h1.453c0.315,0,0.572,0.252,0.572,0.562c0,0.311-0.257,0.563-0.572,0.563
            	c-0.486,0-0.88,0.388-0.88,0.865c0,0.478,0.395,0.865,0.88,0.865c0.421,0,0.816-0.111,1.158-0.303
            	c0.318,0.865,0.761,1.647,1.318,2.31c0.686,0.814,1.515,1.425,2.433,1.808c-0.04,0.487-0.154,1.349-0.481,2.191
            	c-0.591,1.519-1.564,2.257-2.975,2.257H5.238c-0.486,0-0.88,0.388-0.88,0.865v4.283c0,0.478,0.395,0.865,0.88,0.865h14.525
            	c0.485,0,0.88-0.388,0.88-0.865v-4.283c0-0.478-0.395-0.865-0.88-0.865h-1.452c-1.411,0-2.385-0.738-2.975-2.257
            	c-0.328-0.843-0.441-1.704-0.482-2.191c0.918-0.383,1.748-0.993,2.434-1.808c0.557-0.663,1-1.445,1.318-2.31
            	c0.342,0.192,0.736,0.303,1.157,0.303c0.486,0,0.88-0.387,0.88-0.865c0-0.478-0.394-0.865-0.88-0.865
            	c-0.315,0-0.572-0.252-0.572-0.563c0-0.31,0.257-0.562,0.572-0.562h1.452C23.303,8.869,25,7.2,25,5.148
            	C25,3.097,23.303,1.428,21.215,1.428z M5.238,7.138H3.785c-1.116,0-2.024-0.893-2.024-1.99c0-1.097,0.908-1.99,2.024-1.99
            	c1.117,0,2.025,0.893,2.025,1.99v2.06C5.627,7.163,5.435,7.138,5.238,7.138z M18.883,21.717v2.553H6.118v-2.553H18.883
            	L18.883,21.717z M13.673,18.301c0.248,0.65,0.566,1.214,0.947,1.686h-4.24c0.381-0.472,0.699-1.035,0.947-1.686
            	c0.33-0.865,0.479-1.723,0.545-2.327c0.207,0.021,0.416,0.033,0.627,0.033c0.211,0,0.42-0.013,0.627-0.033
            	C13.195,16.578,13.344,17.436,13.673,18.301z M12.5,14.276c-2.856,0-4.93-2.638-4.93-6.273V1.73h9.859v6.273
            	C17.43,11.638,15.357,14.276,12.5,14.276z M21.215,7.138h-1.452c-0.197,0-0.39,0.024-0.572,0.07v-2.06
            	c0-1.097,0.908-1.99,2.024-1.99c1.117,0,2.025,0.893,2.025,1.99C23.241,6.246,22.333,7.138,21.215,7.138z"/>
                  </symbol>
            </svg>
        
        </div>
        <div class="col-md-8">
            <form class="multisteps_form position-relative overflow-hidden" id="wizard" method="POST">
             <!-- Form-header-content -->
             <div class="form_header_content text-center">
                <h3> QUIZ </h3>
             </div>
             <!------------------------- Step-1 ----------------------------->
      <?php 

        $progress_percentage=0;

    
        $statement = $pdo->prepare("SELECT tbl_mock_test.*,tbl_mock_test_result.question_id FROM tbl_mock_test 
        LEFT JOIN tbl_mock_test_result ON tbl_mock_test.id = tbl_mock_test_result.question_id and tbl_mock_test_result.user_id=? and tbl_mock_test_result.date=? WHERE 
        tbl_mock_test_result.question_id IS NULL AND tbl_mock_test.mock_test_type=?");
		$statement->execute(array($exam_session_id, $date ,$_GET['exam_id']));
		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
		$total=$statement->rowCount();
		$progress = 100/$total;
		$i=0;
		
		if($total>0){
		foreach ($result as $row) {
        $i++;
        $progress_percentage+=$progress;
      ?>
      
        <div class="multisteps_form_panel step">
             <!-- Form-content -->
             <span class="question_number text-uppercase float-end">QUESTION <?=$i?>/<?=$total?></span>
             <div class="progress rounded-pill">
                <div class="progress-bar" role="progressbar" style="width: <?=$progress_percentage?>%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
             </div>
             <h1 class="question_title px-5 py-3 animate__animated animate__fadeInRight animate_25ms">
                <?=$row['question']?>
                <input type="hidden" id="questions_id" value="<?=$row['id']?>">
                 <input type="hidden" id="question_id_<?=$row['id']?>" value="<?=$row['id']?>">
            </h1>
            <!-- Form-items -->
            <div class="ps-5">
                <ul class="list-unstyled p-0">
                    <li class="text-color step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_50ms answer_class_<?=$row['id']?>" style="font-size: 23px;" id="answer_<?=$row['id']?>_A" onclick="ch('A','<?=$row['id']?>','<?=$user_id?>','<?= $_GET['exam_id'] ?>');">
                       <input type="hidden"  name="stp_1_select_option" value="<?=$row['option_a']?>" class="check">
                            <h6 style="display: contents;">A.</h6>
                       <label for="opt_1"><?=$row['option_a']?></label>
                    </li>
                    <li class="text-color step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_100ms answer_class_<?=$row['id']?>" style="font-size: 23px;" id="answer_<?=$row['id']?>_B" onclick="ch('B','<?=$row['id']?>','<?=$user_id?>','<?= $_GET['exam_id'] ?>');">
                       <input type="hidden" name="stp_1_select_option" value="<?=$row['option_b']?>" class="check">
                            <h6 style="display: contents;">B.</h6>
                       <label for="opt_2"><?=$row['option_b']?></label>
                    </li>
                    <li class="text-color step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_150ms answer_class_<?=$row['id']?>" style="font-size: 23px;" id="answer_<?=$row['id']?>_C" onclick="ch('C','<?=$row['id']?>','<?=$user_id?>','<?= $_GET['exam_id'] ?>');">
                       <input type="hidden" name="stp_1_select_option" value="<?=$row['option_c']?>" class="check">
                            <h6 style="display: contents;">C.</h6>
                       <label for="opt_3"><?=$row['option_c']?></label>
                    </li>
                    <li class="text-color step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_200ms answer_class_<?=$row['id']?>" style="font-size: 23px;" id="answer_<?=$row['id']?>_D" onclick="ch('D','<?=$row['id']?>','<?=$user_id?>','<?= $_GET['exam_id'] ?>');">
                       <input type="hidden"  name="stp_1_select_option" value="<?=$row['option_d']?>" class="check">
                            <h6 style="display: contents;">D.</h6>
                       <label for="opt_4"><?=$row['option_d']?></label>
                    </li>
                </ul>
                <div class="form_btn text-center">
                    <button type="button" class="f_btn disable text-uppercase rounded-pill text-white" id="prevBtn" onclick="nextPrevSubjects(-1, <?=$row['id']?>)"><span><i class="fas fa-arrow-left"></i></span> Last Question</button>
                    <button type="button" class="f_btn active text-uppercase rounded-pill text-white" id="nextBtn" onclick="nextPrevSubjects(1, <?=$row['id']?>)">Next Questions <i class="fas fa-arrow-right"></i></button>
                        <br>
                    <span id="submit_section"></span>
                </div>
            </div>
            <div class=" mt-5 mb-5">
                <div class="d-flex justify-content-center row" >
                    <div class="d-flex flex-column col-md-8" >
                        <div class="d-flex flex-row align-items-center text-left comment-top p-2 bg-white border-bottom px-4">
                            <h1 style="font-size: 25px;"> Comments </h1>
                        </div>
                        <div class="coment-bottom bg-white p-2 px-4">
                            <div class="d-flex flex-row add-comment-section mt-4 mb-4">
                                <img class="img-fluid img-responsive rounded-circle mr-2" src="https://i.imgur.com/qdiP4DB.jpg" width="38">
                                <input type="text" onkeyup="comment_box()">
                                <input type="hidden" id="exam_type" value="<?=$_GET['exam_id']?>"  class="form-control mr-3" placeholder="Add comment">
                                <input type="hidden" id="user_id" value="<?php if(isset($_SESSION['user_exam'])){ echo $_SESSION['user_exam']['id']; } ?> ">
                                <span class="btn btn-primary" onclick="commentBtn()" >Comment</span>
                            </div>
                            <span id="comment_error" ></span>
                            <div id="comment_list"></div>
                            <div id="ques_id"></div>
                        </div>
                    </div>
                </div>
            </div>   
         </div>
         <?php }  	
		    
		} else {
		    
		      echo ('<script LANGUAGE="JavaScript">
    window.alert("Your already write an exam");
    window.location.href="../mock-test-final-result.php?exam_id='.$_GET['exam_id'].'";
    </script>'); 
	exit;
             
         }
		 ?>
         
         
            </div>
            <!---------- Form Button ---------->
           
            </form>  
            <div class="col-md-2" >
                <div class="skippedquiz">
                    <h4 style="margin-left: 22px;margin-top: 11px;">Quizes</h4>
                    <ul style="list-style: none; display: flex;">
                        <li class="skipped_number" > <a class="list_type" href="#" >1 </a> </li>    
                        <li class="skipped_number"> <a class="list_type" href="#"> 2 </a> </li>    
                        <li class="atten_number" > <a class="list_type" href="#"> 3 </a> </li>  
                        <li class="skipped_number"> <a class="list_type" href="#" > 4 </a> </li>
                        <li class="atten_number"> <a class="list_type" href="#"> 5 </a> </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    
   
</div>    

  
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.js"></script>-->
<script>


$(document).ready(function(){
    /*commentlist();*/
});

function comment_box(){
    <?php 
   
    if(isset($_SESSION['user_exam'])){ 
        
   
    }else{?>
        comment = $("#user_comment").val();
        if(comment==""){
             $("#comment_error").empty();
        }else{
            $("#comment_error").empty();
            $("#comment_error").append("<a style='color:red;' href='../login.php'> Click Here to Login  </a>");
        }
       
        
  <?php  } ?>
    
    
   
}

    <?php 
    
    $comment_script = 'var user_commet = $("#user_comment").val();
        var exam_type = $("#exam_type").val();
        var user_id = $("#user_id").val();
        var questions_id = $("#questions_id").val();
        
        $.ajax({
                url: "../api/comment.php",
                type: "post",
                dataType: "json",
                data: {type:"comment",exam_type:exam_type,user_commet,user_commet,user_id:user_id,questions_id:questions_id},
                success: function (response) {
                    console.log(response);
                    if(response["status"]=="100"){
                       commentlist();
                        var n = "";
                       $("#user_comment").val(n);
                    }else{
                        alert(response["message"]);
                    }
             
                }
            });';
    
    ?>

    function ch(answer,id,user_id,test_type){
        var chs='answer_class_'+id;    
        $("."+chs).addClass('disabled_ans');
        
        $.ajax({
                url: '../api/get-mock-result-api.php',
                type: 'post',
                dataType: 'json',
                data: {type:'get_mock_question_res',answer:answer,user_id:user_id,id:id,test_type:test_type},
                success: function (response) {
                    console.log(response);
                    if(response['total_mock']>=3){ 
                        window.alert('Please Login');
                        window.location.href='https://tnpsctestbatch.com/login.php';
                    }
                    if(response['error']){
                        var btn=`<p>
                  <button class="btn btn-primary" id="view_btn_`+id+`" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample_`+id+`" aria-expanded="false" aria-controls="collapseExample">
                    View Explanation
                  </button>
                </p>`;
                        $('#view_expain_'+id).append(btn);
                        // $('#answer_'+id+'_'+answer).css("background","red");
                        $('#answer_'+id+'_'+answer).css("color","red");
                        // $('#answer_'+id+'_'+response['correct_ans']).css("background","green");
                        // $('#answer_'+id+'_'+response['correct_ans']).css("color","white");
                        $('#view_btn_'+id).click(); 
                        
                   }else{
                        // console.log('else part');
                        // $('#view_expain_'+id).empty();
                        // $('#answer_'+id+'_'+response['correct_ans']).css("background","green");
                        // $('#answer_'+id+'_'+response['correct_ans']).css("color","white");
                    }
                }
            });
    }
    
    function commentBtn(){
        
        var user_comment = $("#user_comment").val();
        if(user_comment!=""){
        <?php 
            if(isset($_SESSION['user_exam'])){
                echo $comment_script;
            }else{
                echo 'window.alert("Please Login");
                window.location.href="https://tnpsctestbatch.com/login.php";';
            }
        ?>
        }
    }




     function commentlist(question_id){
         
        alert(question_id);
        $("#ques_id").text(question_id)
        $("#comment_list").empty();
        $.ajax({
                url: "../api/comment.php",
                type: "post", 
                dataType: "json",
                data: {type:"fetch_comments"},
                success: function (response) {
                    console.log(response["comments_list"]);
                    if(response["comments_list"]){
                         $("#comment_list").append(response["comments_list"]);
                    }
                   
                }
            });
    }


     function deletecommet(id){
        
        $("#comment_list").empty();
        $.ajax({
                url: "../api/comment.php",
                type: "post", 
                dataType: "json",
                data: {type:"delete_commet",id:id},
                 success: function (response) {
                    console.log(response);
                    if(response["status"]=="100"){
                       commentlist();
                    }else{
                        alert(response["message"]);
                    }
             
                }
            });
    }
    
     /*function editcommet(id){
          alert("Edit id " +id);
         
        $("#comment_list").empty();
        $.ajax({
                url: "../api/comment.php",
                type: "post", 
                dataType: "json",
                data: {type:"fetch_comments"},
                success: function (response) {
                    console.log(response["comments_list"]);
                    if(response["comments_list"]){
                         $("#comment_list").append(response["comments_list"]);
                    }
                   
                }
            });
    }*/

</script>
<style>
    .disabled_ans{
        pointer-events:none;
        opacity:0.7;
    }
</style>
<?php include "footer.php";?>

<script>
    function finalSubmit(){
        window.location.href="../mock-test-final-result.php?exam_id=<?=$_GET['exam_id'] ?>";
    }
    function submitButton(id){
        alert(id);
    }
</script>

Zerion Mini Shell 1.0