<?php
$A = "D:/G424/1. N Abdillah Ramadlan/Proposal 14461003/REAP/Read/Album/Try/5. Formalhault/T18/Series";
$Video = [
  "Eroge-de-Subete-wa-Kaiketsu-Dekiru-1.mp4","Ima made de Ichiban Yokatta Sex - Episode 1.mp4",
"ima-made-de-ichiban-yokatta-sex-the-animation-episode-2_(1).mp4","ima-made-de-ichiban-yokatta-sex-the-animation.mp4",
"Kaede to Suzu The Animation - Episode 2.mp4","Kaede to Suzu The Animation -Episode 1-720p.mp4",
"knight-of-erin-ep-1-720p.mp4","knight-of-erin-ep-2-720p.mp4",
"knight-of-erin-ep-3-720p.mp4","knight-of-erin-ep-4-720p.mp4",
"Overflow - 01 720p.mp4",
"Overflow Episode 03 English Subbed [1080p].mp4",
"Overflow Episode 2 720p-WEBRip [Eng Subbed].mp4",
"Overflow Episode 4.mp4",
"Princess Lover[HH]direct_PID1726[HD].mp4",
"Princess Lover[HH]direct_PID1728[HD].mp4",
"Shakuen no Eris - Episode 1.mp4",
"Shakuen no Eris - Episode 2.mp4",
"Shakuen no Eris - Episode 3.mp4",
"Shakuen no Eris - Episode 4.mp4",
"Toilet no Hanako-san vs Kukkyou Taimashi - Episode 1.mp4",
"Toshi Densetsu Series - Episode 1.mp4",
"[NekoPoi] Elf ni Inmon o Tsukeru Hon The Animation - 01 [720P].mp4",
"[NekoPoi]_Mayohiga_no_Oneesan_-_01_[uncen]_[720P]_[nekopoi.care].mp4"
];
$Archive = [
  "video1.mp4",
  "video2.mp4",
  "video3.mp4",
  "video4.mp4",
  "video5.mp4",
  "video6.mp4",
  "video7.mp4"
];
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Galeri Video</title>
  <style>
    body{
        background-color: black;
        color: white;
    }
    .gallery {
      display: flex;
      gap: 1rem;
      margin-bottom: 2rem;
      justify-content: center;
    }

    .video-container {
      border: 2px solid #ccc;
      padding: 10px;
      border-radius: 10px;
      width: 300px;
      overflow: hidden;
    }
    .video-title {
            padding: 10px;
            text-align: center;
            font-size: 16px;
            font-weight: bold;
            color: #333;
        }
  </style>
</head>
<body>

<h1>Galeri Video</h1>

    <hr>
<div id="video-wrapper"></div>

<script>
  // Ambil array dari PHP
  const archive = <?php echo json_encode($Archive); ?>;

  const wrapper = document.getElementById('video-wrapper');
  const groupSize = 3;
  const totalGroups = Math.ceil(archive.length / groupSize);

  for (let i = 0; i < totalGroups; i++) {
    const gallery = document.createElement('div');
    gallery.classList.add('gallery');

    for (let j = 0; j < groupSize; j++) {
      const index = i * groupSize + j;
      if (index < archive.length) {
        const videoContainer = document.createElement('div');
        videoContainer.classList.add('video-container');

        const video = document.createElement('video');
        video.src = archive[index];
        video.controls = true;
        video.width = 300;

        videoContainer.appendChild(video);
        gallery.appendChild(videoContainer);
      }
    }

    wrapper.appendChild(gallery);
  }
</script>
    <hr>
        <div class="status">
            <h4>Status</h4><br>
            <h5>Total :</h5> <?php echo count($Archive);?>
            <h5>Connected Archive :</h5>
            <?php include("D:/G424/1. N Abdillah Ramadlan/Proposal 14461003/REAP/Annonate/ReadTXTtoPHP.php"); ?>
        </div>
</body>
</html>
