Mini Shell

Direktori : /home/rizant5/public_html-1210/student/
Upload File :
Current File : //home/rizant5/public_html-1210/student/test_question.php

<?php 

require_once("../config.php");

require_once("function-file.php");

require_once("function-menu.php");

cookiecheck();

// $chapter_id = '40';
$question_id = $_REQUEST['que'];

// $datas=$conn->prepare("select * from chapters where chapter_id='$chapter_id'");

// $datas->execute();$result=$datas->fetch();

// if(isset($_POST['save']))

// {

//   $text=$_POST['question'];

//   $conn->exec("insert into question (topic_id,stu_id,datetime,text) values ('$topic_id','$_COOKIE[userid]',NOW(),'$text')");

//   header("location:read-topic.php?topic_id=$topic_id#questions");

// }

?>

<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>Question Paper</title>

    <!-- Tell the browser to be responsive to screen width -->

    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <?php  cssfile();?>

    <style type="text/css">

            #load { 

                width:30px;

                padding-top:50px;

                border:0px green dashed;

                margin:0 auto;

            }

            #paginate {

                border:0px green solid;

                width:100%;

                margin:0 auto;

            }

            #paginate li{ 

                list-style: none; 

                float: left;

                margin-right: 16px; 

                padding:5px; 

        width:80%;

            }

      .page{    background: #3c8dbc;

    color: #fff;

    font-weight: bold;width:5% !important;}

            .page:hover { 

                color:#ddd; 

                cursor: pointer; 

            }.hidden { display: none; }

      .active{display:inline !important;}

      .left{float:left}.ex-radio{width:20px;height:20px;cursor:pointer;}.rad{margin-top: -5px;}

      .answer{    color: #00a65a; font-weight: bold;display:none}.hint{display:none;}

            #paginate > li:not(.page) .btn-info{ min-width: 109px; }

            .content img{ max-width: 100%; }

            .answer_box{ display: inline-block; border: 1px solid #00acd6; padding: 4px 10px 8px 6px; background-color: #C0D5FF; border-radius: 3px; }

@media (max-width: 550px){
  table, table *{ display: block; }
  table .left{ float: none; }
  table td{ overflow: hidden; }
}

@media (max-width: 767px){
  #prev, #next{ margin-top: 10px; }
  .answer_box{ display: block;margin-top: 10px;max-width: 196px; }
}

        </style>

  </head>

  <body class="hold-transition skin-blue layout-top-nav">

    <!-- Site wrapper -->

    <div class="wrapper">

<?php headermenu();?>

      <!-- =============================================== -->

      <!-- Content Wrapper. Contains page content -->

      <div class="content-wrapper">

        <!-- Content Header (Page header) -->

        <!-- Main content -->

        <section class="content">

          <!-- Default box -->

          <div class="box">

            <div class="box-header with-border">

              <h3 class="box-title">Please select the correct answer and click the (Check Answer and Learn More) button given below to verify your answer and learn more.</h3>

              <div class="box-tools pull-right">

                <!-- <a  href="javascript:history.back()" class="btn btn-info btn-sm" ><i class="fa fa-angle-double-left"></i> Back</a> -->
                <a class="btn btn-info btn-sm close_lightbox" onclick="parent.close_lightbox()"><i class="fa fa-angle-double-left"></i> Back</a>

              </div>

            </div>

            <div class="box-body">

              <div class="form-group">

                  <div>

                    <ul id="paginate">

                           <!-- <li id="" class="page" data-value="prev"><< Prev</li> -->

                           <?php 

                           //$id = $_POST['id'];

                           $data=$conn->prepare("select * from test_papers where id='$question_id'");

                  $data->execute();$result=$data->fetchall();$nums=$data->rowcount();$i=1;

                foreach($result as $row){?>

                    <li id="<?php echo $i;?>" class="hidden <?php if($i==1){echo"active";}?>">

                        <table class="table table-bordered table-striped">

                            <thead><tr><td><span class="left"><b>The Question&nbsp;</b></span><span class="left"> 
                              <?php echo $row['question'];?></span></td></tr></thead>

                            <tr><td><span class="left rad"><input name="option<?php echo $i;?>" type="radio" class="ex-radio" value="A">&nbsp;
                            </span><span class="left"><b>1. </b></span><span class="left"><?php echo $row['a'];?></span></td></tr>

                            <tr><td><span class="left rad"><input name="option<?php echo $i;?>" type="radio" class="ex-radio" value="B">&nbsp;
                            </span><span class="left"><b>2. </b></span><span class="left"><?php echo $row['b'];?></span></td></tr>

                            <tr><td><span class="left rad"><input name="option<?php echo $i;?>" type="radio" class="ex-radio" value="C">&nbsp;
                            </span><span class="left"><b>3. </b></span><span class="left"><?php echo $row['c'];?></span></td></tr>

                            <tr><td><span class="left rad"><input name="option<?php echo $i;?>" type="radio" class="ex-radio" value="D">&nbsp;
                            </span><span class="left"><b>4. </b></span><span class="left"><?php echo $row['d'];?></span></td></tr>

                        </table>

                            <hr>

                            <input type="hidden" id="answer<?php echo $i;?>" value="<?php echo $row['answer'];?>">

                            <div class="scroller_div"><button type="button" class="btn btn-info" onClick="answer('<?php echo $i;?>')">Check Answer and Learn More</button> 
                            <?php
                            if($row['answer'] == 'A'){ $ans = 1; }
                            elseif($row['answer'] == 'B'){ $ans = 2; }
                            elseif($row['answer'] == 'C'){ $ans = 3; }
                            elseif($row['answer'] == 'D'){ $ans = 4; }
                            ?>
                            <div class="answer_box" style="display:none;"><span class="answer answer<?php echo $i;?>">&nbsp;<?php echo $ans;//echo $row['answer'];?>&nbsp;&nbsp;</span><span class="ansmsg<?php echo $i;?>"></span></div>

                            <?php 
                              //echo $row['year'],$row['subject_id'];
                              
                              $year = $row['year'];
                              $subject_id = $row['subject'];
                              $chapter_id = $row['chapter'];
                              //echo $question_id;
                              $data=$conn->prepare("select * from test_papers where chapter='$chapter_id' and id<'$question_id' and subject='$subject_id' and year='$year' ORDER BY id DESC LIMIT 1");

                              $data->execute();$result=$data->fetchall();$nums=$data->rowcount();$i=1;
                              
                              foreach($result as $row0){ 
                                  $id = $row0['id']?>

                                  <a id="prev" class="btn btn-info html5lightbox" href='../student/test_question.php?que=<?php echo $id?>'></i> Prev </a>

                              <?php }

                              $data=$conn->prepare("select * from test_papers where chapter='$chapter_id' and id>'$question_id' and subject='$subject_id' and year='$year' LIMIT 1");

                              $data->execute();$result=$data->fetchall();$nums=$data->rowcount();$i=1;
                              
                              foreach($result as $row1){ 
                                  $id1 = $row1['id'];?>

                                  <a id="next" class="btn btn-info html5lightbox" href='../student/test_question.php?que=<?php echo $id1?>'>
                                  </i> Next </a>

                              <?php } ?>

                            </div>

                            <hr>

                            <!-- <div><button type="button" class="btn btn-info" onClick="hint('<?php echo $i;?>')">Show Hint</button></div> -->

                            <div class="hint hint<?php echo $i;?>"><?php echo $row['showhint'];?></div>

                            </li>

                            <?php $i++;}?>

                            <!-- <li id="" class="page" data-value="next">Next >></li> -->

                    </ul>   

            </div>

              </div>

            </div><!-- /.box-body -->

          </div><!-- /.box -->

          <!-- /.box -->

        </section><!-- /.content -->

      </div></div><!-- /.content-wrapper -->

      <?php footer_without_chat();?>

    </div><!-- ./wrapper -->

   <?php jsfile();?>

    <script type="text/javascript">

            $(document).ready(function() {
              parent.hide_load();

            function Display_Load() {

                $("#load").fadeIn(1000, 0);

                $("#load").html("<img src='load.gif' />");

            }



            function Hide_Load() {

                $("#load").fadeOut('slow');

            };


            Display_Load();

            $("#content").load("pagination.php?page=1", Hide_Load());



            <?php $page; ?>



            $("#paginate li").not('.page').click(function() {

                Display_Load();

                $("#paginate li").css({

                }).css({

                }).removeClass("active");

                $(this).css({

                }).css({

                    'border': 'none'

                }).addClass("active");

                var pageNum = this.id;

                $("#content").load("pagination.php?page=" + pageNum, Hide_Load());



            });



            $("#paginate li.page").click(function() {

                var page = $(this).attr("data-value");

                if (page == "prev") {

                    var index = $("#paginate li.active").index();

                    if (index > 1) {

                        $("#paginate li.active").prev().trigger("click");

                    } else {

                        $("#paginate li.active").trigger("click");

                    }

                } else {

                    var index = $("#paginate li.active").index();

                    if (index < $("#paginate li").length - 2) {

                        $("#paginate li.active").next().trigger("click");

                    } else {

                        $("#paginate li.active").trigger("click");

                    }

                }

            });

        });

        </script>

<script>

function answer(id){

  if($("input[name='option"+id+"']:checked").val()) {

    $(".answer"+id).show();

    $(".answer_box").removeAttr('style');

    var radioValue = $("input[name='option"+id+"']:checked").val();

    var answer=$("#answer"+id).val();

    if(radioValue==answer){$(".ansmsg"+id).html('Your answer is correct!!').css({'color': '#00a65a'});}

    else{$(".ansmsg"+id).html('Your answer is wrong!!').css({'color': '#dd4b39'});}

    hint(id);

  }

  else{alert("Please select a option");}

}

function hint(id){

  if($("input[name='option"+id+"']:checked").val()) {

    $(".hint"+id).show();

    var body = $("html, body");
    var scrolltop = $(".scroller_div").offset().top - 20;
    body.stop().animate({scrollTop:scrolltop}, 500, 'swing');

    }

  else{alert("Please select a option");}

}

$('header a, footer a').click(function(e){
  e.preventDefault();
  parent.redirect($(this).attr('href'));
})
</script>        

</body>

</html> 

Zerion Mini Shell 1.0