����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 162.0.232.25 / Your IP : 3.149.24.70 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']); $link = mysqli_real_escape_string($conn, $_POST['link']); $calender = mysqli_real_escape_string($conn, $_POST['calender']); $_SESSION['title'] = $title; $_SESSION['link'] = $link; $_SESSION['calender'] = $calender; //new image name with its particular extension $image_new_name = filter_file('workshop-' . date('Ymd-His') . $extension); $location = './workshops/'; //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 `workshops`(`title`,`link`,`calender`,`image`) VALUES('$title','$link','$calender','$image_new_name')"; //checking if the query has run successfully if (mysqli_query($conn, $sql)) { unset($_SESSION['title'], $_SESSION['link']) ?> <script type="text/javascript"> swal("", "workshop was successfully uploaded", "success"); </script> <?php } else { die(mysqli_error($conn)); } } else { ?> <script type="text/javascript"> swal("", "Failed to upload workshop", "error"); </script> <?php } } else { ?> <script type="text/javascript"> swal("", "<?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 Image</span> </label> <div class="form-floating mb-3 mt-2"> <input type="text" name="title" class="form-control" id="floatingInput" placeholder="workshop Title" value="<?php echo isset($_SESSION['title']) ? $_SESSION['title'] : ''; ?>" required> <label for="floatingInput">Workshop Title</label> </div> <div class="form-floating mb-3 mt-2"> <input type="text" name="link" class="form-control" id="floatingInput" placeholder="workshop Title" value="<?php echo isset($_SESSION['link']) ? $_SESSION['link'] : ''; ?>" required> <label for="floatingInput">Workshop Drive Link</label> </div> <div class="form-floating mb-3 mt-2"> <input type="text" name="calender" class="form-control" id="floatingInput" placeholder="workshop Title" value="<?php echo isset($_SESSION['calender']) ? $_SESSION['calender'] : ''; ?>" required> <label for="floatingInput">Google Calender Link</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> <?php if ($user_type == 1) { ?> document.querySelectorAll(".navbar-nav a")[4].classList.add("active"); <?php } else { ?> document.querySelectorAll(".navbar-nav a")[1].classList.add("active"); <?php } ?> document.querySelector("title").innerText = "New Workshop"; </script> <?php include './footer.php'; ?>