����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 162.0.232.25 / Your IP : 3.14.131.115 Web Server : LiteSpeed System : Linux premium276.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : kwacuqig ( 988) PHP Version : 8.2.26 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/kwacuqig/learn.skilltainment.org/ |
Upload File : |
<?php include './sidebar.php'; include './navbar.php'; if (isset($_POST['submit'])) { $image_name = strtolower($_FILES['image']['name']); $image_type = $_FILES['image']['type']; $image_size = $_FILES['image']['size']; $image_tmp_name = $_FILES['image']['tmp_name']; switch ($image_type) { case 'image/png': $extension = ".png"; break; case 'image/jpg': $extension = ".jpg"; break; case 'image/jpeg': $extension = ".jpg"; break; case 'image/gif': $extension = ".gif"; default: $extension = ".jpg"; } $title = mysqli_real_escape_string($conn, $_POST['title']); $mode = mysqli_real_escape_string($conn, htmlentities($_POST['mode'])); $details = mysqli_real_escape_string($conn, $_POST['details']); $_SESSION['title']=$title; $_SESSION['title']=$details; //new image name with its particular extension $image_new_name = filter_file('skilltainment-' . date('Ymd-His') . $extension); $location = './playlists/img/'; //checking if file to be uploaded is an image if ($image_type == 'image/JPG' || $image_type == 'image/jpeg' || $image_type == 'image/png' || $image_type == 'image/jpg') { //checking if both audio and image are uploaded if (compressImage($image_tmp_name, $location . $image_new_name, 50)) { $sql = "INSERT INTO `playlists`(`title`,`image`,`details`,`mode`,`time`) VALUES('$title','$image_new_name','$details','$mode', ". strtotime(date("Y-m-d h:i:sa")) . ")"; //checking if the query has run successfully if (mysqli_query($conn, $sql)) { unset($_SESSION['title'],$_SESSION['details']) ?> <script type="text/javascript"> swal("SUCCESS", "Playlist was successfully uploaded", "success"); </script> <?php } else { die(mysqli_error($conn)); } } else { ?> <script type="text/javascript"> swal("ERROR", "Failed to upload playlist", "error"); </script> <?php } } else { ?> <script type="text/javascript"> swal("ERROR", "<?php echo $image_new_name; ?> is not an image", "error"); </script> <?php } } ?> <div class="container-fluid pt-4 px-4"> <div class="row g-2"> <div class="col-12"> <div class="bg-secondary rounded h-100 p-4"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data"> <input type="file" name="image" id="file-2" class="inputfile inputfile-2" data-multiple-caption="{count} files selected" accept=".jpg, .png, .jpeg" multiple required /> <label for="file-2"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" viewBox="0 0 20 17"> <path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z" /> </svg> <span>Select Thumbnail</span> </label> <div class="form-floating mb-3 mt-2"> <input type="text" name="title" class="form-control" id="floatingInput" placeholder="Playlist Title" value="<?php echo isset($_SESSION['title']) ? $_SESSION['title'] : '';?>" required> <label for="floatingInput">Playlist Title</label> </div> <div class="form-floating mb-3"> <textarea class="form-control" name="details" placeholder="Leave a comment here" id="floatingTextarea" style="height: 150px;" required><?php echo isset($_SESSION['details']) ? $_SESSION['details'] : '';?></textarea> <label for="floatingTextarea">Playlist Details</label> </div> <div class="form-floating mb-3"> <select class="form-select" name="mode" id="floatingSelect" aria-label="Floating label select example" required> <option value="0" selected>Free</option> <option value="1">Subscription</option> </select> <label for="floatingSelect">Playlist Mode</label> </div> <button type="submit" name="submit" class="btn btn-primary py-3 w-100 my-4"><i class="fa fa-upload"></i> Upload</button> </form> </div> </div> </div> </div> <script> document.querySelectorAll(".navbar-nav a")[1].classList.add("active"); </script> <?php include './footer.php'; ?>