ok

Mini Shell

Direktori : /home/u243902267/domains/holyhimalayayatra.com/public_html/admin/
Upload File :
Current File : /home/u243902267/domains/holyhimalayayatra.com/public_html/admin/video.php

<?php 
include('include/header.php');
include('include/sidebar.php');

$query = $conn->query("SELECT * FROM video");
$banner = $query->fetch_assoc();


if (isset($_POST['submit'])) {
  $title=$_POST['title'];
  $descp=$_POST['descp'];
  $id=$_POST['banner_id'];
  $video = $_FILES['video']['name'];
  if ($video!='') {
    $path = 'uploads/'.time().$video;
    unlink($video);
  }else{
    $path=$_POST['video_file'];
  }
  if ($id!='') {
   $sql=$conn->query("UPDATE video SET title='$title',description='$descp',file='$path'");
 }else{
  $sql = $conn->query("INSERT INTO video(title,description,file) VALUES('$title','$descp','$path')");
}
if ($sql) {
  move_uploaded_file($_FILES['video']['tmp_name'], $path);
  echo '<script>alert("Save Changes Successfully");location.href="video";</script>';
}
else {
  echo '<script>alert("Something Wrong");</script>';
}
}
?>
<!--start content-->
<main class="page-content">
  <div class="row">
    <div class="col-12 col-lg-8">
      <div class="card shadow-sm border-0">
        <div class="card-body">
          <h5 class="mb-0">Home Video</h5>
          <hr>
          
          <div class="card shadow-none border">
            <div class="card-header">
              <h6 class="mb-0">Video</h6>
            </div>
            <div class="card-body">
              <form class="row g-3" method="post" enctype="multipart/form-data">
                <div class="col-md-12">
                  <label class="form-label">Select Video</label>
                  <input type="hidden" name="banner_id" value="<?=$banner['id']; ?>">
                  <input type="hidden" class="form-control" name="video_file" value="<?=$banner['file']; ?>">
                  <input type="file" class="form-control" name="video" accept="video/*">
                </div>
                <div class="col-md-12">
                  <label class="form-label">Title</label>
                  <input type="text" class="form-control" name="title" value="<?=$banner['title']; ?>">
                </div>
                <div class="col-md-12">
                  <label class="form-label">Description</label>
                  <textarea class="form-control" rows="4" cols="4" placeholder="Description" name="descp"><?=$banner['description']; ?></textarea>
                </div>
                <div class="col-md-6">
                  <button type="submit" name="submit" value="1" class="btn btn-primary px-4">Save Changes</button>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="col-12 col-lg-4">
      <div class="card shadow-sm border-0 overflow-hidden">
        <div class="card-body">
          <div class="profile-avatar text-center">
            <video controls class="w-100">
              <source src="<?=$banner['file']; ?>" type="video/mp4">
              </video>
            </div>
            <div class="text-center mt-4">
              <h4 class="mb-1"><?=$banner['title']; ?></h4>
              <p class="mb-0 text-secondary"><?=$banner['description']; ?></p>
              <div class="mt-4"></div>
            </div>
          </div>
        </div>
      </div>
    </div><!--end row-->

  </main>
  <!--end page main-->
  <?php include('include/footer.php');?>

Zerion Mini Shell 1.0