Server : LiteSpeed
System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64
User : outerorb ( 1091)
PHP Version : 8.1.34
Disable Function : mail
Directory :  /home2/outerorb/dev.outerorbittech.com/oot/admin/

📁 Create New:
⬆️ Upload File:
Current Dir [ Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: addeditblog.php

Path: //home2/outerorb/dev.outerorbittech.com/oot/admin/addeditblog.php

Size: 66.1 KB

Permissions: 0644

<?php
include_once("../include/main.inc.php");
check_session('MyCpanel', 'index.php');
@extract($_REQUEST);
// error_reporting(1);

// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
if (empty($catID)) {
  $heading = "Add New blog";
} else {
  $heading = "Edit blog";
}
$record_type = "blog";
$script_name = "addeditblog.php";
$redirect_script_name = "manage-blog.php";
$table_name = "blog_tbl";
#################### Add Record  ##################
$id = isset($_GET['id']) ? $_GET['id'] : null;
if ($id == 'remove_image') {
  db_query("UPDATE $table_name SET $field='' where catID = '$catID'");
  $_SESSION['session_message'] = '<div class"btn btn-success">' . $record_type . ' has been updated successfully</div>';
  header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
  exit;
}
// if ($_REQUEST['action'] == "add_record" && $catName != "") {

  if ($_REQUEST['action'] == "add_record") {
  $catDesc = isset($_POST['catDesc']) ? $_POST['catDesc'] : '';  
  $catDesc1 = isset($_POST['catDesc1']) ? $_POST['catDesc1'] : '';
  $catDesc = $_POST['catDesc'];
  $catDesc1 = $_POST['catDesc1'];
  $catgurl = clean($catName);

  $numCnt = getCount($table_name, " where catName='$catName'");
  if ($numCnt > 0) {
    $_SESSION['session_message'] = $record_type . ' already exist';
  } else {
    if ($_FILES['image']['name'] != "") {
      
      $file_extension = strtolower(getExtension($_FILES['image']['name']));
      if ($file_extension != "jpg" && $file_extension != "gif" && $file_extension != "jpeg" && $file_extension != "png" && $file_extension != "webp") {
        $_SESSION['session_message'] = '<div class="btn btn-success">Please upload image (.jpg,.gif,.png Format Only)</div>';
        header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
        exit;
      }
      if ($_FILES['image']['name'] != "") {
       
        $img_name = $catgurl.uniqid();
        $img = upload_file($img_name, "image", "uploaded-files/blog/images");

        $width = "460";
        $height = "391";

        $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
        saveResizedPhoto($img, $width, $height, $source_folder, $destination_folder);

      }
      // echo $img;die;
      if ($_FILES['image1']['name'] != "") {

        $tempPath = $_FILES['image1']['tmp_name'];
        $imageSize = getimagesize($tempPath);
        if ($imageSize !== false) {
          $height = $imageSize[1];
        }

        $head1 = clean($heading1);
        $img_name1 = $head1.uniqid();
        $img1 = upload_file($img_name1, "image1", "uploaded-files/blog/images");

        $width = "800";
        $height = "600";

        $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
        saveResizedPhoto($img1, $width, $height, $source_folder, $destination_folder);

      }

      if ($_FILES['image2']['name'] != "") {

        $tempPath = $_FILES['image2']['tmp_name'];
        $imageSize = getimagesize($tempPath);
        if ($imageSize !== false) {
          $height = $imageSize[1];
        }

        $head2 = clean($heading2);
        $img_name2 = $head2.uniqid();
        $img2 = upload_file($img_name2, "image2", "uploaded-files/blog/images");

        $width = "800";
        $height = $height;

        $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
        saveResizedPhoto($img2, $width, $height, $source_folder, $destination_folder);

      }

      if ($_FILES['image3']['name'] != "") {

        $tempPath = $_FILES['image3']['tmp_name'];
        $imageSize = getimagesize($tempPath);
        if ($imageSize !== false) {
          $height = $imageSize[1];
        }

        $head3 = clean($heading3);
        $img_name3 = $head3.uniqid();
        $img3 = upload_file($img_name3, "image3", "uploaded-files/blog/images");

        $width = "800";
        $height = $height;

        $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
        saveResizedPhoto($img3, $width, $height, $source_folder, $destination_folder);

      }

      if ($_FILES['image4']['name'] != "") {

        $tempPath = $_FILES['image4']['tmp_name'];
        $imageSize = getimagesize($tempPath);
        if ($imageSize !== false) {
          $height = $imageSize[1];
        }

        $head4 = clean($heading4);
        $img_name4 = $head4.uniqid();
        $img4 = upload_file($img_name4, "image4", "uploaded-files/blog/images");

        $width = "800";
        $height = $height;

        $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
        saveResizedPhoto($img4, $width, $height, $source_folder, $destination_folder);

      }

      if ($_FILES['image5']['name'] != "") {

        $tempPath = $_FILES['image5']['tmp_name'];
        $imageSize = getimagesize($tempPath);
        if ($imageSize !== false) {
          $height = $imageSize[1];
        }

        $head5 = clean($heading5);
        $img_name5 = $head5.uniqid();
        $img5 = upload_file($img_name5, "image5", "uploaded-files/blog/images");

        $width = "800";
        $height = $height;

        $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
        saveResizedPhoto($img5, $width, $height, $source_folder, $destination_folder);

      }

      if ($_FILES['image6']['name'] != "") {

        $tempPath = $_FILES['image6']['tmp_name'];
        $imageSize = getimagesize($tempPath);
        if ($imageSize !== false) {
          $height = $imageSize[1];
        }

        $head6 = clean($heading6);
        $img_name6 = $head6.uniqid();
        $img6 = upload_file($img_name6, "image6", "uploaded-files/blog/images");

        $width = "800";
        $height = $height;

        $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
        saveResizedPhoto($img6, $width, $height, $source_folder, $destination_folder);

      }

      if ($_FILES['image7']['name'] != "") {

        $tempPath = $_FILES['image7']['tmp_name'];
        $imageSize = getimagesize($tempPath);
        if ($imageSize !== false) {
          $height = $imageSize[1];
        }

        $head7 = clean($heading7);
        $img_name7 = $head7.uniqid();
        $img7 = upload_file($img_name7, "image7", "uploaded-files/blog/images");

        $width = "800";
        $height = $height;

        $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
        saveResizedPhoto($img7, $width, $height, $source_folder, $destination_folder);

      }

      if ($_FILES['image8']['name'] != "") {

        $tempPath = $_FILES['image8']['tmp_name'];
        $imageSize = getimagesize($tempPath);
        if ($imageSize !== false) {
          $height = $imageSize[1];
        }

        $head8 = clean($heading8);
        $img_name8 = $head8.uniqid();
        $img8 = upload_file($img_name8, "image8", "uploaded-files/blog/images");

        $width = "800";
        $height = $height;

        $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
        saveResizedPhoto($img8, $width, $height, $source_folder, $destination_folder);

      }

      if ($_FILES['image9']['name'] != "") {

        $tempPath = $_FILES['image9']['tmp_name'];
        $imageSize = getimagesize($tempPath);
        if ($imageSize !== false) {
          $height = $imageSize[1];
        }

        $head9 = clean($heading9);
        $img_name9 = $head9.uniqid();
        $img9 = upload_file($img_name9, "image9", "uploaded-files/blog/images");

        $width = "800";
        $height = $height;

        $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
        saveResizedPhoto($img9, $width, $height, $source_folder, $destination_folder);

      }

      if ($_FILES['image10']['name'] != "") {

        $tempPath = $_FILES['image10']['tmp_name'];
        $imageSize = getimagesize($tempPath);
        if ($imageSize !== false) {
          $height = $imageSize[1];
        }

        $head10 = clean($heading10);
        $img_name10 = $head10.uniqid();
        $img10 = upload_file($img_name10, "image10", "uploaded-files/blog/images");

        $width = "800";
        $height = $height;

        $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
        $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
        saveResizedPhoto($img10, $width, $height, $source_folder, $destination_folder);

      }

    }

    $maxRes = db_fetch_array(db_query("select max(catOrder) from $table_name"));
    $catOrder = $maxRes[0] + 1;
    if ($blogDname == '') {
      $blogDname = $catName;
    }

   
    $catName = htmlentitiesDecode($catName);
    $blogDname = htmlentitiesDecode($blogDname);
    $pageDescription = htmlentitiesDecode($pageDescription);
    $catDesc = htmlentitiesDecode($catDesc);
    $heading1 = htmlentitiesDecode($heading1);
    $content1 = htmlentitiesDecode($content1);
    $heading2 = htmlentitiesDecode($heading2);
    $content2 = htmlentitiesDecode($content2);
    $heading3 = htmlentitiesDecode($heading3);
    $content3 = htmlentitiesDecode($content3);
    $heading4 = htmlentitiesDecode($heading4);
    $content4 = htmlentitiesDecode($content4);
    $heading5 = htmlentitiesDecode($heading5);
    $content5 = htmlentitiesDecode($content5);
    $heading6 = htmlentitiesDecode($heading6);
    $content6 = htmlentitiesDecode($content6);
    $heading7 = htmlentitiesDecode($heading7);
    $content7 = htmlentitiesDecode($content7);
    $heading8 = htmlentitiesDecode($heading8);
    $content8 = htmlentitiesDecode($content8);
    $heading9 = htmlentitiesDecode($heading9);
    $content9 = htmlentitiesDecode($content9);
    $heading10 = htmlentitiesDecode($heading10);
    $content10 = htmlentitiesDecode($content10);
    // echo "insert into $table_name set catName='$catName',blogDname='$blogDname',blog_written='$blog_written', catDesc='$catDesc', catDesc1='$catDesc1', catImage='$img', catOrder='$catOrder', pageTitle='$pageTitle', pageKeywords='$pageKeywords', pageDescription='$pageDescription', blogDate='$blogDate',catgurl='$catgurl', heading1='$heading1',
    // content1='$content1',ytvideo1='$ytvideo1',image1='$img1',heading2='$heading2',content2='$content2',ytvideo2='$ytvideo2',image2='$img2',heading3='$heading3', content3='$content3', ytvideo3='$ytvideo3', image3='$img3', heading4='$heading4', content4='$content4', ytvideo4='$ytvideo4', image4='$img4', heading5='$heading5', content5='$content5', ytvideo5='$ytvideo5', image5='$img5', heading6='$heading6', content6='$content6', ytvideo6='$ytvideo6', image6='$img6', heading7='$heading7', content7='$content7', ytvideo7='$ytvideo7', image7='$img7', heading8='$heading8', content8='$content8', ytvideo8='$ytvideo8', image8='$img8', heading9='$heading9', content9='$content9', ytvideo9='$ytvideo9', image9='$img9', heading10='$heading10', content10='$content10', ytvideo10='$ytvideo10', image10='$img10'";
   
    $sql = db_query("insert into $table_name set catName='$catName',blogDname='$blogDname',blog_written='$blog_written', catDesc='$catDesc', catDesc1='$catDesc1', catImage='$img', catOrder='$catOrder', pageTitle='$pageTitle', pageKeywords='$pageKeywords', pageDescription='$pageDescription', blogDate='$blogDate',catgurl='$catgurl', heading1='$heading1',
    content1='$content1',ytvideo1='$ytvideo1',image1='$img1',heading2='$heading2',content2='$content2',ytvideo2='$ytvideo2',image2='$img2',heading3='$heading3', content3='$content3', ytvideo3='$ytvideo3', image3='$img3', heading4='$heading4', content4='$content4', ytvideo4='$ytvideo4', image4='$img4', heading5='$heading5', content5='$content5', ytvideo5='$ytvideo5', image5='$img5', heading6='$heading6', content6='$content6', ytvideo6='$ytvideo6', image6='$img6', heading7='$heading7', content7='$content7', ytvideo7='$ytvideo7', image7='$img7', heading8='$heading8', content8='$content8', ytvideo8='$ytvideo8', image8='$img8', heading9='$heading9', content9='$content9', ytvideo9='$ytvideo9', image9='$img9', heading10='$heading10', content10='$content10', ytvideo10='$ytvideo10', image10='$img10'");
    $_SESSION['session_message'] = '<div class"btn btn-success">' . $record_type . ' has been updated successfully</div>';
    header("Location: " . SITE_ADMIN_URL . "/" . $redirect_script_name);
    exit;
  }
}

################ Update Record  ##################
// if ($_REQUEST['action'] == "update_record" && $catName != "") {
  if (isset($_REQUEST['action']) && $_REQUEST['action'] == "update_record" && $catName != "") {
    $catDesc = isset($_POST['catDesc']) ? $_POST['catDesc'] : '';  // Default to empty string if not set
    $catDesc1 = isset($_POST['catDesc1']) ? $_POST['catDesc1'] : ''; // Default to empty string if not set
  // $catDesc = $_POST['catDesc'];
  // $catDesc1 = $_POST['catDesc1'];
  $catgurl = clean($catName);
  // $numCnt = getCount($table_name, " where catName='$catName'");
  // if ($numCnt > 0) {
  //   $_SESSION['session_message'] = '<div class="btn btn-warning">' . $record_type . ' already exist</div>';
  //   header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
  //   exit;
  // }

  if ($_FILES['image']['name'] != "") {
    $file_extension = strtolower(getExtension($_FILES['image']['name']));
    if ($file_extension != "jpg" && $file_extension != "gif" && $file_extension != "jpeg" && $file_extension != "png" && $file_extension != "webp") {
      $_SESSION['session_message'] = '<div class="btn btn-warning">Please upload image (.jpg,.gif,.png Format Only)</div>';
      header("Location: " . SITE_ADMIN_URL . "/" . $script_name);
      exit;
    }
    if ($_FILES['image']['name'] != "") {
      $categoryRes = getResult($table_name, " where catID='$catID'", "catImage");
      $filename = $categoryRes['catImage'];
      if ($filename != "") {
        $file = SITE_DIR_PATH . "/uploaded-files/blog/images/" . $filename;
        if (file_exists($file)) {
          unlink($file);
        }
      }
      $img_name = $catgurl.uniqid();
      $img = upload_file($img_name, "image", "uploaded-files/blog/images");

      $width = "460";
      $height = "391";
      
      $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
      $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
      saveResizedPhoto($img, $width, $height, $source_folder, $destination_folder);


      updateTable($table_name, " catImage='$img' where catID='$catID'");
    }
  }


  if ($_FILES['image1']['name'] != "") {
   
   
    $categoryRes = getResult($table_name, " where catID='$catID'", "image1");
    $filename = $categoryRes['image1'];
    if ($filename != "") {
      $file = SITE_DIR_PATH . "/uploaded-files/blog/images/" . $filename;
      if (file_exists($file)) {
        unlink($file);
      }

      $file1 = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/" . $filename;
      if (file_exists($file1)) {
        unlink($file1);
      }
    }
    $tempPath = $_FILES['image1']['tmp_name'];
    $imageSize = getimagesize($tempPath);
    if ($imageSize !== false) {
      $height = $imageSize[1];
    }

    $head1 = clean($heading1);
    $img_name1 = $head1.uniqid();
    $img1 = upload_file($img_name1, "image1", "uploaded-files/blog/images");

    $width = "800";
    $height = $height;

    $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
    $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
    saveResizedPhoto($img1, $width, $height, $source_folder, $destination_folder);

    updateTable($table_name, " image1='$img1' where catID='$catID'");
  }


  if ($_FILES['image2']['name'] != "") {
   
    $categoryRes = getResult($table_name, " where catID='$catID'", "image2");
    $filename = $categoryRes['image2'];
    if ($filename != "") {
      $file = SITE_DIR_PATH . "/uploaded-files/blog/images/" . $filename;
      if (file_exists($file)) {
        unlink($file);
      }

      $file1 = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/" . $filename;
      if (file_exists($file1)) {
        unlink($file1);
      }
    }
    $tempPath = $_FILES['image2']['tmp_name'];
    $imageSize = getimagesize($tempPath);
    if ($imageSize !== false) {
      $height = $imageSize[1];
    }

    $head2 = clean($heading2);
    $img_name2 = $head2.uniqid();
    $img2 = upload_file($img_name2, "image2", "uploaded-files/blog/images");

    $width = "800";
    $height = $height;

    $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
    $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
    saveResizedPhoto($img2, $width, $height, $source_folder, $destination_folder);

    updateTable($table_name, " image2='$img2' where catID='$catID'");
  }

  
  if ($_FILES['image3']['name'] != "") {
   
    $categoryRes = getResult($table_name, " where catID='$catID'", "image3");
    $filename = $categoryRes['image3'];
    if ($filename != "") {
      $file = SITE_DIR_PATH . "/uploaded-files/blog/images/" . $filename;
      if (file_exists($file)) {
        unlink($file);
      }

      $file1 = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/" . $filename;
      if (file_exists($file1)) {
        unlink($file1);
      }
    }
    $tempPath = $_FILES['image3']['tmp_name'];
    $imageSize = getimagesize($tempPath);
    if ($imageSize !== false) {
      $height = $imageSize[1];
    }

    $head3 = clean($heading3);
    $img_name3 = $head3.uniqid();
    $img3 = upload_file($img_name3, "image3", "uploaded-files/blog/images");

    $width = "800";
    $height = $height;

    $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
    $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
    saveResizedPhoto($img3, $width, $height, $source_folder, $destination_folder);

    updateTable($table_name, " image3='$img3' where catID='$catID'");
  }


  if ($_FILES['image4']['name'] != "") {
   
    $categoryRes = getResult($table_name, " where catID='$catID'", "image4");
    $filename = $categoryRes['image4'];
    if ($filename != "") {
      $file = SITE_DIR_PATH . "/uploaded-files/blog/images/" . $filename;
      if (file_exists($file)) {
        unlink($file);
      }

      $file1 = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/" . $filename;
      if (file_exists($file1)) {
        unlink($file1);
      }
    }
    $tempPath = $_FILES['image4']['tmp_name'];
    $imageSize = getimagesize($tempPath);
    if ($imageSize !== false) {
      $height = $imageSize[1];
    }

    $head4 = clean($heading4);
    $img_name4 = $head4.uniqid();
    $img4 = upload_file($img_name4, "image4", "uploaded-files/blog/images");

    $width = "800";
    $height = $height;

    $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
    $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
    saveResizedPhoto($img4, $width, $height, $source_folder, $destination_folder);

    updateTable($table_name, " image4='$img4' where catID='$catID'");
  }

  
  if ($_FILES['image5']['name'] != "") {
   
    $categoryRes = getResult($table_name, " where catID='$catID'", "image5");
    $filename = $categoryRes['image5'];
    if ($filename != "") {
      $file = SITE_DIR_PATH . "/uploaded-files/blog/images/" . $filename;
      if (file_exists($file)) {
        unlink($file);
      }

      $file1 = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/" . $filename;
      if (file_exists($file1)) {
        unlink($file1);
      }
    }
    $tempPath = $_FILES['image5']['tmp_name'];
    $imageSize = getimagesize($tempPath);
    if ($imageSize !== false) {
      $height = $imageSize[1];
    }

    $head5 = clean($heading5);
    $img_name5 = $head5.uniqid();
    $img5 = upload_file($img_name5, "image5", "uploaded-files/blog/images");

    $width = "800";
    $height = $height;

    $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
    $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
    saveResizedPhoto($img5, $width, $height, $source_folder, $destination_folder);

    updateTable($table_name, " image5='$img5' where catID='$catID'");
  }

  if ($_FILES['image6']['name'] != "") {
   
    $categoryRes = getResult($table_name, " where catID='$catID'", "image6");
    $filename = $categoryRes['image6'];
    if ($filename != "") {
      $file = SITE_DIR_PATH . "/uploaded-files/blog/images/" . $filename;
      if (file_exists($file)) {
        unlink($file);
      }

      $file1 = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/" . $filename;
      if (file_exists($file1)) {
        unlink($file1);
      }
    }
    $tempPath = $_FILES['image6']['tmp_name'];
    $imageSize = getimagesize($tempPath);
    if ($imageSize !== false) {
      $height = $imageSize[1];
    }

    $head6 = clean($heading6);
    $img_name6 = $head6.uniqid();
    $img6 = upload_file($img_name6, "image6", "uploaded-files/blog/images");

    $width = "800";
    $height = $height;

    $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
    $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
    saveResizedPhoto($img6, $width, $height, $source_folder, $destination_folder);

    updateTable($table_name, " image6='$img6' where catID='$catID'");
  }


  if ($_FILES['image7']['name'] != "") {
   
    $categoryRes = getResult($table_name, " where catID='$catID'", "image7");
    $filename = $categoryRes['image7'];
    if ($filename != "") {
      $file = SITE_DIR_PATH . "/uploaded-files/blog/images/" . $filename;
      if (file_exists($file)) {
        unlink($file);
      }

      $file1 = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/" . $filename;
      if (file_exists($file1)) {
        unlink($file1);
      }
    }
    $tempPath = $_FILES['image7']['tmp_name'];
    $imageSize = getimagesize($tempPath);
    if ($imageSize !== false) {
      $height = $imageSize[1];
    }

    $head7 = clean($heading7);
    $img_name7 = $head7.uniqid();
    $img7 = upload_file($img_name7, "image7", "uploaded-files/blog/images");

    $width = "800";
    $height = $height;

    $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
    $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
    saveResizedPhoto($img7, $width, $height, $source_folder, $destination_folder);

    updateTable($table_name, " image7='$img7' where catID='$catID'");
  }

  
  if ($_FILES['image8']['name'] != "") {
   
    $categoryRes = getResult($table_name, " where catID='$catID'", "image8");
    $filename = $categoryRes['image8'];
    if ($filename != "") {
      $file = SITE_DIR_PATH . "/uploaded-files/blog/images/" . $filename;
      if (file_exists($file)) {
        unlink($file);
      }

      $file1 = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/" . $filename;
      if (file_exists($file1)) {
        unlink($file1);
      }
    }
    $tempPath = $_FILES['image8']['tmp_name'];
    $imageSize = getimagesize($tempPath);
    if ($imageSize !== false) {
      $height = $imageSize[1];
    }

    $head8 = clean($heading8);
    $img_name8 = $head8.uniqid();
    $img8 = upload_file($img_name8, "image8", "uploaded-files/blog/images");

    $width = "800";
    $height = $height;

    $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
    $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
    saveResizedPhoto($img8, $width, $height, $source_folder, $destination_folder);

    updateTable($table_name, " image8='$img8' where catID='$catID'");
  }

  if ($_FILES['image9']['name'] != "") {
   
    $categoryRes = getResult($table_name, " where catID='$catID'", "image9");
    $filename = $categoryRes['image9'];
    if ($filename != "") {
      $file = SITE_DIR_PATH . "/uploaded-files/blog/images/" . $filename;
      if (file_exists($file)) {
        unlink($file);
      }

      $file1 = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/" . $filename;
      if (file_exists($file1)) {
        unlink($file1);
      }
    }
    $tempPath = $_FILES['image9']['tmp_name'];
    $imageSize = getimagesize($tempPath);
    if ($imageSize !== false) {
      $height = $imageSize[1];
    }

    $head9 = clean($heading9);
    $img_name9 = $head9.uniqid();
    $img9 = upload_file($img_name9, "image9", "uploaded-files/blog/images");

    $width = "800";
    $height = $height;

    $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
    $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
    saveResizedPhoto($img9, $width, $height, $source_folder, $destination_folder);

    updateTable($table_name, " image9='$img9' where catID='$catID'");
  }

  if ($_FILES['image10']['name'] != "") {
   
    $categoryRes = getResult($table_name, " where catID='$catID'", "image10");
    $filename = $categoryRes['image10'];
    if ($filename != "") {
      $file = SITE_DIR_PATH . "/uploaded-files/blog/images/" . $filename;
      if (file_exists($file)) {
        unlink($file);
      }

      $file1 = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/" . $filename;
      if (file_exists($file1)) {
        unlink($file1);
      }
    }
    $tempPath = $_FILES['image10']['tmp_name'];
    $imageSize = getimagesize($tempPath);
    if ($imageSize !== false) {
      $height = $imageSize[1];
    }

    $head10 = clean($heading10);
    $img_name10 = $head10.uniqid();
    $img10 = upload_file($img_name10, "image10", "uploaded-files/blog/images");

    $width = "800";
    $height = $height;

    $source_folder = SITE_DIR_PATH . "/uploaded-files/blog/images";
    $destination_folder = SITE_DIR_PATH . "/uploaded-files/blog/images/thumbs/";
    saveResizedPhoto($img10, $width, $height, $source_folder, $destination_folder);

    updateTable($table_name, " image10='$img10' where catID='$catID'");
  }

  if ($blogDname == '') {
    $blogDname = $catName;
  }

  $catName = htmlentitiesDecode($catName);
  $blogDname = htmlentitiesDecode($blogDname);
  $pageDescription = htmlentitiesDecode($pageDescription);
  $catDesc = htmlentitiesDecode($catDesc);

  $heading1 = htmlentitiesDecode($heading1);
  $content1 = htmlentitiesDecode($content1);
  $heading2 = htmlentitiesDecode($heading2);
  $content2 = htmlentitiesDecode($content2);
  $heading3 = htmlentitiesDecode($heading3);
  $content3 = htmlentitiesDecode($content3);
  $heading4 = htmlentitiesDecode($heading4);
  $content4 = htmlentitiesDecode($content4);
  $heading5 = htmlentitiesDecode($heading5);
  $content5 = htmlentitiesDecode($content5);
  $heading6 = htmlentitiesDecode($heading6);
  $content6 = htmlentitiesDecode($content6);
  $heading7 = htmlentitiesDecode($heading7);
  $content7 = htmlentitiesDecode($content7);
  $heading8 = htmlentitiesDecode($heading8);
  $content8 = htmlentitiesDecode($content8);
  $heading9 = htmlentitiesDecode($heading9);
  $content9 = htmlentitiesDecode($content9);
  $heading10 = htmlentitiesDecode($heading10);
  $content10 = htmlentitiesDecode($content10);
 
  updateTable($table_name, " catName='$catName',blogDname='$blogDname',blog_written='$blog_written', catDesc='$catDesc', catDesc1='$catDesc1', pageTitle='$pageTitle', pageKeywords='$pageKeywords', pageDescription='$pageDescription', blogDate='$blogDate',catgurl='$catgurl',heading1='$heading1', content1='$content1', ytvideo1='$ytvideo1', heading2='$heading2', content2='$content2', ytvideo2='$ytvideo2', heading3='$heading3', content3='$content3', ytvideo3='$ytvideo3', heading4='$heading4', content4='$content4', ytvideo4='$ytvideo4', heading5='$heading5', content5='$content5', ytvideo5='$ytvideo5', heading6='$heading6', content6='$content6', ytvideo6='$ytvideo6', heading7='$heading7', content7='$content7', ytvideo7='$ytvideo7', heading8='$heading8', content8='$content8', ytvideo8='$ytvideo8', heading9='$heading9', content9='$content9', ytvideo9='$ytvideo9', heading10='$heading10', content10='$content10', ytvideo10='$ytvideo10' where catID='$catID'");
  $_SESSION['session_message'] = '<div class="btn btn-success">' . $record_type . ' has been updated successfully</div>';
  header("Location: " . SITE_ADMIN_URL . "/" . $redirect_script_name . "?start=" . $start . "&parentID=" . $parentID . "&catID=" . $catID . "&pagesize=" . $pagesize);
  exit;
}
########################################################
admin_header();
$res = getResult($table_name, " where catID='$catID'");
?>
<div class="content-wrapper">
    <div class="page-header">
        <h3 class="page-title">
            <?= $heading; ?>
        </h3>
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="nav-item d-none d-lg-flex">
                    <a class="nav-link" href="<?= $redirect_script_name ?>">
                        <span class="btn btn-primary">Go Back</span>
                    </a>
                </li>
            </ol>
        </nav>
    </div>
    <div class="row">
        <div class="col-12 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">
                    <form class="forms-sample" method="POST" action="" enctype="multipart/form-data">
                        <div class="form-group">
                            <label>Blog Name (*)</label>
                            <input class="typeahead" type="text" name="catName" value="<?= $res['catName'] ?>"
                                placeholder="Blog Name" required>
                            <!-- <sup class="text-danger">Don't use any special characters in blog name</sup> -->
                        </div>
                        <div class="form-group">
                            <label>Blog Display Name (*)</label>
                            <input class="typeahead" type="text" name="blogDname" value="<?= $res['blogDname'] ?>"
                                placeholder="Blog Display Name" required>
                        </div>

                        <div class="form-group">
                            <label for="exampleTextarea1">Blog Short Description</label>
                            <textarea class="form-control" name="catDesc"
                                rows="3"><?= $res['catDesc'] ?></textarea>
                        </div>

                        <div class="form-group">
                            <div class="col">
                                <label>Blog Description</label>
                                <!-- <textarea class="form-control editor" name="fulldesc"
                                rows="4"><= $res['catDesc1'] ?></textarea> -->


                                <div id="the-basics">
                                    <textarea class="typeahead form-control editor" type="text" name="blog_written"
                                         placeholder="Enter Blog Description"><?= $res['blog_written'] ?></textarea>
                                </div>
                            </div>
                           
                        </div>
                        <div class="form-group">
                                <label>Blog Post Date</label>
                                <div id="bloodhound">
                                    <input class="typeahead" type="date" name="blogDate" value="<?= $res['blogDate'] ?>"
                                        placeholder="Banner description">
                                </div>
                            </div>


                        <div class="form-group">
                            <label for="exampleTextarea1">Meta Title</label>
                            <input class="typeahead" type="text" name="pageTitle" value="<?= $res['pageTitle'] ?>"
                                placeholder="Meta Title">
                        </div>
                        <div class="form-group">
                            <label for="exampleTextarea1">Meta Keyword</label>
                            <input class="typeahead" type="text" name="pageKeywords" value="<?= $res['pageKeywords'] ?>"
                                placeholder="Meta Keyword">
                        </div>
                        <div class="form-group">
                            <label for="exampleTextarea1">Meta Description</label>
                            <textarea class="form-control" name="pageDescription"
                                rows="3"><?= $res['pageDescription'] ?></textarea>
                        </div>
                      
          
                        <?php
            if ($res['catID'] == "") { ?>
                        <div class="form-group">
                            <label for="exampleTextarea1">Blog Image</label>
                            <input type="file" class="dropify" name="image">
                        </div>
                        <?php } else { ?>
                        <div class="form-group row">
                            <div class="col">
                                <label>Blog Image</label>
                                <input type="file" class="dropify" name="image">
                            </div>
                            <div class="col">
                                <img src="<?= site_url . "/uploaded-files/blog/images/" . $res['catImage'] ?>"
                                    alt="image" style="width: 60%;">
                            </div>
                        </div>

                        <?php } ?>


                        <!-- <div class="cmmt_nav mb-5">
                            <ul class="nav nav-tabs" id="myTab" role="tablist">
                                <li class="nav-item">
                                    <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab"
                                        aria-controls="home" aria-selected="true">Section 1</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab"
                                        aria-controls="profile" aria-selected="false">Section 2</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab"
                                        aria-controls="contact" aria-selected="false">Section 3</a>
                                </li>

                                <li class="nav-item">
                                    <a class="nav-link" id="section4-tab" data-toggle="tab" href="#section4" role="tab"
                                        aria-controls="section4" aria-selected="false">Section 4</a>
                                </li>


                                <li class="nav-item">
                                    <a class="nav-link" id="section5-tab" data-toggle="tab" href="#section5" role="tab"
                                        aria-controls="section5" aria-selected="false">Section 5</a>
                                </li>


                                <li class="nav-item">
                                    <a class="nav-link" id="section6-tab" data-toggle="tab" href="#section6" role="tab"
                                        aria-controls="section6" aria-selected="false">Section 6</a>
                                </li>

                                <li class="nav-item">
                                    <a class="nav-link" id="section7-tab" data-toggle="tab" href="#section7" role="tab"
                                        aria-controls="section7" aria-selected="false">Section 7</a>
                                </li>

                                <li class="nav-item">
                                    <a class="nav-link" id="section8-tab" data-toggle="tab" href="#section8" role="tab"
                                        aria-controls="section8" aria-selected="false">Section 8</a>
                                </li>

                                <li class="nav-item">
                                    <a class="nav-link" id="section9-tab" data-toggle="tab" href="#section9" role="tab"
                                        aria-controls="section9" aria-selected="false">Section 9</a>
                                </li>

                                <li class="nav-item">
                                    <a class="nav-link" id="section10-tab" data-toggle="tab" href="#section10" role="tab"
                                        aria-controls="section10" aria-selected="false">Section 10</a>
                                </li>
                            </ul>
                            <div class="tab-content" id="myTabContent">


                                <div class="tab-pane fade show active" id="home" role="tabpanel"
                                    aria-labelledby="home-tab">
                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="inputEmail4">Heading </label>
                                            <input type="text" class="form-control" name="heading1" id="heading1"
                                                placeholder="" value="<?=$res['heading1'];?>">
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="Heading">Content</label>
                                            <textarea class="form-control editor" id="content1" name="content1"
                                                rows="2"><?=$res['content1'];?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-4">
                                            <label for="inputCity">Video Link (YT Video ID)</label>
                                            <input type="text" class="form-control" id="ytvideo1" name="ytvideo1"
                                                value="<?=$res['ytvideo1'];?>">
                                        </div>


                                        OR &nbsp;&nbsp;

                                        <div class="form-group col-md-3">

                                            <label for="exampleTextarea1">Image</label>
                                            <input type="file" class="dropify" name="image1" id="image1">

                                        </div>
                                        <?php if($res['image1']!='')
                                        {?>
                                        <div class="form-group col-md-4">
                                            <img src="<?=upload_url;?>blog/images/thumbs/<?=$res['image1'];?>"
                                                alt="image" width="200" height="200">
                                                <button type="button" name="delete" onclick="emptyImage('image1')" class="btn btn-danger btn-icon-text btn-sm">
                                    <i class="fas fa-trash-alt mr-1"></i>Delete
                                </button>
                                        </div>
                                        <?php }?>
                                    </div>
                                </div>


                                <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">

                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="inputEmail4">Heading </label>
                                            <input type="text" class="form-control" name="heading2" id="heading2"
                                                placeholder="" value="<?=$res['heading2'];?>">
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="Heading">Content</label>
                                            <textarea class="form-control editor" id="content2" name="content2"
                                                rows="2"><?=$res['content2'];?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-4">
                                            <label for="inputCity">Video Link (YT Video ID)</label>
                                            <input type="text" class="form-control" id="ytvideo2" name="ytvideo2" value="<?=$res['ytvideo2'];?>">
                                        </div>


                                        OR &nbsp;&nbsp;

                                        <div class="form-group col-md-3">

                                            <label for="exampleTextarea1">Image</label>
                                            <input type="file" class="dropify" name="image2">

                                        </div>
                                        <?php if($res['image2']!='')
                                        {?>

                                        <div class="form-group col-md-4">
                                            <img src="<?=upload_url;?>blog/images/thumbs/<?=$res['image2'];?>"
                                                alt="image" width="200" height="200">

                                                <button type="button" name="delete" onclick="emptyImage('image2')" class="btn btn-danger btn-icon-text btn-sm">
                                    <i class="fas fa-trash-alt mr-1"></i>Delete
                                </button>
                                        </div>

                                        <?php }?>
                                    </div>

                                </div>


                                <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">

                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="inputEmail4">Heading </label>
                                            <input type="text" class="form-control" name="heading3" id="heading3"
                                                placeholder="" value="<?=$res['heading3'];?>">
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="Heading">Content</label>
                                            <textarea class="form-control editor" id="content3" name="content3"
                                                rows="2"><?=$res['content3'];?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-4">
                                            <label for="inputCity">Video Link (YT Video ID)</label>
                                            <input type="text" class="form-control" id="ytvideo3" name="ytvideo3" value="<?=$res['ytvideo3'];?>">
                                        </div>


                                        OR &nbsp;&nbsp;

                                        <div class="form-group col-md-3">

                                            <label for="exampleTextarea1">Image</label>
                                            <input type="file" class="dropify" name="image3">

                                        </div>
                                        <?php if($res['image3']!='')
                                        {?>

                                        <div class="form-group col-md-4">
                                            <img src="<?=upload_url;?>blog/images/thumbs/<?=$res['image3'];?>"
                                                alt="image" width="200" height="200">
                                                <button type="button" name="delete" onclick="emptyImage('image3')" class="btn btn-danger btn-icon-text btn-sm">
                                    <i class="fas fa-trash-alt mr-1"></i>Delete
                                </button>
                                        </div>

                                        <?php }?>
                                    </div>

                                </div>


                                <div class="tab-pane fade" id="section4" role="tabpanel" aria-labelledby="section4-tab">

                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="inputEmail4">Heading </label>
                                            <input type="text" class="form-control" name="heading4" id="heading4"
                                                placeholder="" value="<?=$res['heading4'];?>">
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="Heading">Content</label>
                                            <textarea class="form-control editor" id="content4" name="content4"
                                                rows="2"><?=$res['content4'];?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-4">
                                            <label for="inputCity">Video Link (YT Video ID)</label>
                                            <input type="text" class="form-control" id="ytvideo4" name="ytvideo4" value="<?=$res['ytvideo4'];?>">
                                        </div>


                                        OR &nbsp;&nbsp;

                                        <div class="form-group col-md-3">

                                            <label for="exampleTextarea1">Image</label>
                                            <input type="file" class="dropify" name="image4">

                                        </div>
                                        <?php if($res['image4']!='')
                                        {?>

                                        <div class="form-group col-md-4">
                                            <img src="<?=upload_url;?>blog/images/thumbs/<?=$res['image4'];?>"
                                                alt="image" width="200" height="200">

                                                <button type="button" name="delete" onclick="emptyImage('image4')" class="btn btn-danger btn-icon-text btn-sm">
                                    <i class="fas fa-trash-alt mr-1"></i>Delete
                                </button>
                                        </div>

                                        <?php }?>
                                    </div>

                                </div>

                                
                                <div class="tab-pane fade" id="section5" role="tabpanel" aria-labelledby="section5-tab">

                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="inputEmail4">Heading </label>
                                            <input type="text" class="form-control" name="heading5" id="heading5"
                                                placeholder="" value="<?=$res['heading5'];?>">
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="Heading">Content</label>
                                            <textarea class="form-control editor" id="content5" name="content5"
                                                rows="2"><?=$res['content5'];?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-4">
                                            <label for="inputCity">Video Link (YT Video ID)</label>
                                            <input type="text" class="form-control" id="ytvideo5" name="ytvideo5" value="<?=$res['ytvideo5'];?>">
                                        </div>


                                        OR &nbsp;&nbsp;

                                        <div class="form-group col-md-3">

                                            <label for="exampleTextarea1">Image</label>
                                            <input type="file" class="dropify" name="image5">

                                        </div>
                                        <?php if($res['image5']!='')
                                        {?>

                                        <div class="form-group col-md-4">
                                            <img src="<?=upload_url;?>blog/images/thumbs/<?=$res['image5'];?>"
                                                alt="image" width="200" height="200">

                                                <button type="button" name="delete" onclick="emptyImage('image5')" class="btn btn-danger btn-icon-text btn-sm">
                                    <i class="fas fa-trash-alt mr-1"></i>Delete
                                </button>
                                        </div>

                                        <?php }?>
                                    </div>

                                </div>

                                
                                <div class="tab-pane fade" id="section6" role="tabpanel" aria-labelledby="section6-tab">

                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="inputEmail4">Heading </label>
                                            <input type="text" class="form-control" name="heading6" id="heading6"
                                                placeholder="" value="<?=$res['heading6'];?>">
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="Heading">Content</label>
                                            <textarea class="form-control editor" id="content6" name="content6"
                                                rows="2"><?=$res['content6'];?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-4">
                                            <label for="inputCity">Video Link (YT Video ID)</label>
                                            <input type="text" class="form-control" id="ytvideo6" name="ytvideo6" value="<?=$res['ytvideo6'];?>">
                                        </div>


                                        OR &nbsp;&nbsp;

                                        <div class="form-group col-md-3">

                                            <label for="exampleTextarea1">Image</label>
                                            <input type="file" class="dropify" name="image6">

                                        </div>
                                        <?php if($res['image3']!='')
                                        {?>

                                        <div class="form-group col-md-4">
                                            <img src="<?=upload_url;?>blog/images/thumbs/<?=$res['image6'];?>"
                                                alt="image" width="200" height="200">
                                                <button type="button" name="delete" onclick="emptyImage('image6')" class="btn btn-danger btn-icon-text btn-sm">
                                    <i class="fas fa-trash-alt mr-1"></i>Delete
                                </button>
                                        </div>

                                        <?php }?>
                                    </div>

                                </div>

                                
                                <div class="tab-pane fade" id="section7" role="tabpanel" aria-labelledby="section7-tab">

                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="inputEmail4">Heading </label>
                                            <input type="text" class="form-control" name="heading7" id="heading7"
                                                placeholder="" value="<?=$res['heading7'];?>">
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="Heading">Content</label>
                                            <textarea class="form-control editor" id="content7" name="content7"
                                                rows="2"><?=$res['content7'];?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-4">
                                            <label for="inputCity">Video Link (YT Video ID)</label>
                                            <input type="text" class="form-control" id="ytvideo7" name="ytvideo7" value="<?=$res['ytvideo7'];?>">
                                        </div>


                                        OR &nbsp;&nbsp;

                                        <div class="form-group col-md-3">

                                            <label for="exampleTextarea1">Image</label>
                                            <input type="file" class="dropify" name="image7">

                                        </div>
                                        <?php if($res['image7']!='')
                                        {?>

                                        <div class="form-group col-md-4">
                                            <img src="<?=upload_url;?>blog/images/thumbs/<?=$res['image7'];?>"
                                                alt="image" width="200" height="200">

                                                <button type="button" name="delete" onclick="emptyImage('image7')" class="btn btn-danger btn-icon-text btn-sm">
                                    <i class="fas fa-trash-alt mr-1"></i>Delete
                                </button>
                                        </div>

                                        <?php }?>
                                    </div>

                                </div>

                                
                                <div class="tab-pane fade" id="section8" role="tabpanel" aria-labelledby="section8-tab">

                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="inputEmail4">Heading </label>
                                            <input type="text" class="form-control" name="heading8" id="heading8"
                                                placeholder="" value="<?=$res['heading8'];?>">
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="Heading">Content</label>
                                            <textarea class="form-control editor" id="content8" name="content8"
                                                rows="2"><?=$res['content8'];?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-4">
                                            <label for="inputCity">Video Link (YT Video ID)</label>
                                            <input type="text" class="form-control" id="ytvideo8" name="ytvideo8" value="<?=$res['ytvideo8'];?>">
                                        </div>


                                        OR &nbsp;&nbsp;

                                        <div class="form-group col-md-3">

                                            <label for="exampleTextarea1">Image</label>
                                            <input type="file" class="dropify" name="image8">

                                        </div>
                                        <?php if($res['image8']!='')
                                        {?>

                                        <div class="form-group col-md-4">
                                            <img src="<?=upload_url;?>blog/images/thumbs/<?=$res['image8'];?>"
                                                alt="image" width="200" height="200">

                                                <button type="button" name="delete" onclick="emptyImage('image8')" class="btn btn-danger btn-icon-text btn-sm">
                                    <i class="fas fa-trash-alt mr-1"></i>Delete
                                </button>
                                        </div>

                                        <?php }?>
                                    </div>

                                </div>

                                
                                <div class="tab-pane fade" id="section9" role="tabpanel" aria-labelledby="section9-tab">

                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="inputEmail4">Heading </label>
                                            <input type="text" class="form-control" name="heading9" id="heading9"
                                                placeholder="" value="<?=$res['heading9'];?>">
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="Heading">Content</label>
                                            <textarea class="form-control editor" id="content9" name="content9"
                                                rows="2"><?=$res['heading9'];?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-4">
                                            <label for="inputCity">Video Link (YT Video ID)</label>
                                            <input type="text" class="form-control" id="ytvideo9" name="ytvideo9" value="<?=$res['ytvideo9'];?>">
                                        </div>


                                        OR &nbsp;&nbsp;

                                        <div class="form-group col-md-3">

                                            <label for="exampleTextarea1">Image</label>
                                            <input type="file" class="dropify" name="image9">

                                        </div>
                                        <?php if($res['image9']!='')
                                        {?>

                                        <div class="form-group col-md-4">
                                            <img src="<?=upload_url;?>blog/images/thumbs/<?=$res['image9'];?>"
                                                alt="image" width="200" height="200">

                                                <button type="button" name="delete" onclick="emptyImage('image9')" class="btn btn-danger btn-icon-text btn-sm">
                                    <i class="fas fa-trash-alt mr-1"></i>Delete
                                </button>
                                        </div>

                                        <?php }?>
                                    </div>

                                </div>

                                
                                <div class="tab-pane fade" id="section10" role="tabpanel" aria-labelledby="section10-tab">

                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="inputEmail4">Heading </label>
                                            <input type="text" class="form-control" name="heading10" id="heading10"
                                                placeholder="" value="<?=$res['heading10'];?>">
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-12">
                                            <label for="Heading">Content</label>
                                            <textarea class="form-control editor" id="content10" name="content10"
                                                rows="2"><?=$res['content10'];?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-group col-md-4">
                                            <label for="inputCity">Video Link (YT Video ID)</label>
                                            <input type="text" class="form-control" id="ytvideo10" name="ytvideo10" value="<?=$res['ytvideo10'];?>">
                                        </div>


                                        OR &nbsp;&nbsp;

                                        <div class="form-group col-md-3">

                                            <label for="exampleTextarea1">Image</label>
                                            <input type="file" class="dropify" name="image10">

                                        </div>
                                        <?php if($res['image10']!='')
                                        {?>

                                        <div class="form-group col-md-4">
                                            <img src="<?=upload_url;?>blog/images/thumbs/<?=$res['image10'];?>"
                                                alt="image" width="200" height="200">
                                                <button type="button" name="delete" onclick="emptyImage('image10')" class="btn btn-danger btn-icon-text btn-sm">
                                    <i class="fas fa-trash-alt mr-1"></i>Delete
                                </button>
                                        </div>

                                        <?php }?>
                                    </div>

                                </div>

                            </div>
                        </div> -->


                        <?php
            if ($res['catID'] == "") {
              ?>
                        <button type="submit" class="btn btn-primary mr-2" name="add_record">Submit</button>
                        <input type="hidden" name="action" value="add_record">
                        <?php
            } else {
              ?>
                        <button type="submit" class="btn btn-primary mr-2" name="update_record">Update</button>
                        <input type="hidden" name="action" value="update_record">
                        <?php
            }
            ?>
                        <button class="btn btn-light"
                            onclick="javascript: window.location.href = '<?= SITE_ADMIN_URL; ?>/<?= $redirect_script_name; ?>?parentID=<?= $parentID; ?>&catID=<?= $catID; ?>'">Cancel</button>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- content-wrapper ends -->
<?php
admin_footer();

?>

<script>
        

    function emptyImage(image) {
      let confirms = confirm("Are you sure want delete image?");
      alert(confirms)
           var catID = '<?=$catID;?>'
      if(confirms ==  true)
    {
 
      if(image!='')
    {
      $.ajax({
                url: 'deleteBlogImage.php', // URL of the PHP script
                type: 'POST',       // Request type
                data: {image : image, catID:catID},   // Data to send
                success: function(response) {
                    console.log(response);
                    location.reload();
                    //alert('AJAX call was successful! Check console for response.');
                },
                error: function(xhr, status, error) {
                    console.error(xhr);
                    alert('AJAX call failed: ' + error);
                }
            });
          }
        }
          
      }


  
</script>

← Back to Directory Edit File 🔒 Chmod

WP File Manager