
<?php 
include("database.php");
?>


<?php

$uniqueUrl = $_GET['url'];
$sql = "SELECT pdf_file FROM pdf_files WHERE unique_url = '$uniqueUrl'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    $row = $result->fetch_assoc();
    $pdfFile = $row['pdf_file'];
} else {
    die("PDF not found.");
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Flipbook Viewer</title>




    <!-- Flipbook StyleSheet -->
<link href="lib/css/main.css" rel="stylesheet">
<!-- Icons Stylesheet -->
<link href="lib/css/themify-icons.min.css" rel="stylesheet">

<script src="https://cdn.tailwindcss.com"></script>



    <script src="lib/js/libs/jquery.min.js"></script>
    <script src="lib/js/flip.js"></script>
</head>
<body>

    <div id="flipbookContainer"></div>

    <script>
        $(document).ready(function () {
            var options = {
                height: 750,
                duration: 700,
                backgroundColor: "#2F2D2F",
                soundEnable: true,
                useTouch: true
            };
            $("#flipbookContainer").flipBook("<?php echo $pdfFile; ?>", options);
        });
    </script>

</body>
</html>