Server IP : 162.214.80.37 / Your IP : 216.73.216.83 Web Server : Apache System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : imyrqtmy ( 2189) PHP Version : 8.2.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home2/imyrqtmy/public_html/vssvclinic/Admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php // session_start(); include 'Includes/db.php'; if(isset($_POST['update_pass'])){ $id = $_POST['id']; // $name = $_POST['name']; $password = $_POST['password']; $query = "UPDATE tbl_admin SET password='$password' WHERE id ='$id' "; $query_run = mysqli_query($con ,$query); if($query_run){ $_SESSION['status'] = "Updated Successfully"; header('Location: view-password.php'); } else { $_SESSION['status'] = "Not Updated Successfully"; header('Location: view-password.php'); } } // if(isset($_POST['update_cat'])){ // $id = $_POST['id']; // $category = $_POST['category']; // $shortdesc = $_POST['shortdesc']; // $longdesc = $_POST['longdesc']; // $old_photo = $_POST['image_old']; // $update_filename = $_FILES["photo"]["name"] ? $_FILES["photo"]["name"] : $old_photo; // if(file_exists("categoryimage/".$_FILES['photo']['name'])) // { // $filename = $_FILES['photo']['name']; // $_SESSION['status'] = "photo Already Exists".$filename; // header('Location: ../view-category.php'); // } // else{ // $query = "UPDATE categories SET category='$category', shortdesc='$shortdesc', longdesc='$longdesc', photo='$update_filename' WHERE id ='$id' "; // $query_run = mysqli_query($con ,$query); // if($query_run){ // if($_FILES["photo"]["name"] !=''){ // move_uploaded_file($_FILES["photo"]["tmp_name"], "categoryimage/".$_FILES["photo"]["name"]); // unlink("categoryimage/". $old_photo); // } // $_SESSION['status'] = "Updated Successfully"; // header('Location: ../view-category.php'); // }else{ // $_SESSION['status'] = "Not Updated Successfully"; // header('Location: ../view-category.php'); // } // } // } if(isset($_POST['delete_cat'])){ $id = $_POST['delete_id']; $photo = $_POST['del_category']; $query = "DELETE FROM categories WHERE id= '$id' "; $query_run = mysqli_query($con, $query); if($query_run){ unlink("upcategoryimage/".$photo); $_SESSION['status'] = "Deleted successfully"; header("Location: ../view-category.php"); exit(0); } else{ $_SESSION['status'] = "Category Not Deleted"; header("Location: ../view-category.php"); } } ?> <!-- $photo =$_FILES['photo']['name']; $allowed_extension = array('gif','png','jpg','jpeg'); $filename = $_FILES['photo']['name']; $file_extension = pathinfo($filename, PATHINFO_EXTENSION); if(!in_array($file_extension, $allowed_extension)){ $_SESSION['status'] = "This File is Not An Image"; header('Location: ../add-category.php'); } else{ if(file_exists("categoryimage/".$_FILES['photo']['name'])){ $filename = $_FILES['photo']['name']; $_SESSION['status'] = "Image Already Exists".$filename; header('Location: ../view-category.php'); } else{ $query = "INSERT INTO categories (category, shortdesc, longdesc, photo) VALUES ('$category','$shortdesc','$longdesc','$photo')"; $query_run = mysqli_query($con, $query); if($query_run){ move_uploaded_file($_FILES["photo"]["tmp_name"], "categoryimage/".$_FILES["photo"]["name"]); $_SESSION['status'] = "image Uploaded Successfully"; header('Location: ../view-category.php'); } else{ $_SESSION['status'] = "Image Not Uploaded Successfully"; header('Location: ../add-category.php'); } } } } -->