File "mcq.php"

Full Path: /home/u275821840/domains/padmaclasses.in/public_html/panel/mcq.php
File size: 1.99 KB
MIME-type: text/x-php
Charset: utf-8

<?php
ob_start();
session_start();
include_once('../connect.php');

if(!isset($_SESSION['username']))
{
  header('location:login.php');
}
?>
<!DOCTYPE html>
<html>
  <title>PCC</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
   <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
      <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>  

<body>
<?php include_once("edit_menu.php"); ?>

<div class="container-fluid">
  <p class="well">
    <div class="row">
<div class="col-md-12"> 
  <form action="" method="post" enctype="multipart/form-data">
<table class="table-condensed table-striped" style="width: 100%;"> 
    <tr>
      <td><input type="file" name="file" multiple="" /></td>  
      <td><input type="submit" class="btn btn-info" name="submit" value="upload"></td>
    </tr>
     </table>
	 </form>
  </p>
</div>
</div>

 <h4 class="well" style='font-weight:bold;'>Upload Test Series </h4>
 <div class="row">
    
<?php
    $mcqbook = glob("../test_series/*");
    foreach($mcqbook as $mcq)
      {
      echo 
        '<div class="col-md-2">
        <embed src="'.$mcq.'" style="width:200px;height:200px"> 
        <br>
       	 <a class="btn-danger" href="mcq.php?delx='.$mcq.'" id="del">Delete</a>   
        </div>';
      }
    ?>  
</div> 
</div>

<?php

if(isset($_POST["submit"]))
{
    $id= $_POST['id'];
   $file=$_FILES["file"]["name"];
  $tmp_name=$_FILES["file"]["tmp_name"];
  $path="../test_series/".$file;

 move_uploaded_file($tmp_name,$path);
 //if(mysqli_query($db,"insert into test_series (file) values ('$file')"))
 
  header ("location:mcq.php"); 
}
?>


 <?php
if(isset($_GET['delx']))
  {

    $x = $_GET['delx'];
   // $sql = mysqli_query($db,"delete from test_series where id = '$x'");
    unlink($x);
    header("location:mcq.php");

  }
?>