<?php
  ob_start();
  session_start();
  require_once 'db.php';
  require_once '../pages/functions.php';
  require_once 'class.upload.php';
  // ===================================== //
  // ========= User Operation ============ //
  // ===================================== //
  if (isset($_POST['userConnect'])) {
   $email=$_POST['email'];
   $password=md5(sha1($_POST["password"]));
   $askUser=$db->prepare("SELECT * FROM user where email=:email and password=:password");
   $askUser->execute([
     'email' => $email,
     'password' => $password
   ]);
   echo $count=$askUser->rowCount();
   if ($count==1) {
     $_SESSION['email']=$email;
     header("Location:../index.php");
     exit;
   } else {
     header("Location:../login.php?status=error");
     exit;
   }
  }

  $askUser=$db->prepare("SELECT * FROM user WHERE email=:email");
  $askUser->execute(array(
    'email' => $_SESSION['email']
  ));
  $checkUser=$askUser->fetch(PDO::FETCH_ASSOC);
  $_SESSION['user_status'] = $checkUser['user_status'];
  if ($_SESSION['user_status'] != "999") {
    header("Location:../index.php?status=demoMode");
  }else{
    // Edit
    if (isset($_POST['userUpdate'])) {
      $passEncode=md5(sha1($_POST["password"]));
     if ($_POST['password']) {
       $editData=$db->prepare("UPDATE user SET
         firstname=:firstname,
         lastname=:lastname,
         email=:email,
         password=:password
         WHERE user_id={$_POST['user_id']}");
       $update=$editData->execute(array(
         'firstname'    => $_POST["firstname"],
         'lastname'     => $_POST["lastname"],
         'email'        => $_POST["email"],
         'password'     => $passEncode
       ));
       if($update){
         Header("Location:../usersList?status=success");
       }else{
         Header("Location:../usersList?status=error");
       }
     }else{
       $editData=$db->prepare("UPDATE user SET
         firstname=:firstname,
         lastname=:lastname,
         email=:email
         WHERE user_id={$_POST['user_id']}");
       $update=$editData->execute(array(
         'firstname'    => $_POST["firstname"],
         'lastname'     => $_POST["lastname"],
         'email'        => $_POST["email"]
       ));
       if($update){
         Header("Location:../usersList?status=success");
       }else{
         Header("Location:../usersList?status=error");
       }
     }
    }
    // Edit Avatar
    if(isset($_POST['userImageUpdate'])){
     if ($_FILES['upload_image']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['upload_image']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['upload_image']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='user_image_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $editData=$db->prepare("UPDATE user SET
         image=:image
         WHERE user_id={$_POST['user_id']}");
       $update=$editData->execute(array(
         'image'    =>  $vtpath
       ));
       if($update){
         $x = explode("/", $_POST['image']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
         Header("Location:../index.php?page=usersEdit&user_id={$_POST['user_id']}");
       }else{
         Header("Location:../usersList?status=error");
       }
     }else {
       Header("Location:../usersList?status=error");
     }
    }

    // ===================================== //
    // ========= User Operation ============ //
    // ===================================== //
    if (isset($_POST['userAdd'])) {
      // password encode
      $passEncode = md5(sha1($_POST["password"]));
      // Image Upload
      $image = new Upload($_FILES['upload_image']);
      $uploads_dir = '../../uploads';
      @$name = $_FILES['upload_image']["name"];
      $extension = uzanti($name);
      $uniqnumber1 = rand(20000,32000);
      $uniqnumber2 = rand(20000,32000);
      $uniqname = $uniqnumber1.$uniqnumber2;
      $imagepath ='user_image_'.$uniqname;
      $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
      if($image->uploaded){
        $image->file_new_name_body = $imagepath;
        $image->allowed = array ('image/*');
        $image->Process('../../uploads/');
      }
      $addData=$db->prepare("INSERT INTO user SET
        firstname=:firstname,
        lastname=:lastname,
        email=:email,
        password=:password,
        image=:image,
        user_status=:user_status
        ");
      $insert=$addData->execute(array(
        'firstname'   => $_POST["firstname"],
        'lastname'    => $_POST["lastname"],
        'email'       => $_POST["email"],
        'password'    => $passEncode,
        'image'       => $vtpath,
        'user_status' => 1
      ));
      if($insert){
        Header("Location:../usersList?status=success");
      }else{
        Header("Location:../usersList?status=error");
      }
    }

    // ===================================== //
    // ========= Bank Operation ============ //
    // ===================================== //
    if (isset($_POST['banksAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if (empty($_POST["account_name"])) {
        $accname = "";
      }else{
        $accname = $_POST["account_name"];
      }
      if (empty($_POST["branch_code"])) {
        $branchcode = "";
      }else{
        $branchcode = $_POST["branch_code"];
      }
      if (empty($_POST["account_number"])) {
        $accnumber = "";
      }else{
        $accnumber = $_POST["account_number"];
      }
      if (empty($_POST["bank_iban"])) {
        $bankiban = "";
      }else{
        $bankiban = $_POST["bank_iban"];
      }

      if ($_POST['bank_name'] == "") {
        Header("Location:../banksAdd?status=titleEmptyError");
      }else{
        // Add Database
        $addData=$db->prepare("INSERT INTO banks SET
          bank_name=:bank_name,
          account_name=:account_name,
          branch_code=:branch_code,
          account_number=:account_number,
          bank_iban=:bank_iban,
          order_sort=:order_sort,
          status=:status
        ");
        $insert=$addData->execute(array(
          'bank_name'      => $_POST["bank_name"],
          'account_name'   => $accname,
          'branch_code'    => $branchcode,
          'account_number' => $accnumber,
          'bank_iban'      => $bankiban,
          'order_sort'     => $order_sort,
          'status'         => $status
        ));
        if($insert){
          Header("Location:../banksList?status=success");
        }else{
          Header("Location:../banksList?status=error");
        }
      }
    }

    // ===================================== //
    // ===== Branch Dealer Operation ======= //
    // ===================================== //
    if (isset($_POST['branchDealerAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if (empty($_POST["type"])) {
        $type = 0;
      }else{
        $type = $_POST["type"];
      }
      if (empty($_POST["email"])) {
        $email = "";
      }else{
        $email = $_POST["email"];
      }
      if (empty($_POST["phone"])) {
        $phone = "";
      }else{
        $phone = $_POST["phone"];
      }
      if (empty($_POST["map"])) {
        $map = "";
      }else{
        $map = $_POST["map"];
      }
      if ($_POST['name'] == "") {
        Header("Location:../branchDealerAdd?status=titleEmptyError");
      }else{
        // Add Database
        $addData=$db->prepare("INSERT INTO branchdealer SET
          type=:type,
          name=:name,
          email=:email,
          phone=:phone,
          map=:map,
          status=:status,
          order_sort=:order_sort
        ");
        $insert=$addData->execute(array(
          'type'       => $type,
          'name'       => $_POST["name"],
          'email'      => $email,
          'phone'      => $phone,
          'map'        => $map,
          'status'     => $status,
          'order_sort' => $order_sort
        ));
        if($insert){
          Header("Location:../branchDealerList?status=success");
        }else{
          Header("Location:../branchDealerList?status=error");
        }
      }
    }

    // ===================================== //
    // ========= Catalog Operation ========= //
    // ===================================== //
    if (isset($_POST['catalogAdd'])) {
      $status;
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      $order_sort;
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if ($_POST['name'] == ""){
        Header("Location:../catalogAdd?status=titleEmptyError");
      }else{
        if ($_FILES['link']['size'] > 0) {
          // file Upload
          $image = new Upload($_FILES['link']);
          $uploads_dir = '../../uploads';
          @$name = $_FILES['link']['name'];
          $extension = uzanti($name);
          $uniqnumber1 = rand(20000,32000);
          $uniqnumber2 = rand(20000,32000);
          $uniqname = $uniqnumber1.$uniqnumber2;
          $imagepath ='catalog_file_'.$uniqname;
          $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
          if($image->uploaded){
            $image->file_new_name_body = $imagepath;
            $image->allowed = array ('application/pdf');
            $image->Process('../../uploads/');
          }
        }else{
          $vtpath = "";
        }
        if ($_FILES['image']['size'] > 0) {
          // Image Upload
          $image = new Upload($_FILES['image']);
          $uploads_dir = '../../uploads';
          @$name = $_FILES['image']['name'];
          $extension = uzanti($name);
          $uniqnumber1 = rand(20000,32000);
          $uniqnumber2 = rand(20000,32000);
          $uniqname = $uniqnumber1.$uniqnumber2;
          $imagepath ='catalog_image_'.$uniqname;
          $vtpath2 = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
          if($image->uploaded){
            $image->file_new_name_body = $imagepath;
            $image->allowed = array ('image/*');
            $image->image_resize = true;
            $image->image_x = 300;
            $image->image_y = 300;
            $image->Process('../../uploads/');
          }
        }else{
          $vtpath2 = "";
        }
        $addData=$db->prepare("INSERT INTO catalog SET
          link=:link,
          name=:name,
          image=:image,
          status=:status,
          order_sort=:order_sort,
          language=:language
          ");
        $insert=$addData->execute(array(
          'link'         => $vtpath,
          'name'         => $_POST["name"],
          'image'        => $vtpath2,
          'status'       => $status,
          'order_sort'   => $order_sort,
          'language'     => $_POST["language_id"]
        ));
        if($insert){
          Header("Location:../catalogList?status=success");
        }else{
          Header("Location:../catalogList?status=error");
        }
      }
    }

    // ===================================== //
    // ========= Counter Operation ========= //
    // ===================================== //
    if (isset($_POST['counterAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if (empty($_POST["count"])) {
        $count = 1;
      }else{
        $count = $_POST["count"];
      }
      // Add Database
      $addData=$db->prepare("INSERT INTO counter SET
        icon=:icon,
        name=:name,
        count=:count,
        status=:status,
        order_sort=:order_sort,
        language=:language
      ");
      $insert=$addData->execute(array(
        'icon'           => $_POST["icon"],
        'name'           => $_POST["name"],
        'count'          => $count,
        'status'         => $status,
        'order_sort'     => $order_sort,
        'language'       => $_POST["language_id"]
      ));
      if($insert){
        Header("Location:../counterList?status=success");
      }else{
        Header("Location:../counterList?status=error");
      }
    }

    // ===================================== //
    // ==== Customer Comments Operation ==== //
    // ===================================== //
    if (isset($_POST['customerCommentAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if (empty($_POST["name"])) {
        $name = "";
      }else{
        $name = $_POST["name"];
      }
      if (empty($_POST["mission"])) {
        $mission = "";
      }else{
        $mission = $_POST["mission"];
      }
      if (empty($_POST["comment"])) {
        $comment = "";
      }else{
        $comment = $_POST["comment"];
      }
      // Add Database
      $addData=$db->prepare("INSERT INTO comments SET
        name=:name,
        mission=:mission,
        comment=:comment,
        status=:status,
        order_sort=:order_sort,
        language=:language
      ");
      $insert=$addData->execute(array(
        'name'           => $name,
        'mission'        => $mission,
        'comment'        => $comment,
        'status'         => $status,
        'order_sort'     => $order_sort,
        'language'       => $_POST["language_id"]
      ));
      if($insert){
        Header("Location:../customerCommentList?status=success");
      }else{
        Header("Location:../customerCommentList?status=error");
      }
    }

    // ===================================== //
    // ========= Document Operation ======== //
    // ===================================== //
    if (isset($_POST['documentAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if ($_POST['name'] == ""){
        Header("Location:../documentList?status=titleEmptyError");
      }else{
        if ($_FILES['image']['size'] > 0) {
          // Image Upload
          $image = new Upload($_FILES['image']);
          $uploads_dir = '../../uploads';
          @$name = $_FILES['image']['name'];
          $extension = uzanti($name);
          $uniqnumber1 = rand(20000,32000);
          $uniqnumber2 = rand(20000,32000);
          $uniqname = $uniqnumber1.$uniqnumber2;
          $imagepath ='document_image_'.$uniqname;
          $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
          if($image->uploaded){
            $image->file_new_name_body = $imagepath;
            $image->allowed = array ('image/*');
            $image->image_resize = true;
            $image->image_x = 1024;
            $image->image_y = 768;
            $image->Process('../../uploads/');
          }
        }else{
          $vtpath = "";
        }
        $addData=$db->prepare("INSERT INTO document SET
          image=:image,
          name=:name,
          status=:status,
          order_sort=:order_sort,
          language=:language
          ");
        $insert=$addData->execute(array(
          'image'        => $vtpath,
          'name'         => $_POST["name"],
          'status'       => $status,
          'order_sort'   => $order_sort,
          'language'     => $_POST["language_id"]
        ));
        if($insert){
          Header("Location:../documentList?status=success");
        }else{
          Header("Location:../documentList?status=error");
        }
      }
    }

    // ===================================== //
    // ========= Faqs Operation ============ //
    // ===================================== //
    if (isset($_POST['faqsAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if (empty($_POST["content"])) {
        $content = 0;
      }else{
        $content = $_POST["content"];
      }
      $post_type = "post_faqs";
      $banner = "";
      $seo_title = "";
      $seo_keywords = "";
      $seo_description = "";
      $seo_url = "";
      $template = "";
      $categories = 0;
      if ($_POST['title'] == ""){
        Header("Location:../faqsAdd?status=titleEmptyError");
      }else{
        // Add Database
        $addData=$db->prepare("INSERT INTO posts SET
          post_type=:post_type,
          categories=:categories,
          banner=:banner,
          title=:title,
          content=:content,
          seo_title=:seo_title,
          seo_keywords=:seo_keywords,
          seo_description=:seo_description,
          seo_url=:seo_url,
          order_sort=:order_sort,
          language=:language,
          template=:template,
          status=:status,
          home_status=:home_status
        ");
        $insert=$addData->execute(array(
          'post_type'       => $post_type,
          'categories'      => $categories,
          'banner'          => $banner,
          'title'           => $_POST["title"],
          'content'         => $content,
          'seo_title'       => $seo_title,
          'seo_keywords'    => $seo_keywords,
          'seo_description' => $seo_description,
          'seo_url'         => $seo_url,
          'template'        => $template,
          'order_sort'      => $order_sort,
          'language'        => $_POST["language_id"],
          'status'          => $status,
          'home_status'     => 0
        ));
        if($insert){
          Header("Location:../faqsList?status=success");
        }else{
          Header("Location:../faqsList?status=error");
        }
      }
    }

    // ===================================== //
    // ========= Language Operation ======== //
    // ===================================== //
    if (isset($_POST['langAdd'])) {
      $status;
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      $order_sort;
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      $rowControl = $db->prepare("SELECT * FROM language WHERE country_code=:country_code");
      $rowControl->execute(array(
        'country_code' =>$_POST['country_code']
      ));
      if($rowControl->rowCount()){
        Header("Location:../languageAdd?status=langError");
      }else{
        $addData=$db->prepare("INSERT INTO language SET
          country_code=:country_code,
          status=:status,
          order_sort=:order_sort
          ");
        $insert=$addData->execute(array(
          'country_code'    => $_POST["country_code"],
          'status'          => $status,
          'order_sort'      => $order_sort
        ));
        if($insert){
            touch("../lang/". $_POST['country_code'].".php");
            $file = fopen("../lang/". $_POST['country_code'].".php", 'w');
            fwrite($file, $_POST['docs']);
            fclose($file);
          Header("Location:../languageList?status=success");
        }else{
          Header("Location:../languageList?status=error");
        }
      }
    }

    // ===================================== //
    // ========= Notice Operation ========== //
    // ===================================== //
    if (isset($_POST['noticesAdd'])) {
      // seo url control
      if (!$_POST["seo_url"]) {
        $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
      }else {
        $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
      }
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if (empty($_POST["content"])) {
        $content = "";
      }else{
        $content = $_POST["content"];
      }
      if (empty($_POST["seo_title"])) {
        $seo_title = "";
      }else{
        $seo_title = $_POST["seo_title"];
      }
      if (empty($_POST["seo_keywords"])) {
        $seo_keywords = "";
      }else{
        $seo_keywords = $_POST["seo_keywords"];
      }
      if (empty($_POST["seo_description"])) {
        $seo_description = "";
      }else{
        $seo_description = $_POST["seo_description"];
      }
      $post_type = 'post_notices';
      $template = '';
      $categories = 0;
      $rowControl = $db->prepare("SELECT * FROM posts WHERE seo_url=:seo_url");
      $rowControl->execute(array(
        'seo_url' =>$seoUrl
      ));
      if($rowControl->rowCount()){
        Header("Location:../noticesAdd?status=seoUrlError");
      }else{
        if ($_POST['title'] == "") {
          Header("Location:../noticesAdd?status=titleEmptyError");
        }else{
          // Image Length Control
          if ($_FILES['banner']['size'] > 0){
            // Image Upload
            $image = new Upload($_FILES['banner']);
            $uploads_dir = '../../uploads';
            @$name = $_FILES['banner']["name"];
            $extension = uzanti($name);
            $uniqnumber1 = rand(20000,32000);
            $uniqnumber2 = rand(20000,32000);
            $uniqname = $uniqnumber1.$uniqnumber2;
            $imagepath ='notice_banner_'.$uniqname;
            $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
            if($image->uploaded){
              $image->file_new_name_body = $imagepath;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
              // Image resize 270x300
              $image->file_new_name_body = $imagepath.'-270x300';
              $image->image_resize = true;
              $image->image_x = 270;
              $image->image_y = 300;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
            }
          }else{
            $vtpath = "";
          }
          // Add Database
          $addData=$db->prepare("INSERT INTO posts SET
            post_type=:post_type,
            categories=:categories,
            banner=:banner,
            title=:title,
            content=:content,
            seo_title=:seo_title,
            seo_keywords=:seo_keywords,
            seo_description=:seo_description,
            seo_url=:seo_url,
            status=:status,
            home_status=:home_status,
            order_sort=:order_sort,
            template=:template,
            language=:language
          ");
          $insert=$addData->execute(array(
            'post_type'        => $post_type,
            'categories'       => $categories,
            'banner'           => $vtpath,
            'title'            => $_POST["title"],
            'content'          => $content,
            'seo_title'        => $seo_title,
            'seo_keywords'     => $seo_keywords,
            'seo_description'  => $seo_description,
            'seo_url'          => $seoUrl,
            'status'           => $status,
            'home_status'      => 0,
            'order_sort'       => $order_sort,
            'template'         => $template,
            'language'         => $_POST["language_id"]
          ));
          if($insert){
            Header("Location:../noticesList?status=success");
          }else{
            Header("Location:../noticesList?status=error");
          }
        }
      }
    }

    // ===================================== //
    // ========= Pages Operation =========== //
    // ===================================== //
    if (isset($_POST['pagesAdd'])) {
      if (!$_POST["seo_url"]) {
        $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
      }else {
        $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
      }
      if (empty($_POST["content"])) {
        $content = "";
      }else{
        $content = $_POST["content"];
      }
      if (empty($_POST["seo_title"])) {
        $seo_title = "";
      }else{
        $seo_title = $_POST["seo_title"];
      }
      if (empty($_POST["seo_keywords"])) {
        $seo_keywords = "";
      }else{
        $seo_keywords = $_POST["seo_keywords"];
      }
      if (empty($_POST["seo_description"])) {
        $seo_description = "";
      }else{
        $seo_description = $_POST["seo_description"];
      }
      $post_type = "post_page";
      $status = 1;
      $order_sort = 1;
      $categories = 0;
      $rowControl = $db->prepare("SELECT * FROM posts WHERE seo_url=:seo_url");
      $rowControl->execute(array(
        'seo_url' =>$seoUrl
      ));
      if($rowControl->rowCount()){
        Header("Location:../pagesAdd?status=seoUrlError");
      }else{
        if ($_POST['title'] == "") {
          Header("Location:../pagesAdd?status=titleEmptyError");
        }else{
          // Image Length Control
          if ($_FILES['banner']['size'] > 0){
            // Image Upload
            $image = new Upload($_FILES['banner']);
            $uploads_dir = '../../uploads';
            @$name = $_FILES['banner']["name"];
            $extension = uzanti($name);
            $uniqnumber1 = rand(20000,32000);
            $uniqnumber2 = rand(20000,32000);
            $uniqname = $uniqnumber1.$uniqnumber2;
            $imagepath ='pages_banner_'.$uniqname;
            $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
            if($image->uploaded){
              $image->file_new_name_body = $imagepath;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
              // Image resize 270x300
              $image->file_new_name_body = $imagepath.'-270x300';
              $image->image_resize = true;
              $image->image_x = 270;
              $image->image_y = 300;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
            }
          }else{
            $vtpath = "";
          }
          // Add Database
          $addData=$db->prepare("INSERT INTO posts SET
            post_type=:post_type,
            categories=:categories,
            banner=:banner,
            title=:title,
            content=:content,
            seo_title=:seo_title,
            seo_keywords=:seo_keywords,
            seo_description=:seo_description,
            dates=:dates,
            seo_url=:seo_url,
            status=:status,
            home_status=:home_status,
            order_sort=:order_sort,
            template=:template,
            language=:language
          ");
          $insert=$addData->execute(array(
            'post_type'        => $post_type,
            'categories'       => $categories,
            'banner'           => $vtpath,
            'title'            => $_POST['title'],
            'content'          => $content,
            'seo_title'        => $seo_title,
            'seo_keywords'     => $seo_keywords,
            'seo_description'  => $seo_description,
            'dates'            => $_POST['dates'],
            'seo_url'          => $seoUrl,
            'status'           => $status,
            'home_status'      => 0,
            'order_sort'       => $order_sort,
            'template'         => $_POST['template'],
            'language'         => $_POST['language_id']
          ));
          if($insert){
            Header("Location:../pagesList?status=success");
          }else{
            Header("Location:../pagesList?status=error");
          }
        }
      }
    }

    // ===================================== //
    // ========= Person Operation ========== //
    // ===================================== //
    if (isset($_POST['personSocialAdd'])) {
      $status;
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      $addData=$db->prepare("INSERT INTO person_social SET
        icon=:icon,
        personel_id=:personel_id,
        link=:link,
        status=:status
        ");
      $insert=$addData->execute(array(
        'icon'         => $_POST["icon"],
        'personel_id'  => $_POST["personel_id"],
        'link'         => $_POST["link"],
        'status'       => $status
      ));
      if($insert){
        Header("Location:../personSocialList?status=success");
      }else{
        Header("Location:../personSocialList?status=error");
      }
    }
    if (isset($_POST['personAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if (empty($_POST["mission"])) {
        $mission = "";
      }else{
        $mission = $_POST["mission"];
      }
      if (empty($_POST["email"])) {
        $email = "";
      }else{
        $email = $_POST["email"];
      }
      if (empty($_POST["phone"])) {
        $phone = "";
      }else{
        $phone = $_POST["phone"];
      }
      if ($_POST['name'] == ""){
        Header("Location:../personAdd?status=titleEmptyError");
      }else{
        if ($_FILES['upload_image']['size'] > 0) {
          // Image Upload
          $image = new Upload($_FILES['upload_image']);
          $uploads_dir = '../../uploads';
          @$name = $_FILES['upload_image']["name"];
          $extension = uzanti($name);
          $uniqnumber1 = rand(20000,32000);
          $uniqnumber2 = rand(20000,32000);
          $uniqname = $uniqnumber1.$uniqnumber2;
          $imagepath ='person_image_'.$uniqname;
          $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
          if($image->uploaded){
            $image->file_new_name_body = $imagepath;
            $image->allowed = array ('image/*');
            $image->Process('../../uploads/');
          }
        }else{
          $vtpath = "";
        }
        $addData=$db->prepare("INSERT INTO person SET
          banner=:banner,
          name=:name,
          mission=:mission,
          email=:email,
          phone=:phone,
          status=:status,
          order_sort=:order_sort
          ");
        $insert=$addData->execute(array(
          'banner'     => $vtpath,
          'name'       => $_POST["name"],
          'mission'    => $mission,
          'email'      => $email,
          'phone'      => $phone,
          'status'     => $status,
          'order_sort' => $order_sort
        ));
        if($insert){
          Header("Location:../personList?status=success");
        }else{
          Header("Location:../personList?status=error");
        }
      }
    }

    // ===================================== //
    // ========= Reference Operation ======= //
    // ===================================== //
    if (isset($_POST['referenceAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if (empty($_POST["categories"])) {
        $categories = 0;
      }else{
        $categories = $_POST["categories"];
      }
      // Image Length Control
      if ($_FILES['banner']['size'] > 0){
        // Image Upload
        $image = new Upload($_FILES['banner']);
        $uploads_dir = '../../uploads';
        @$name = $_FILES['banner']["name"];
        $extension = uzanti($name);
        $uniqnumber1 = rand(20000,32000);
        $uniqnumber2 = rand(20000,32000);
        $uniqname = $uniqnumber1.$uniqnumber2;
        $imagepath ='reference_logo_'.$uniqname;
        $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
        if($image->uploaded){
          $image->file_new_name_body = $imagepath;
          $image->allowed = array ('image/*');
          $image->Process('../../uploads/');
          // Image resize 270x300
          $image->file_new_name_body = $imagepath.'-200x100';
          $image->image_resize = true;
          $image->image_x = 200;
          $image->image_y = 100;
          $image->allowed = array ('image/*');
          $image->Process('../../uploads/');
        }
      }else{
        $vtpath = "";
      }
      // Add Database
      $addData=$db->prepare("INSERT INTO reference SET
        banner=:banner,
        categories=:categories,
        name=:name,
        link=:link,
        status=:status,
        order_sort=:order_sort,
        language=:language
      ");
      $insert=$addData->execute(array(
        'banner'       => $vtpath,
        'categories'   => $categories,
        'name'         => $_POST["name"],
        'link'         => $_POST["link"],
        'status'       => $status,
        'order_sort'   => $order_sort,
        'language'     => $_POST["language_id"]
      ));
      if($insert){
        Header("Location:../referenceList?status=success");
      }else{
        Header("Location:../referenceList?status=error");
      }
    }

    // ===================================== //
    // ========= Services Operation ======== //
    // ===================================== //
    if (isset($_POST['servicesAdd'])) {
      // seo url control
      if (!$_POST["seo_url"]) {
        $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
      }else {
        $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
      }
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if (empty($_POST["content"])) {
        $content = "";
      }else{
        $content = $_POST["content"];
      }
      if (empty($_POST["seo_title"])) {
        $seo_title = "";
      }else{
        $seo_title = $_POST["seo_title"];
      }
      if (empty($_POST["seo_keywords"])) {
        $seo_keywords = "";
      }else{
        $seo_keywords = $_POST["seo_keywords"];
      }
      if (empty($_POST["seo_description"])) {
        $seo_description = "";
      }else{
        $seo_description = $_POST["seo_description"];
      }
      $post_type = 'post_services';
      $template = '';
      $categories = 0;
      $rowControl = $db->prepare("SELECT * FROM posts WHERE seo_url=:seo_url");
      $rowControl->execute(array(
        'seo_url' =>$seoUrl
      ));
      if($rowControl->rowCount()){
        Header("Location:../servicesAdd?status=seoUrlError");
      }else{
        if ($_POST['title'] == "") {
          Header("Location:../servicesAdd?status=titleEmptyError");
        }else{
          // Image Length Control
          if ($_FILES['banner']['size'] > 0){
            // Image Upload
            $image = new Upload($_FILES['banner']);
            $uploads_dir = '../../uploads';
            @$name = $_FILES['banner']["name"];
            $extension = uzanti($name);
            $uniqnumber1 = rand(20000,32000);
            $uniqnumber2 = rand(20000,32000);
            $uniqname = $uniqnumber1.$uniqnumber2;
            $imagepath ='services_banner_'.$uniqname;
            $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
            if($image->uploaded){
              $image->file_new_name_body = $imagepath;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
              // Image resize 500x333
              $image->file_new_name_body = $imagepath.'-500x333';
              $image->image_resize = true;
              $image->image_x = 500;
              $image->image_y = 333;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
            }
          }else{
            $vtpath = "";
          }
          // Add Database
          $addData=$db->prepare("INSERT INTO posts SET
            post_type=:post_type,
            categories=:categories,
            banner=:banner,
            title=:title,
            content=:content,
            seo_title=:seo_title,
            seo_keywords=:seo_keywords,
            seo_description=:seo_description,
            seo_url=:seo_url,
            status=:status,
            order_sort=:order_sort,
            template=:template,
            language=:language
          ");
          $insert=$addData->execute(array(
            'post_type'        => $post_type,
            'categories'       => $categories,
            'banner'           => $vtpath,
            'title'            => $_POST["title"],
            'content'          => $content,
            'seo_title'        => $seo_title,
            'seo_keywords'     => $seo_keywords,
            'seo_description'  => $seo_description,
            'seo_url'          => $seoUrl,
            'status'           => $status,
            'order_sort'       => $order_sort,
            'template'         => $template,
            'language'         => $_POST["language_id"]
          ));
          if($insert){
            Header("Location:../servicesList?status=success");
          }else{
            Header("Location:../servicesList?status=error");
          }
        }
      }
    }

    // ===================================== //
    // ========= Slider Operation ========== //
    // ===================================== //
    if (isset($_POST['sliderAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      // Image Length Control
      if ($_FILES['banner']['size'] > 0){
        // Image Upload
        $image = new Upload($_FILES['banner']);
        $uploads_dir = '../../uploads';
        @$name = $_FILES['banner']["name"];
        $extension = uzanti($name);
        $uniqnumber1 = rand(20000,32000);
        $uniqnumber2 = rand(20000,32000);
        $uniqname = $uniqnumber1.$uniqnumber2;
        $imagepath ='slider_banner_'.$uniqname;
        $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
        if($image->uploaded){
          $image->file_new_name_body = $imagepath;
          $image->allowed = array ('image/*');
          $image->Process('../../uploads/');
        }
      }else{
        $vtpath = "";
      }
      // Add Database
      $addData=$db->prepare("INSERT INTO slider SET
        banner=:banner,
        title=:title,
        content=:content,
        link=:link,
        video_link=:video_link,
        status=:status,
        order_sort=:order_sort,
        language=:language
      ");
      $insert=$addData->execute(array(
        'banner'        => $vtpath,
        'title'         => $_POST["title"],
        'content'       => $_POST["content"],
        'link'          => $_POST["link"],
        'video_link'    => $_POST["video_link"],
        'status'        => $status,
        'order_sort'    => $order_sort,
        'language'      => $_POST["language_id"]
      ));
      if($insert){
        Header("Location:../sliderList?status=success");
      }else{
        Header("Location:../sliderList?status=error");
      }
    }

    // ===================================== //
    // ========= Social Operation ========== //
    // ===================================== //
    if (isset($_POST['socialAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      // Add Database
      $addData=$db->prepare("INSERT INTO social SET
        icon=:icon,
        name=:name,
        link=:link,
        status=:status,
        order_sort=:order_sort
      ");
      $insert=$addData->execute(array(
        'icon'           => $_POST["icon"],
        'name'           => $_POST["name"],
        'link'           => $_POST["link"],
        'status'         => $status,
        'order_sort'     => $order_sort
      ));
      if($insert){
        Header("Location:../socialList?status=success");
      }else{
        Header("Location:../socialList?status=error");
      }
    }

    // ===================================== //
    // == Reference Categories Operation === //
    // ===================================== //
    if (isset($_POST['referenceCategoriesAdd'])) {
       $seoUrl = "";
       $seo_title = "";
       $categories_type = 'reference_categories';
       $seo_keywords = "";
       $seo_description = "";
       $vtpath = "";
       $categories_top_id = 99999;
      // status control
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      // order sort control
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if ($_POST['title'] == "") {
        Header("Location:../referenceCategoriesAdd?status=titleEmptyError");
      }else{
        // Add Database
        $addData=$db->prepare("INSERT INTO categories SET
          categories_type=:categories_type,
          categories_top_id=:categories_top_id,
          banner=:banner,
          title=:title,
          seo_title=:seo_title,
          seo_keywords=:seo_keywords,
          seo_description=:seo_description,
          seo_url=:seo_url,
          status=:status,
          order_sort=:order_sort,
          language=:language
        ");
        $insert=$addData->execute(array(
          'categories_type'   => $categories_type,
          'categories_top_id' => $categories_top_id,
          'banner'            => $vtpath,
          'title'             => $_POST["title"],
          'seo_title'         => $seo_title,
          'seo_keywords'      => $seo_keywords,
          'seo_description'   => $seo_description,
          'seo_url'           => $seoUrl,
          'status'            => $status,
          'order_sort'        => $order_sort,
          'language'          => $_POST["language_id"]
        ));
        if($insert){
          Header("Location:../referenceCategoriesList?status=success");
        }else{
          Header("Location:../referenceCategoriesList?status=error");
        }
      }
    }

    // ===================================== //
    // ==== Project Categories Operation === //
    // ===================================== //
    if (isset($_POST['projectCategoriesAdd'])) {
      // categories type control
      $categories_type = 'project_categories';
      $categories_top_id = 99999;
      // Seo url control
      if (!$_POST["seo_url"]) {
        $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
      }else {
        $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
      }
      // status control
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      // order sort control
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      // seo_title control
      if (empty($_POST["seo_title"])) {
        $seo_title = "";
      }else{
        $seo_title = $_POST["seo_title"];
      }
      // seo keywords control
      if (empty($_POST["seo_keywords"])) {
        $seo_keywords = "";
      }else{
        $seo_keywords = $_POST["seo_keywords"];
      }
      // seo description control
      if (empty($_POST["seo_description"])) {
        $seo_description = "";
      }else{
        $seo_description = $_POST["seo_description"];
      }
      $rowControl = $db->prepare("SELECT * FROM categories WHERE seo_url=:seo_url");
      $rowControl->execute(array(
        'seo_url' =>$seoUrl
      ));
      if($rowControl->rowCount()){
        Header("Location:../projectCategoriesAdd?status=seoUrlError");
      }else{
        if ($_POST['title'] == "") {
          Header("Location:../projectCategoriesAdd?status=titleEmptyError");
        }else{
          // Image Length Control
          if ($_FILES['banner']['size'] > 0){
            // Image Upload
            $image = new Upload($_FILES['banner']);
            $uploads_dir = '../../uploads';
            @$name = $_FILES['banner']["name"];
            $extension = uzanti($name);
            $uniqnumber1 = rand(20000,32000);
            $uniqnumber2 = rand(20000,32000);
            $uniqname = $uniqnumber1.$uniqnumber2;
            $imagepath = $categories_type.'_banner_'.$uniqname;
            $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
            if($image->uploaded){
              $image->file_new_name_body = $imagepath;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
              // Image resize 270x300
              $image->file_new_name_body = $imagepath.'-270x300';
              $image->image_resize = true;
              $image->image_x = 270;
              $image->image_y = 300;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
            }
          }else{
            $vtpath = "";
          }
          // Add Database
          $addData=$db->prepare("INSERT INTO categories SET
            categories_type=:categories_type,
            categories_top_id=:categories_top_id,
            banner=:banner,
            title=:title,
            seo_title=:seo_title,
            seo_keywords=:seo_keywords,
            seo_description=:seo_description,
            seo_url=:seo_url,
            status=:status,
            order_sort=:order_sort,
            language=:language
          ");
          $insert=$addData->execute(array(
            'categories_type'   => $categories_type,
            'categories_top_id' => $categories_top_id,
            'banner'            => $vtpath,
            'title'             => $_POST["title"],
            'seo_title'         => $seo_title,
            'seo_keywords'      => $seo_keywords,
            'seo_description'   => $seo_description,
            'seo_url'           => $seoUrl,
            'status'            => $status,
            'order_sort'        => $order_sort,
            'language'          => $_POST["language_id"]
          ));
          if($insert){
            Header("Location:../projectCategoriesList?status=success");
          }else{
            Header("Location:../projectCategoriesList?status=error");
          }
        }
      }
    }

    // ===================================== //
    // ==== Post Categories Operation ====== //
    // ===================================== //
    if (isset($_POST['postCategoriesAdd'])) {
      // categories type control
      $categories_type ='post_categories';
      // seo url control
      if (!$_POST["seo_url"]) {
        $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
      }else {
        $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
      }
      // status control
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      // order sort control
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      // seo_title control
      if (empty($_POST["seo_title"])) {
        $seo_title = "";
      }else{
        $seo_title = $_POST["seo_title"];
      }
      // seo keywords control
      if (empty($_POST["seo_keywords"])) {
        $seo_keywords = "";
      }else{
        $seo_keywords = $_POST["seo_keywords"];
      }
      // seo description control
      if (empty($_POST["seo_description"])) {
        $seo_description = "";
      }else{
        $seo_description = $_POST["seo_description"];
      }
      $rowControl = $db->prepare("SELECT * FROM categories WHERE seo_url=:seo_url");
      $rowControl->execute(array(
        'seo_url' =>$seoUrl
      ));
      if($rowControl->rowCount()){
        Header("Location:../postCategoriesAdd?status=seoUrlError");
      }else{
        if ($_POST['title'] == "") {
          Header("Location:../postCategoriesAdd?status=titleEmptyError");
        }else{
          // Image Length Control
          if ($_FILES['banner']['size'] > 0){
            // Image Upload
            $image = new Upload($_FILES['banner']);
            $uploads_dir = '../../uploads';
            @$name = $_FILES['banner']["name"];
            $extension = uzanti($name);
            $uniqnumber1 = rand(20000,32000);
            $uniqnumber2 = rand(20000,32000);
            $uniqname = $uniqnumber1.$uniqnumber2;
            $imagepath = $categories_type.'_banner_'.$uniqname;
            $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
            if($image->uploaded){
              $image->file_new_name_body = $imagepath;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
              // Image resize 270x300
              $image->file_new_name_body = $imagepath.'-270x300';
              $image->image_resize = true;
              $image->image_x = 270;
              $image->image_y = 300;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
            }
          }else{
            $vtpath = "";
          }
          // Add Database
          $addData=$db->prepare("INSERT INTO categories SET
            categories_type=:categories_type,
            categories_top_id=:categories_top_id,
            banner=:banner,
            title=:title,
            seo_title=:seo_title,
            seo_keywords=:seo_keywords,
            seo_description=:seo_description,
            seo_url=:seo_url,
            status=:status,
            order_sort=:order_sort,
            language=:language
          ");
          $insert=$addData->execute(array(
            'categories_type'   => $categories_type,
            'categories_top_id' => $_POST["categories_top_id"],
            'banner'            => $vtpath,
            'title'             => $_POST["title"],
            'seo_title'         => $seo_title,
            'seo_keywords'      => $seo_keywords,
            'seo_description'   => $seo_description,
            'seo_url'           => $seoUrl,
            'status'            => $status,
            'order_sort'        => $order_sort,
            'language'          => $_POST["language_id"]
          ));
          if($insert){
            Header("Location:../postCategoriesList?status=success");
          }else{
            Header("Location:../postCategoriesList?status=error");
          }
        }
      }
    }

    // ===================================== //
    // ===== Packet Categories Operation === //
    // ===================================== //
    if (isset($_POST['packetCategoriesAdd'])) {
       $seoUrl = "";
       $seo_title = "";
       $categories_type = 'packet_categories';
       $seo_keywords = "";
       $seo_description = "";
       $vtpath = "";
       $categories_top_id = 99999;
      // status control
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      // order sort control
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if ($_POST['title'] == "") {
        Header("Location:../packetCategoriesAdd?status=titleEmptyError");
      }else{
        // Add Database
        $addData=$db->prepare("INSERT INTO categories SET
          categories_type=:categories_type,
          categories_top_id=:categories_top_id,
          banner=:banner,
          title=:title,
          seo_title=:seo_title,
          seo_keywords=:seo_keywords,
          seo_description=:seo_description,
          seo_url=:seo_url,
          status=:status,
          order_sort=:order_sort,
          language=:language
        ");
        $insert=$addData->execute(array(
          'categories_type'   => $categories_type,
          'categories_top_id' => $categories_top_id,
          'banner'            => $vtpath,
          'title'             => $_POST["title"],
          'seo_title'         => $seo_title,
          'seo_keywords'      => $seo_keywords,
          'seo_description'   => $seo_description,
          'seo_url'           => $seoUrl,
          'status'            => $status,
          'order_sort'        => $order_sort,
          'language'          => $_POST["language_id"]
        ));
        if($insert){
          Header("Location:../packetCategoriesList?status=success");
        }else{
          Header("Location:../packetCategoriesList?status=error");
        }
      }
    }

    // ===================================== //
    // ==== Product Categories Operation === //
    // ===================================== //
    if (isset($_POST['productCategoriesAdd'])) {
      // categories type control
      $categories_type ='product_categories';
      // seo url control
      if (!$_POST["seo_url"]) {
        $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
      }else {
        $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
      }
      // status control
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      // order sort control
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      // seo_title control
      if (empty($_POST["seo_title"])) {
        $seo_title = "";
      }else{
        $seo_title = $_POST["seo_title"];
      }
      // seo keywords control
      if (empty($_POST["seo_keywords"])) {
        $seo_keywords = "";
      }else{
        $seo_keywords = $_POST["seo_keywords"];
      }
      // seo description control
      if (empty($_POST["seo_description"])) {
        $seo_description = "";
      }else{
        $seo_description = $_POST["seo_description"];
      }
      $rowControl = $db->prepare("SELECT * FROM categories WHERE seo_url=:seo_url");
      $rowControl->execute(array(
        'seo_url' =>$seoUrl
      ));
      if($rowControl->rowCount()){
        Header("Location:../productCategoriesAdd?status=seoUrlError");
      }else{
        if ($_POST['title'] == "") {
          Header("Location:../productCategoriesAdd?status=titleEmptyError");
        }else{
          // Image Length Control
          if ($_FILES['banner']['size'] > 0){
            // Image Upload
            $image = new Upload($_FILES['banner']);
            $uploads_dir = '../../uploads';
            @$name = $_FILES['banner']["name"];
            $extension = uzanti($name);
            $uniqnumber1 = rand(20000,32000);
            $uniqnumber2 = rand(20000,32000);
            $uniqname = $uniqnumber1.$uniqnumber2;
            $imagepath = $categories_type.'_banner_'.$uniqname;
            $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
            if($image->uploaded){
              $image->file_new_name_body = $imagepath;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
              // Image resize 270x300
              $image->file_new_name_body = $imagepath.'-270x300';
              $image->image_resize = true;
              $image->image_x = 270;
              $image->image_y = 300;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
            }
          }else{
            $vtpath = "";
          }
          // Add Database
          $addData=$db->prepare("INSERT INTO categories SET
            categories_type=:categories_type,
            categories_top_id=:categories_top_id,
            banner=:banner,
            title=:title,
            seo_title=:seo_title,
            seo_keywords=:seo_keywords,
            seo_description=:seo_description,
            seo_url=:seo_url,
            status=:status,
            order_sort=:order_sort,
            language=:language
          ");
          $insert=$addData->execute(array(
            'categories_type'   => $categories_type,
            'categories_top_id' => $_POST["categories_top_id"],
            'banner'            => $vtpath,
            'title'             => $_POST["title"],
            'seo_title'         => $seo_title,
            'seo_keywords'      => $seo_keywords,
            'seo_description'   => $seo_description,
            'seo_url'           => $seoUrl,
            'status'            => $status,
            'order_sort'        => $order_sort,
            'language'          => $_POST["language_id"]
          ));
          if($insert){
            Header("Location:../productCategoriesList?status=success");
          }else{
            Header("Location:../productCategoriesList?status=error");
          }
        }
      }
    }

    // ===================================== //
    // ========= Project Operation ========= //
    // ===================================== //
    if (isset($_POST['projectAdd'])) {
      // seo url control
      if (!$_POST["seo_url"]) {
        $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
      }else {
        $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
      }
      // status control
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      // order sort control
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      // categories type control
      $categories = $_POST['categories'];
      // seo_title control
      if (empty($_POST["seo_title"])) {
        $seo_title = "";
      }else{
        $seo_title = $_POST["seo_title"];
      }
      // seo keywords control
      if (empty($_POST["seo_keywords"])) {
        $seo_keywords = "";
      }else{
        $seo_keywords = $_POST["seo_keywords"];
      }
      // seo description control
      if (empty($_POST["seo_description"])) {
        $seo_description = "";
      }else{
        $seo_description = $_POST["seo_description"];
      }
      // startdate Control
      if (empty($_POST["startdate"])) {
        $startdate = "";
      }else{
        $startdate = $_POST["startdate"];
      }
      // finishdate Control
      if (empty($_POST["finishdate"])) {
        $finishdate = "";
      }else{
        $finishdate = $_POST["finishdate"];
      }
      // website Control
      if (empty($_POST["website"])) {
        $website = "";
      }else{
        $website = $_POST["website"];
      }
      // video Control
      if (empty($_POST["video"])) {
        $video = "";
      }else{
        $video = $_POST["video"];
      }
      // maps Control
      if (empty($_POST["maps"])) {
        $maps = "";
      }else{
        $maps = $_POST["maps"];
      }
      $categoriesAdd = implode(",",$_POST["categories"]);
      $post_type = 'post_projects';
      $template = '';
      $rowControl = $db->prepare("SELECT * FROM posts WHERE seo_url=:seo_url");
      $rowControl->execute(array(
        'seo_url' =>$seoUrl
      ));
      if($rowControl->rowCount()){
        Header("Location:../projectAdd?status=seoUrlError");
      }else{
        if ($_POST['title'] == "") {
          Header("Location:../projectAdd?status=titleEmptyError");
        }else{
          // Image Length Control
          if ($_FILES['banner']['size'] > 0){
            // Image Upload
            $image = new Upload($_FILES['banner']);
            $uploads_dir = '../../uploads';
            @$name = $_FILES['banner']["name"];
            $extension = uzanti($name);
            $uniqnumber1 = rand(20000,32000);
            $uniqnumber2 = rand(20000,32000);
            $uniqname = $uniqnumber1.$uniqnumber2;
            $imagepath = 'project_banner_'.$uniqname;
            $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
            if($image->uploaded){
              $image->file_new_name_body = $imagepath;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
              // Image resize 270x300
              $image->file_new_name_body = $imagepath.'-500x333';
              $image->image_resize = true;
              $image->image_x = 500;
              $image->image_y = 333;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
            }
          }else{
            $vtpath = "";
          }
          // Add Database
          $addData=$db->prepare("INSERT INTO posts SET
            post_type=:post_type,
            categories=:categories,
            banner=:banner,
            title=:title,
            content=:content,
            dates=:dates,
            seo_url=:seo_url,
            seo_title=:seo_title,
            seo_keywords=:seo_keywords,
            seo_description=:seo_description,
            status=:status,
            home_status=:home_status,
            order_sort=:order_sort,
            template=:template,
            language=:language
          ");
          $insert=$addData->execute(array(
            'post_type'        => $post_type,
            'categories'       => $categoriesAdd,
            'banner'           => $vtpath,
            'title'            => $_POST["title"],
            'content'          => $_POST["content"],
            'dates'            => $_POST["dates"],
            'seo_url'          => $seoUrl,
            'seo_title'        => $seo_title,
            'seo_keywords'     => $seo_keywords,
            'seo_description'  => $seo_description,
            'status'           => $status,
            'home_status'      => 0,
            'order_sort'       => $order_sort,
            'template'         => $template,
            'language'         => $_POST["language_id"]
          ));
          if($insert){
           $projectPostId=$db->lastInsertId();
           // Project Table Add
           $projectAdd=$db->prepare("INSERT INTO projects SET
             project_post_id=:project_post_id,
             start_date=:start_date,
             end_date=:end_date,
             website=:website,
             video=:video,
             maps=:maps
           ");
           $projectInsert=$projectAdd->execute(array(
             'project_post_id'  => $projectPostId,
             'start_date'       => $startdate,
             'end_date'         => $finishdate,
             'website'          => $website,
             'video'            => $video,
             'maps'             => $maps
           ));
           if ($projectInsert){
             Header("Location:../projectList?status=success");
           }else{
             Header("Location:../projectList?status=error");
           }
          }else{
            Header("Location:../projectList?status=error");
          }
        }
      }
    }

    // ===================================== //
    // ========= Post Operation ============ //
    // ===================================== //
    if (isset($_POST['postAdd'])) {
      // seo url control
      if (!$_POST["seo_url"]) {
        $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
      }else {
        $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
      }
      // post_type control
      $post_type = "post_post";
      // status control
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      // order sort control
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      // seo_title control
      if (empty($_POST["seo_title"])) {
        $seo_title = "";
      }else{
        $seo_title = $_POST["seo_title"];
      }
      // seo keywords control
      if (empty($_POST["seo_keywords"])) {
        $seo_keywords = "";
      }else{
        $seo_keywords = $_POST["seo_keywords"];
      }
      // seo description control
      if (empty($_POST["seo_description"])) {
        $seo_description = "";
      }else{
        $seo_description = $_POST["seo_description"];
      }
      $categoriesAdd = implode(",",$_POST["categories"]);
      $template = "";
      $rowControl = $db->prepare("SELECT * FROM posts WHERE seo_url=:seo_url");
      $rowControl->execute(array(
        'seo_url' =>$seoUrl
      ));
      if($rowControl->rowCount()){
        Header("Location:../postAdd?status=seoUrlError");
      }else{
        if ($_POST['title'] == "") {
          Header("Location:../postAdd?status=titleEmptyError");
        }else{
          // Image Length Control
          if ($_FILES['banner']['size'] > 0){
            // Image Upload
            $image = new Upload($_FILES['banner']);
            $uploads_dir = '../../uploads';
            @$name = $_FILES['banner']["name"];
            $extension = uzanti($name);
            $uniqnumber1 = rand(20000,32000);
            $uniqnumber2 = rand(20000,32000);
            $uniqname = $uniqnumber1.$uniqnumber2;
            $imagepath ='post_banner_'.$uniqname;
            $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
            if($image->uploaded){
              $image->file_new_name_body = $imagepath;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
              // Image resize 270x300
              $image->file_new_name_body = $imagepath.'-500x333';
              $image->image_resize = true;
              $image->image_x = 500;
              $image->image_y = 333;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
            }
          }else{
            $vtpath = "";
          }
          // Add Database
          $addData=$db->prepare("INSERT INTO posts SET
            post_type=:post_type,
            categories=:categories,
            banner=:banner,
            title=:title,
            content=:content,
            seo_title=:seo_title,
            seo_keywords=:seo_keywords,
            seo_description=:seo_description,
            dates=:dates,
            seo_url=:seo_url,
            status=:status,
            home_status=:home_status,
            order_sort=:order_sort,
            template=:template,
            language=:language
          ");
          $insert=$addData->execute(array(
            'post_type'        => $post_type,
            'categories'       => $categoriesAdd,
            'banner'           => $vtpath,
            'title'            => $_POST['title'],
            'content'          => $_POST['content'],
            'seo_title'        => $seo_title,
            'seo_keywords'     => $seo_keywords,
            'seo_description'  => $seo_description,
            'dates'            => $_POST['dates'],
            'seo_url'          => $seoUrl,
            'status'           => $status,
            'home_status'      => 0,
            'order_sort'       => $order_sort,
            'template'         => $template,
            'language'         => $_POST['language_id']
          ));
          if($insert){
            Header("Location:../postList?status=success");
          }else{
            Header("Location:../postList?status=error");
          }
        }
      }
    }

    // ===================================== //
    // ===== Packet Features Operation ===== //
    // ===================================== //
    if (isset($_POST['packetFeatureAdd'])) {
      // order sort control
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      $title = $_POST["title"];
      $rowControl = $db->prepare("SELECT * FROM packet_features WHERE title=:title");
      $rowControl->execute(array(
        'title' => $title
      ));
      if($rowControl->rowCount()){
        Header("Location:../packetFeatureAdd?status=seoUrlError");
      }else{
        if ($_POST['title'] == "") {
          Header("Location:../packetFeatureAdd?status=titleEmptyError");
        }else{
          // Add Database
          $addData=$db->prepare("INSERT INTO packet_features SET
            title=:title,
            order_sort=:order_sort,
            language=:language
          ");
          $insert=$addData->execute(array(
            'title'           => $_POST['title'],
            'order_sort'      => $order_sort,
            'language'        => $_POST['language_id']
          ));
          if($insert){
            Header("Location:../packetFeaturesList?status=success");
          }else{
            Header("Location:../packetFeaturesList?status=error");
          }
        }
      }
    }

    // ===================================== //
    // ========= Packets Operation ========= //
    // ===================================== //
    if (isset($_POST['packetAdd'])) {
      // suggested control
      if (empty($_POST["suggested"])) {
        $suggested = 0;
      }else{
        $suggested = 1;
      }
      // status control
      if (empty($_POST["status"])) {
        $status = 0;
      }else{
        $status = 1;
      }
      // order_sort control
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      // price control
      if (empty($_POST["price"])) {
        $price = 0;
      }else{
        $price = $_POST["price"];
      }
      // categories control
      if (empty($_POST["categories"])) {
        $categories = 0;
      }else{
        $categories = $_POST["categories"];
      }
      $title = $_POST["title"];
      $featuresadd = implode(",",$_POST["features"]);
      if ($_POST['title'] == "") {
        Header("Location:../packetAdd?status=titleEmptyError");
      }else{
        // Add Database
        $addData=$db->prepare("INSERT INTO packets SET
          categories=:categories,
          title=:title,
          features=:features,
          price=:price,
          option_type=:option_type,
          currency=:currency,
          suggested=:suggested,
          status=:status,
          order_sort=:order_sort,
          language=:language
        ");
        $insert=$addData->execute(array(
        'categories'    => $categories,
        'title'         => $title,
        'features'      => $featuresadd,
        'price'         => $price,
        'option_type'   => $_POST["option_type"],
        'currency'      => $_POST["currency"],
        'suggested'     => $suggested,
        'status'        => $status,
        'order_sort'    => $order_sort,
        'language'      => $_POST["language_id"]
        ));
        if($insert){
          Header("Location:../packetList?status=success");
        }else{
          Header("Location:../packetList?status=error");
        }
      }
    }

    // ===================================== //
    // ========= Product Operation ========= //
    // ===================================== //
    if (isset($_POST['productAdd'])) {
      // seo url control
      if (!$_POST["seo_url"]) {
        $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
      }else {
        $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
      }
      // status control
      if (empty($_POST["status"])) {
        $status = 0;
      }else{
        $status = 1;
      }
      // order_sort control
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      // categories control
      if (empty($_POST["categories"])) {
        $categories = 0;
      }else{
        $categories = $_POST["categories"];
      }
      $post_type = 'post_products';
      $template = '';
      $rowControl = $db->prepare("SELECT * FROM posts WHERE seo_url=:seo_url");
      $rowControl->execute(array(
        'seo_url' =>$seoUrl
      ));
      if($rowControl->rowCount()){
        Header("Location:../productAdd?status=seoUrlError");
      }else{
        if ($_POST['title'] == "") {
          Header("Location:../productAdd?status=titleEmptyError");
        }else{
          // Image Length Control
          if ($_FILES['banner']['size'] > 0){
            // Image Upload
            $image = new Upload($_FILES['banner']);
            $uploads_dir = '../../uploads';
            @$name = $_FILES['banner']["name"];
            $extension = uzanti($name);
            $uniqnumber1 = rand(20000,32000);
            $uniqnumber2 = rand(20000,32000);
            $uniqname = $uniqnumber1.$uniqnumber2;
            $imagepath = 'product_banner_'.$uniqname;
            $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
            if($image->uploaded){
              $image->file_new_name_body = $imagepath;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
              // Image resize 270x300
              $image->file_new_name_body = $imagepath.'-270x300';
              $image->image_resize = true;
              $image->image_x = 270;
              $image->image_y = 300;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
            }
          }else{
            $vtpath = "";
          }
          // Add Database
          $addData=$db->prepare("INSERT INTO posts SET
            post_type=:post_type,
            banner=:banner,
            categories=:categories,
            title=:title,
            content=:content,
            seo_url=:seo_url,
            dates=:dates,
            seo_title=:seo_title,
            seo_keywords=:seo_keywords,
            seo_description=:seo_description,
            status=:status,
            home_status=:home_status,
            order_sort=:order_sort,
            template=:template,
            language=:language
          ");
          $insert=$addData->execute(array(
            'post_type'       => $post_type,
            'banner'          => $vtpath,
            'categories'      => $categories,
            'title'           => $_POST['title'],
            'content'         => $_POST['content'],
            'seo_url'         => $seoUrl,
            'dates'           => $_POST['dates'],
            'seo_title'       => $_POST['seo_title'],
            'seo_keywords'    => $_POST['seo_keywords'],
            'seo_description' => $_POST['seo_description'],
            'status'          => $status,
            'home_status'     => 0,
            'order_sort'      => $order_sort,
            'template'        => $template,
            'language'        => $_POST['language_id']
          ));
          if($insert){
            $productPostId=$db->lastInsertId();
            // Project Table Add
            $productAdd=$db->prepare("INSERT INTO products SET
              product_post_id=:product_post_id,
              price=:price,
              discount_price=:discount_price,
              currency=:currency,
              product_code=:product_code,
              stock_number=:stock_number,
              vat=:vat,
              other_link=:other_link,
              video=:video,
              maps=:maps,
              order_sales=:order_sales
            ");
            $productInsert=$productAdd->execute(array(
              'product_post_id'  => $productPostId,
              'price'            => $_POST['price'],
              'discount_price'   => $_POST['discount_price'],
              'currency'         => $_POST['currency'],
              'product_code'     => $_POST['product_code'],
              'stock_number'     => $_POST['stock_number'],
              'vat'              => $_POST['vat'],
              'other_link'       => $_POST['other_link'],
              'video'            => $_POST['video'],
              'maps'             => $_POST['maps'],
              'order_sales'      => $_POST['order_sales']
            ));
            if ($productInsert){
              Header("Location:../productList?status=success");
            }else{
              Header("Location:../productList?status=error");
            }
          }else{
            Header("Location:../productList?status=error");
          }
        }
      }
    }

    // ===================================== //
    // ======== iGallery Operation ========= //
    // ===================================== //
    if (isset($_POST['GalleryAdd'])) {
      // seo url control
      if (!$_POST["seo_url"]) {
        $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
      }else {
        $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
      }
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if (empty($_POST["content"])) {
        $content = "";
      }else{
        $content = $_POST["content"];
      }
      if (empty($_POST["seo_title"])) {
        $seo_title = "";
      }else{
        $seo_title = $_POST["seo_title"];
      }
      if (empty($_POST["seo_keywords"])) {
        $seo_keywords = "";
      }else{
        $seo_keywords = $_POST["seo_keywords"];
      }
      if (empty($_POST["seo_description"])) {
        $seo_description = "";
      }else{
        $seo_description = $_POST["seo_description"];
      }
      $iframe = "";
      $post_type = "post_Gallery";
      $template = "";
      $categories = "";
      $rowControl = $db->prepare("SELECT * FROM posts WHERE seo_url=:seo_url");
      $rowControl->execute(array(
        'seo_url' =>$seoUrl
      ));
      if($rowControl->rowCount()){
        Header("Location:../GalleryAdd?status=seoUrlError");
      }else{
        if ($_POST['title'] == "") {
          Header("Location:../GalleryAdd?status=titleEmptyError");
        }else{
          // Image Length Control
          if ($_FILES['banner']['size'] > 0) {
            // Image Upload
            $image = new Upload($_FILES['banner']);
            $uploads_dir = '../../uploads';
            @$name = $_FILES['banner']['name'];
            $extension = uzanti($name);
            $uniqnumber1 = rand(20000,32000);
            $uniqnumber2 = rand(20000,32000);
            $uniqname = $uniqnumber1.$uniqnumber2;
            $imagepath ='gallery_banner_'.$uniqname;
            $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
            if($image->uploaded){
              $image->file_new_name_body = $imagepath;
              $image->allowed = array ('image/*');
              $image->image_resize = true;
              $image->image_x = 1024;
              $image->image_y = 768;
              $image->Process('../../uploads/');
              // Image resize 270x300
              $image->file_new_name_body = $imagepath.'-270x300';
              $image->image_resize = true;
              $image->image_x = 270;
              $image->image_y = 300;
              $image->allowed = array ('image/*');
              $image->Process('../../uploads/');
            }
          }else{
            $vtpath = "";
          }
          // Add Database
          $addData=$db->prepare("INSERT INTO posts SET
            post_type=:post_type,
            categories=:categories,
            banner=:banner,
            title=:title,
            content=:content,
            seo_title=:seo_title,
            seo_keywords=:seo_keywords,
            seo_description=:seo_description,
            seo_url=:seo_url,
            dates=:dates,
            status=:status,
            home_status=:home_status,
            order_sort=:order_sort,
            template=:template,
            language=:language
          ");
          $insert=$addData->execute(array(
            'post_type'        => $post_type,
            'categories'       => $categories,
            'banner'           => $vtpath,
            'title'            => $_POST['title'],
            'content'          => $_POST['content'],
            'seo_title'        => $seo_title,
            'seo_keywords'     => $seo_keywords,
            'seo_description'  => $seo_description,
            'seo_url'          => $seoUrl,
            'dates'            => $_POST['dates'],
            'status'           => $status,
            'home_status'      => 0,
            'order_sort'       => $order_sort,
            'template'         => $template,
            'language'         => $_POST['language_id']
          ));
          if($insert){
            Header("Location:../GalleryList?status=success");
          }else{
            Header("Location:../GalleryList?status=error");
          }
        }
      }
    }
    // ===================================== //
    // ========= Menu Operation ============ //
    // ===================================== //
    if (isset($_POST['menuAdd'])) {
      // newtab kontrol
      if (empty($_POST["new_tab"])) {
        $new_tab = 0;
      }else{
        $new_tab = 1;
      }
      // footer_menu kontrol
      if (empty($_POST["footer_menu"])) {
        $footer_menu = 0;
      }else{
        $footer_menu = 1;
      }
      // status control
      if (empty($_POST["status"])) {
        $status = 0;
      }else{
        $status = 1;
      }
      // order_sort control
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      // Add Database
      $addData=$db->prepare("INSERT INTO menu SET
        menu_top_id=:menu_top_id,
        title=:title,
        ready_link=:ready_link,
        link=:link,
        new_tab=:new_tab,
        footer_menu=:footer_menu,
        status=:status,
        order_sort=:order_sort,
        language=:language
      ");
      $insert=$addData->execute(array(
        'menu_top_id'   => $_POST['menu_top_id'],
        'title'         => $_POST['title'],
        'ready_link'    => $_POST['ready_link'],
        'link'          => $_POST['link'],
        'new_tab'       => $new_tab,
        'footer_menu'   => $footer_menu,
        'status'        => $status,
        'order_sort'    => $order_sort,
        'language'      => $_POST['language_id']
      ));
      if($insert){
        Header("Location:../menuList?status=success");
      }else{
        Header("Location:../menuList?status=error");
      }
    }

    // ===================================== //
    // ========= Skills Operation ========== //
    // ===================================== //
    if (isset($_POST['skillAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      if (empty($_POST['count'])) {
        $count = 0;
      }else {
        $count = $_POST['count'];
      }
      // Add Database
      $addData=$db->prepare("INSERT INTO skills SET
        title=:title,
        count=:count,
        status=:status,
        order_sort=:order_sort,
        language=:language
      ");
      $insert=$addData->execute(array(
        'title'          => $_POST["title"],
        'count'          => $count,
        'status'         => $status,
        'order_sort'     => $order_sort,
        'language'       => $_POST["language_id"]
      ));
      if($insert){
        Header("Location:../skillList?status=success");
      }else{
        Header("Location:../skillList?status=error");
      }
    }

    // ===================================== //
    // ======== Proccess Operation ========= //
    // ===================================== //
    if (isset($_POST['proccessAdd'])) {
      if (empty($_POST['status'])) {
        $status = 0;
      }else {
        $status = 1;
      }
      if (empty($_POST["order_sort"])) {
        $order_sort = 0;
      }else{
        $order_sort = $_POST["order_sort"];
      }
      $post_type = "post_proccess";
      $categories = 99999;
      $seo_title = "";
      $seo_keywords = "";
      $seo_description = "";
      $seo_url = "";
      $template = "";
      if ($_POST['title'] == ""){
        Header("Location:../proccessAdd?status=titleEmptyError");
      }else{
        if ($_FILES['banner']['size'] > 0) {
          // Image Upload
          $image = new Upload($_FILES['banner']);
          $uploads_dir = '../../uploads';
          @$name = $_FILES['banner']['name'];
          $extension = uzanti($name);
          $uniqnumber1 = rand(20000,32000);
          $uniqnumber2 = rand(20000,32000);
          $uniqname = $uniqnumber1.$uniqnumber2;
          $imagepath ='proccess_banner_'.$uniqname;
          $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
          if($image->uploaded){
            $image->file_new_name_body = $imagepath;
            $image->allowed = array ('image/*');
            $image->Process('../../uploads/');
          }
        }else{
          $vtpath = "";
        }
        $addData=$db->prepare("INSERT INTO posts SET
          post_type=:post_type,
          categories=:categories,
          banner=:banner,
          title=:title,
          content=:content,
          seo_title=:seo_title,
          seo_keywords=:seo_keywords,
          seo_description=:seo_description,
          seo_url=:seo_url,
          dates=:dates,
          status=:status,
          order_sort=:order_sort,
          template=:template,
          home_status=:home_status,
          language=:language
          ");
        $insert=$addData->execute(array(
          'post_type'       => $post_type,
          'categories'      => $categories,
          'banner'          => $vtpath,
          'title'           => $_POST['title'],
            'content'         => $_POST['content'],
            'seo_title'       => $seo_title,
          'seo_keywords'    => $seo_keywords,
          'seo_description' => $seo_description,
          'seo_url'         => $seo_url,
          'dates'           => $_POST['dates'],
          'status'          => $status,
          'order_sort'      => $order_sort,
          'template'        => $template,
          'home_status'     => 0,
          'language'        => $_POST['language_id']
        ));
        if($insert){
          Header("Location:../proccessList?status=success");
        }else{
          Header("Location:../proccessList?status=error");
        }
      }
    }
    // ===================================== //
    // ========= Bank Operation ============ //
    // ===================================== //
    if (isset($_POST['webmasterUpdate'])) {
      // Add Database
      $editData=$db->prepare("UPDATE webmaster SET
        wm_pages=:wm_pages,
        wm_post=:wm_post,
        wm_menu=:wm_menu,
        wm_project=:wm_project,
        wm_service=:wm_service,
        wm_packet=:wm_packet,
        wm_product=:wm_product,
        wm_slider=:wm_slider,
        wm_bd=:wm_bd,
        wm_bank=:wm_bank,
        wm_faq=:wm_faq,
        wm_personal=:wm_personal,
        wm_catalog=:wm_catalog,
        wm_document=:wm_document,
        wm_notice=:wm_notice,
        wm_ref=:wm_ref,
        wm_counter=:wm_counter,
        wm_skill=:wm_skill,
        wm_proccess=:wm_proccess,
        wm_social=:wm_social,
        wm_cuscom=:wm_cuscom,
        wm_gallery=:wm_gallery
      WHERE webmaster_id={$_POST['webmaster_id']}");
      $update=$editData->execute(array(
        'wm_pages'     => $_POST["wm_pages"],
        'wm_post'      => $_POST["wm_post"],
        'wm_menu'      => $_POST["wm_menu"],
        'wm_project'   => $_POST["wm_project"],
        'wm_service'   => $_POST["wm_service"],
        'wm_packet'    => $_POST["wm_packet"],
        'wm_product'   => $_POST["wm_product"],
        'wm_slider'    => $_POST["wm_slider"],
        'wm_bd'        => $_POST["wm_bd"],
        'wm_bank'      => $_POST["wm_bank"],
        'wm_faq'       => $_POST["wm_faq"],
        'wm_personal'  => $_POST["wm_personal"],
        'wm_catalog'   => $_POST["wm_catalog"],
        'wm_document'  => $_POST["wm_document"],
        'wm_notice'    => $_POST["wm_notice"],
        'wm_ref'       => $_POST["wm_ref"],
        'wm_counter'   => $_POST["wm_counter"],
        'wm_skill'     => $_POST["wm_skill"],
        'wm_proccess'  => $_POST["wm_proccess"],
        'wm_social'    => $_POST["wm_social"],
        'wm_cuscom'    => $_POST["wm_cuscom"],
        'wm_gallery'   => $_POST["wm_gallery"]
      ));
      if($update){
        Header("Location:../webmaster?status=success");
      }else{
        Header("Location:../webmaster?status=error");
      }
    }
    // ===================================== //
    // ========= User Operation ============ //
    // ===================================== //
    if (isset($_POST['userUpdate'])) {
      $passEncode = md5(sha1($_POST["password"]));
      if ($_POST['password'] != 0) {
        $editData=$db->prepare("UPDATE user SET
          firstname=:firstname,
          lastname=:lastname,
          email=:email,
          password=:password
          WHERE user_id={$_POST['user_id']}");
        $update=$editData->execute(array(
          'firstname'    => $_POST["firstname"],
          'lastname'     => $_POST["lastname"],
          'email'        => $_POST["email"],
          'password'     => $passEncode
        ));
        if($update){
          Header("Location:../usersList?status=success");
        }else{
          Header("Location:../usersList?status=error");
        }
      }else{
        $editData=$db->prepare("UPDATE user SET
          firstname=:firstname,
          lastname=:lastname,
          email=:email
          WHERE user_id={$_POST['user_id']}");
        $update=$editData->execute(array(
          'firstname'    => $_POST["firstname"],
          'lastname'     => $_POST["lastname"],
          'email'        => $_POST["email"]
        ));
        if($update){
          Header("Location:../usersList?status=success");
        }else{
          Header("Location:../usersList?status=error");
        }
      }
    }
    if(isset($_POST['userImageUpdate'])){
      if ($_FILES['upload_image']['size'] > 0) {
        // Image Upload
        $image = new Upload($_FILES['upload_image']);
        $uploads_dir = '../../uploads';
        @$name = $_FILES['upload_image']["name"];
        $extension = uzanti($name);
        $uniqnumber1 = rand(20000,32000);
        $uniqnumber2 = rand(20000,32000);
        $uniqname = $uniqnumber1.$uniqnumber2;
        $imagepath ='user_image_'.$uniqname;
        $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
        if($image->uploaded){
          $image->file_new_name_body = $imagepath;
          $image->allowed = array ('image/*');
          $image->Process('../../uploads/');
        }
        $editData=$db->prepare("UPDATE user SET
          image=:image
          WHERE user_id={$_POST['user_id']}");
        $update=$editData->execute(array(
          'image'    =>  $vtpath
        ));
        if($update){
          $x = explode("/", $_POST['image']);
          mkdir('dnmdizini', 7777);
          unlink("../../uploads/". $x[1]);
          rmdir('dnmdizini');
          Header("Location:../index.php?page=usersEdit&user_id={$_POST['user_id']}");
        }else{
          Header("Location:../usersList?status=error");
        }
      }else {
        Header("Location:../usersList?status=error");
      }
    }

   // ===================================== //
   // ========= Bank Operation ============ //
   // ===================================== //
   if (isset($_POST['banksUpdate'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Add Database
     $editData=$db->prepare("UPDATE banks SET
       bank_name=:bank_name,
       account_name=:account_name,
       branch_code=:branch_code,
       account_number=:account_number,
       bank_iban=:bank_iban,
       order_sort=:order_sort,
       status=:status
     WHERE bank_id={$_POST['bank_id']}");
     $update=$editData->execute(array(
       'bank_name'      => $_POST["bank_name"],
       'account_name'   => $_POST["account_name"],
       'branch_code'    => $_POST["branch_code"],
       'account_number' => $_POST["account_number"],
       'bank_iban'      => $_POST["bank_iban"],
       'order_sort'     => $order_sort,
       'status'         => $status
     ));
     if($update){
       Header("Location:../banksList?status=success");
     }else{
       Header("Location:../banksList?status=error");
     }
   }

   // ===================================== //
   // ===== Branch Dealer Operation ======= //
   // ===================================== //
   if (isset($_POST['branchDealerEdit'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Add Database
     $editData=$db->prepare("UPDATE branchdealer SET
       type=:type,
       name=:name,
       email=:email,
       phone=:phone,
       map=:map,
       status=:status,
       order_sort=:order_sort
     WHERE bd_id={$_POST['bd_id']}");
     $update=$editData->execute(array(
       'type'       => $_POST["type"],
       'name'       => $_POST["name"],
       'email'      => $_POST["email"],
       'phone'      => $_POST["phone"],
       'map'        => $_POST["map"],
       'status'     => $status,
       'order_sort' => $order_sort
     ));
     if($update){
       Header("Location:../branchDealerList?status=success");
     }else{
       Header("Location:../branchDealerList?status=error");
     }
   }

   // ===================================== //
   // ========= Catalog Operation ========= //
   // ===================================== //
   if (isset($_POST['catalogUpdate'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Image Control
     if ($_FILES['link']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['link']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['link']['name'];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='catalog_file_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('application/pdf');
         $image->Process('../../uploads/');
       }
     }else{
       $vtpath = $_POST['link'];
     }
     if ($_FILES['image']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['image']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['image']['name'];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='catalog_image_'.$uniqname;
       $vtpath2 = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->image_resize = true;
         $image->image_x = 300;
         $image->image_y = 300;
         $image->Process('../../uploads/');
       }
     }else{
       $vtpath2 = $_POST['image'];
     }
     // Edit Sql
     $editData=$db->prepare("UPDATE catalog SET
       link=:link,
       name=:name,
       image=:image,
       status=:status,
       order_sort=:order_sort
       WHERE catalog_id={$_POST['catalog_id']}");
     $update=$editData->execute(array(
       'link'         => $vtpath,
       'name'         => $_POST["name"],
       'image'        => $vtpath2,
       'status'       => $status,
       'order_sort'   => $order_sort
     ));
     if($update){
       if ($_FILES['link']['size'] > 0){
         $x = explode("/", $_POST['link']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
       }
       if ($_FILES['image']['size'] > 0){
         $x = explode("/", $_POST['image']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
       }
       Header("Location:../catalogList?status=success");
     }else{
       Header("Location:../catalogList?status=error");
     }
   }

   // ===================================== //
   // ========= Counter Operation ========= //
   // ===================================== //
   if (isset($_POST['counterUpdate'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Add Database
     $editData=$db->prepare("UPDATE counter SET
       icon=:icon,
       name=:name,
       count=:count,
       status=:status,
       order_sort=:order_sort
     WHERE counter_id={$_POST['counter_id']}");
     $update=$editData->execute(array(
       'icon'           => $_POST["icon"],
       'name'           => $_POST["name"],
       'count'          => $_POST["count"],
       'status'         => $status,
       'order_sort'     => $order_sort
     ));
     if($update){
       Header("Location:../counterList?status=success");
     }else{
       Header("Location:../counterList?status=error");
     }
   }

   // ===================================== //
   // ==== Customer Comments Operation ==== //
   // ===================================== //
   if (isset($_POST['customerCommentUpdate'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Add Database
     $editData=$db->prepare("UPDATE comments SET
       name=:name,
       mission=:mission,
       comment=:comment,
       status=:status,
       order_sort=:order_sort
     WHERE comment_id={$_POST['comment_id']}");
     $update=$editData->execute(array(
       'name'           => $_POST["name"],
       'mission'        => $_POST["mission"],
       'comment'        => $_POST["comment"],
       'status'         => $status,
       'order_sort'     => $order_sort
     ));
     if($update){
       Header("Location:../customerCommentList?status=success");
     }else{
       Header("Location:../customerCommentList?status=error");
     }
   }

   // ===================================== //
   // ========= Document Operation ======== //
   // ===================================== //
   if (isset($_POST['documentUpdate'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Image Control
     if ($_FILES['image']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['image']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['image']['name'];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='document_image_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->image_resize = true;
         $image->image_x = 1024;
         $image->image_y = 768;
         $image->Process('../../uploads/');
       }
     }else{
       $vtpath = $_POST['image'];
     }
     // Edit Sql
     $editData=$db->prepare("UPDATE document SET
       name=:name,
       image=:image,
       status=:status,
       order_sort=:order_sort
       WHERE document_id={$_POST['document_id']}");
     $update=$editData->execute(array(
       'image'        => $vtpath,
       'name'         => $_POST["name"],
       'status'       => $status,
       'order_sort'   => $order_sort
     ));
     if($update){
       if ($_FILES['image']['size'] > 0){
         $x = explode("/", $_POST['image']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
       }
       Header("Location:../documentList?status=success");
     }else{
       Header("Location:../documentList?status=error");
     }
   }

   // ===================================== //
   // ========= Faqs Operation ============ //
   // ===================================== //
   if (isset($_POST['faqsUpdate'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Add Database
     $editData=$db->prepare("UPDATE posts SET
       title=:title,
       content=:content,
       order_sort=:order_sort,
       status=:status
     WHERE post_id={$_POST['post_id']}");
     $update=$editData->execute(array(
       'title'           => $_POST["title"],
       'content'         => $_POST["content"],
       'order_sort'      => $order_sort,
       'status'          => $status
     ));
     if($update){
       Header("Location:../faqsList?status=success");
     }else{
       Header("Location:../faqsList?status=error");
     }
   }

   // ===================================== //
   // ========= General Operation ========= //
   // ===================================== //
   if(isset($_POST['siteLogoUpdate'])){
     if ($_FILES['upload_image']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['upload_image']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['upload_image']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='site_logo_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $editData=$db->prepare("UPDATE general_setting SET
         site_logo=:site_logo
         WHERE general_id=1");
       $update=$editData->execute(array(
         'site_logo'    =>  $vtpath
       ));
       if($update){
         $x = explode("/", $_POST['image']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
         Header("Location:../generalEdit?status=success");
       }else{
         Header("Location:../generalEdit?status=error");
       }
     }else {
       Header("Location:../generalEdit?status=error");
     }
   }
   if(isset($_POST['siteLogo2Update'])){
     if ($_FILES['upload_image2']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['upload_image2']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['upload_image2']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='site_logo_2_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $editData=$db->prepare("UPDATE general_setting SET
         site_logo_2=:site_logo_2
         WHERE general_id=1");
       $update=$editData->execute(array(
         'site_logo_2'    =>  $vtpath
       ));
       if($update){
         $x = explode("/", $_POST['image']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
         Header("Location:../generalEdit?status=success");
       }else{
         Header("Location:../generalEdit?status=error");
       }
     }else {
       Header("Location:../generalEdit?status=error");
     }
   }
   if(isset($_POST['siteFavicoUpdate'])){
     if ($_FILES['upload_image']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['upload_image']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['upload_image']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='site_favico_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->image_resize = true;
         $image->image_ratio_crop = true;
         $image->image_x = 16;
         $image->image_y = 16;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $editData=$db->prepare("UPDATE general_setting SET
         site_favico=:site_favico
         WHERE general_id=1");
       $update=$editData->execute(array(
         'site_favico'    =>  $vtpath
       ));
       if($update){
         $x = explode("/", $_POST['image']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
         Header("Location:../generalEdit?status=success");
       }else{
         Header("Location:../generalEdit?status=error");
       }
     }else {
       Header("Location:../generalEdit?status=error");
     }
   }
   if(isset($_POST['siteAboutImageUpdate'])){
     if ($_FILES['upload_image']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['upload_image']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['upload_image']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='site_about_image'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $editData=$db->prepare("UPDATE general_setting SET
         about_image=:about_image
         WHERE general_id=1");
       $update=$editData->execute(array(
         'about_image'    =>  $vtpath
       ));
       if($update){
         $x = explode("/", $_POST['image']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
         Header("Location:../generalEdit?status=success");
       }else{
         Header("Location:../generalEdit?status=error");
       }
     }else {
        Header("Location:../generalEdit?status=error");
     }
   }
   if(isset($_POST['siteCounterImageUpdate'])){
     if ($_FILES['upload_image']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['upload_image']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['upload_image']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='site_counter_image'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $editData=$db->prepare("UPDATE general_setting SET
         counter_image=:counter_image
         WHERE general_id=1");
       $update=$editData->execute(array(
         'counter_image'    =>  $vtpath
       ));
       if($update){
         $x = explode("/", $_POST['image']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
         Header("Location:../generalEdit?status=success");
       }else{
         Header("Location:../generalEdit?status=error");
       }
     }else {
       Header("Location:../generalEdit?status=error");
     }
   }
   if(isset($_POST['siteSkillImageUpdate'])){
     if ($_FILES['upload_image']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['upload_image']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['upload_image']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='site_skill_image'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $editData=$db->prepare("UPDATE general_setting SET
         skill_image=:skill_image
         WHERE general_id=1");
       $update=$editData->execute(array(
         'skill_image'    =>  $vtpath
       ));
       if($update){
         $x = explode("/", $_POST['image']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
         Header("Location:../generalEdit?status=success");
       }else{
         Header("Location:../generalEdit?status=error");
       }
     }else {
       Header("Location:../generalEdit?status=error");
     }
   }
    if(isset($_POST['siteClientImageUpdate'])){
     if ($_FILES['upload_image']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['upload_image']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['upload_image']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='site_client_image'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $editData=$db->prepare("UPDATE general_setting SET
         client_image=:client_image
         WHERE general_id=1");
       $update=$editData->execute(array(
         'client_image'    =>  $vtpath
       ));
       if($update){
         $x = explode("/", $_POST['image']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
         Header("Location:../generalEdit?status=success");
       }else{
         Header("Location:../generalEdit?status=error");
       }
     }else {
       Header("Location:../generalEdit?status=error");
     }
   }
   if(isset($_POST['siteGeneralUpdate'])){
     $editData=$db->prepare("UPDATE general_setting SET
       site_language=:site_language,
       site_url=:site_url,
       site_title=:site_title,
       site_keyw=:site_keyw,
       site_desc=:site_desc,
       site_author=:site_author,
       site_copyright=:site_copyright,
       site_email=:site_email,
       work_time=:work_time,
       contact_land_phone=:contact_land_phone,
       contact_mobile_phone=:contact_mobile_phone,
       contact_fax=:contact_fax,
       contact_whatsapp=:contact_whatsapp,
       webmaster_name=:webmaster_name,
       webmaster_link=:webmaster_link,
       header_code=:header_code,
       footer_code=:footer_code,
       contact_adress=:contact_adress,
       site_smtphost=:site_smtphost,
       site_smtpport=:site_smtpport,
       site_smtpuser=:site_smtpuser,
       site_smtppassword=:site_smtppassword,
       site_analytics=:site_analytics,
       site_webmastertools=:site_webmastertools,
       site_maps=:site_maps,
       site_recap_sitekey=:site_recap_sitekey,
       site_recap_secretkey=:site_recap_secretkey
       WHERE general_id=1");
     $update=$editData->execute(array(
       'site_language'           =>  $_POST['site_language'],
       'site_url'                =>  $_POST['site_url'],
       'site_title'              =>  $_POST['site_title'],
       'site_keyw'               =>  $_POST['site_keyw'],
       'site_desc'               =>  $_POST['site_desc'],
       'site_author'             =>  $_POST['site_author'],
       'site_copyright'          =>  $_POST['site_copyright'],
       'site_email'              =>  $_POST['site_email'],
       'work_time'               =>  $_POST['work_time'],
       'contact_land_phone'      =>  $_POST['contact_land_phone'],
       'contact_mobile_phone'    =>  $_POST['contact_mobile_phone'],
       'contact_fax'             =>  $_POST['contact_fax'],
       'contact_whatsapp'        =>  $_POST['contact_whatsapp'],
       'webmaster_name'          =>  $_POST['webmaster_name'],
       'webmaster_link'          =>  $_POST['webmaster_link'],
       'header_code'             =>  $_POST['header_code'],
       'footer_code'             =>  $_POST['footer_code'],
       'contact_adress'          =>  $_POST['contact_adress'],
       'site_smtphost'           =>  $_POST['site_smtphost'],
       'site_smtpport'           =>  $_POST['site_smtpport'],
       'site_smtpuser'           =>  $_POST['site_smtpuser'],
       'site_smtppassword'       =>  $_POST['site_smtppassword'],
       'site_analytics'          =>  $_POST['site_analytics'],
       'site_webmastertools'     =>  $_POST['site_webmastertools'],
       'site_maps'               =>  $_POST['site_maps'],
       'site_recap_sitekey'      =>  $_POST['site_recap_sitekey'],
       'site_recap_secretkey'    =>  $_POST['site_recap_secretkey']
     ));
     if($update){
       Header("Location:../generalEdit?status=success");
     }else{
       Header("Location:../generalEdit?status=error");
     }
   }

   // ===================================== //
   // ========= Language Operation ======== //
   // ===================================== //
   if (isset($_POST['langUpdate'])) {
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     $editData=$db->prepare("UPDATE language SET
       country_code=:country_code,
       status=:status,
       order_sort=:order_sort
       WHERE language_id={$_POST['language_id']}");
     $update=$editData->execute(array(
       'country_code'    => $_POST["country_code"],
       'status'          => $status,
       'order_sort'      => $order_sort
     ));
     if($update){
       file_put_contents("../lang/". $_POST['country_code'].".php", $_POST['docs']);
       Header("Location:../languageList?status=success");
     }else{
       Header("Location:../languageList?status=error");
     }
   }

   // ===================================== //
   // ========= Notice Operation ========== //
   // ===================================== //
   if (isset($_POST['noticesUpdate'])) {
     // seo url control
     if (!$_POST["seo_url"]) {
       $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
     }else {
       $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
     }
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='notice_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
         // Image resize 270x300
         $image->file_new_name_body = $imagepath.'-270x300';
         $image->image_resize = true;
         $image->image_x = 270;
         $image->image_y = 300;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $x = explode("/", $_POST['isset_banner']);
       $y = explode('.', $x[1]);
       mkdir('dnmdizini', 7777);
       unlink("../../uploads/". $x[1]);
       unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
       rmdir('dnmdizini');
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE posts SET
       banner=:banner,
       title=:title,
       content=:content,
       seo_url=:seo_url,
       seo_title=:seo_title,
       seo_keywords=:seo_keywords,
       seo_description=:seo_description,
       status=:status,
       order_sort=:order_sort,
       seo_url=:seo_url
     WHERE post_id={$_POST['post_id']}");
     $update=$editData->execute(array(
       'banner'           => $vtpath,
       'title'            => $_POST["title"],
       'content'          => $_POST["content"],
       'seo_url'          => $seoUrl,
       'seo_title'        => $_POST["seo_title"],
       'seo_keywords'     => $_POST["seo_keywords"],
       'seo_description'  => $_POST["seo_description"],
       'status'           => $status,
       'order_sort'       => $order_sort,
       'seo_url'          => $seoUrl
     ));
     if($update){
       Header("Location:../noticesList?status=success");
     }else{
       Header("Location:../noticesList?status=error");
     }
   }

   // ===================================== //
   // ========= Pages Operation =========== //
   // ===================================== //
   if (isset($_POST['pagesUpdate'])) {
     if (!$_POST["seo_url"]) {
       $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
     }else {
       $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
     }
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='pages_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
         // Image resize 270x300
         $image->file_new_name_body = $imagepath.'-270x300';
         $image->image_resize = true;
         $image->image_x = 270;
         $image->image_y = 300;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $x = explode("/", $_POST['isset_banner']);
       $y = explode('.', $x[1]);
       mkdir('dnmdizini', 7777);
       unlink("../../uploads/". $x[1]);
       unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
       rmdir('dnmdizini');
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE posts SET
       banner=:banner,
       title=:title,
       content=:content,
       seo_title=:seo_title,
       seo_keywords=:seo_keywords,
       seo_description=:seo_description,
       seo_url=:seo_url,
       template=:template,
       language=:language
     WHERE post_id={$_POST['post_id']}");
     $update=$editData->execute(array(
       'banner'           => $vtpath,
       'title'            => $_POST["title"],
       'content'          => $_POST["content"],
       'seo_title'        => $_POST["seo_title"],
       'seo_keywords'     => $_POST["seo_keywords"],
       'seo_description'  => $_POST["seo_description"],
       'seo_url'          => $seoUrl,
       'template'         => $_POST["template"],
       'language'         => $_POST["language_id"]
     ));
     if($update){
       Header("Location:../pagesList?status=success");
     }else{
       Header("Location:../pagesList?status=error");
     }
   }

   // ===================================== //
   // ========= Person Operation ========== //
   // ===================================== //
   if (isset($_POST['personUpdate'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Image Control
     if ($_FILES['upload_image']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['upload_image']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['upload_image']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='person_image_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Sql
     $editData=$db->prepare("UPDATE person SET
       banner=:banner,
       name=:name,
       mission=:mission,
       email=:email,
       phone=:phone,
       status=:status,
       order_sort=:order_sort
       WHERE person_id={$_POST['person_id']}");
     $update=$editData->execute(array(
       'banner'     =>  $vtpath,
       'name'       =>  $_POST['name'],
       'mission'    =>  $_POST['mission'],
       'email'      =>  $_POST['email'],
       'phone'      =>  $_POST['phone'],
       'status'     =>  $status,
       'order_sort' =>  $order_sort
     ));
     if($update){
       if ($_FILES['upload_image']['size'] > 0){
         $x = explode("/", $_POST['isset_banner']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
       }
       Header("Location:../personList?status=success");
     }else{
       Header("Location:../personList?status=error");
     }
   }

   // ===================================== //
   // ========= Reference Operation ======= //
   // ===================================== //
   if (isset($_POST['referenceUpdate'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='reference_logo_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
         // Image resize 270x300
         $image->file_new_name_body = $imagepath.'-200x100';
         $image->image_resize = true;
         $image->image_x = 200;
         $image->image_y = 100;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $x = explode("/", $_POST['isset_banner']);
       $y = explode('.', $x[1]);
       mkdir('dnmdizini', 7777);
       unlink("../../uploads/". $x[1]);
       unlink("../uploads/".$y[0].'-200x100'.'.'.$y[1]);
       rmdir('dnmdizini');
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE reference SET
       banner=:banner,
       categories=:categories,
       name=:name,
       link=:link,
       status=:status,
       order_sort=:order_sort
     WHERE reference_id={$_POST['reference_id']}");
     $update=$editData->execute(array(
       'banner'       => $vtpath,
       'categories'   => $_POST["categories"],
       'name'         => $_POST["name"],
       'link'         => $_POST["link"],
       'status'       => $status,
       'order_sort'   => $order_sort
     ));
     if($update){
       Header("Location:../referenceList?status=success");
     }else{
       Header("Location:../referenceList?status=error");
     }
   }

   // ===================================== //
   // ========= Services Operation ======== //
   // ===================================== //
   if (isset($_POST['servicesUpdate'])) {
     // seo url control
     if (!$_POST["seo_url"]) {
       $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
     }else {
       $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
     }
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='services_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
         // Image resize 270x300
         $image->file_new_name_body = $imagepath.'-500x333';
         $image->image_resize = true;
         $image->image_x = 500;
         $image->image_y = 333;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $x = explode("/", $_POST['isset_banner']);
       $y = explode('.', $x[1]);
       mkdir('dnmdizini', 7777);
       unlink("../../uploads/". $x[1]);
       unlink("../uploads/".$y[0].'-500x333'.'.'.$y[1]);
       rmdir('dnmdizini');
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE posts SET
       banner=:banner,
       title=:title,
       content=:content,
       seo_title=:seo_title,
       seo_keywords=:seo_keywords,
       seo_description=:seo_description,
       seo_url=:seo_url,
       status=:status,
       order_sort=:order_sort
     WHERE post_id={$_POST['post_id']}");
     $update=$editData->execute(array(
       'banner'           => $vtpath,
       'title'            => $_POST["title"],
       'content'          => $_POST["content"],
       'seo_title'        => $_POST["seo_title"],
       'seo_keywords'     => $_POST["seo_keywords"],
       'seo_description'  => $_POST["seo_description"],
       'seo_url'          => $seoUrl,
       'status'           => $status,
       'order_sort'       => $order_sort
     ));
     if($update){
       Header("Location:../servicesList?status=success");
     }else{
       Header("Location:../servicesList?status=error");
     }
   }

   // ===================================== //
   // ========= Slider Operation ========= //
   // ===================================== //
   if (isset($_POST['sliderUpdate'])) {
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='slider_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $x = explode("/", $_POST['isset_banner']);
       mkdir('dnmdizini', 7777);
       unlink("../../uploads/". $x[1]);
       rmdir('dnmdizini');
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE slider SET
       banner=:banner,
       title=:title,
       content=:content,
       link=:link,
       video_link=:video_link,
       status=:status,
       order_sort=:order_sort
     WHERE slider_id={$_POST['slider_id']}");
     $update=$editData->execute(array(
       'banner'        => $vtpath,
       'title'         => $_POST["title"],
       'content'       => $_POST["content"],
       'link'          => $_POST["link"],
       'video_link'    => $_POST["video_link"],
       'status'        => $status,
       'order_sort'    => $order_sort
     ));
     if($update){
       Header("Location:../sliderList?status=success");
     }else{
       Header("Location:../sliderList?status=error");
     }
   }

   // ===================================== //
   // ========= Social Operation ========== //
   // ===================================== //
   if (isset($_POST['socialUpdate'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Add Database
     $editData=$db->prepare("UPDATE social SET
       icon=:icon,
       name=:name,
       link=:link,
       status=:status,
       order_sort=:order_sort
     WHERE social_id={$_POST['social_id']}");
     $update=$editData->execute(array(
       'icon'           => $_POST["icon"],
       'name'           => $_POST["name"],
       'link'           => $_POST["link"],
       'status'         => $status,
       'order_sort'     => $order_sort
     ));
     if($update){
       Header("Location:../socialList?status=success");
     }else{
       Header("Location:../socialList?status=error");
     }
   }

   // ===================================== //
   // == Reference Categories Operation === //
   // ===================================== //
   if (isset($_POST['referenceCategoriesUpdate'])) {
     // status control
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     // order sort control
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE categories SET
       title=:title,
       status=:status,
       order_sort=:order_sort
     WHERE categories_id={$_POST['categories_id']}");
     $update=$editData->execute(array(
       'title'             => $_POST["title"],
       'status'            => $status,
       'order_sort'        => $order_sort
     ));
     if($update){
       Header("Location:../referenceCategoriesList?status=success");
     }else{
       Header("Location:../referenceCategoriesList?status=error");
     }
   }

   // ===================================== //
   // ==== Project Categories Operation === //
   // ===================================== //
   if (isset($_POST['projectCategoriesUpdate'])) {
     $categories_type = 'project_categories';
     // seo url control
     if (!$_POST["seo_url"]) {
       $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
     }else {
       $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
     }
     // status control
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     // order sort control
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath = $categories_type.'_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
         // Image resize 270x300
         $image->file_new_name_body = $imagepath.'-270x300';
         $image->image_resize = true;
         $image->image_x = 270;
         $image->image_y = 300;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       if(isset($_POST['isset_banner'])){
         $x = explode("/", $_POST['isset_banner']);
         $y = explode('.', $x[1]);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
         rmdir('dnmdizini');
       }
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE categories SET
       banner=:banner,
       title=:title,
       seo_url=:seo_url,
       seo_title=:seo_title,
       seo_keywords=:seo_keywords,
       seo_description=:seo_description,
       status=:status,
       order_sort=:order_sort
     WHERE categories_id={$_POST['categories_id']}");
     $update=$editData->execute(array(
       'banner'            => $vtpath,
       'title'             => $_POST["title"],
       'seo_url'            => $seoUrl,
       'seo_title'         => $_POST["seo_title"],
       'seo_keywords'      => $_POST["seo_keywords"],
       'seo_description'   => $_POST["seo_description"],
       'status'            => $status,
       'order_sort'        => $order_sort
     ));
     if($update){
       Header("Location:../projectCategoriesList?status=success");
     }else{
       Header("Location:../projectCategoriesList?status=error");
     }
   }

   // ===================================== //
   // ==== Post Categories Operation ====== //
   // ===================================== //
   if (isset($_POST['postCategoriesUpdate'])) {
     // seo url control
     if (!$_POST["seo_url"]) {
       $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
     }else {
       $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
     }
     // status control
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     // order sort control
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // seo_title control
     if (empty($_POST["seo_title"])) {
       $seo_title = "";
     }else{
       $seo_title = $_POST["seo_title"];
     }
     // seo keywords control
     if (empty($_POST["seo_keywords"])) {
       $seo_keywords = "";
     }else{
       $seo_keywords = $_POST["seo_keywords"];
     }
     // seo description control
     if (empty($_POST["seo_description"])) {
       $seo_description = "";
     }else{
       $seo_description = $_POST["seo_description"];
     }
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath = $categories_type.'_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
         // Image resize 270x300
         $image->file_new_name_body = $imagepath.'-270x300';
         $image->image_resize = true;
         $image->image_x = 270;
         $image->image_y = 300;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       if(isset($_POST['isset_banner'])){
         $x = explode("/", $_POST['isset_banner']);
         $y = explode('.', $x[1]);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
         rmdir('dnmdizini');
       }
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE categories SET
       categories_top_id=:categories_top_id,
       banner=:banner,
       title=:title,
       seo_url=:seo_url,
       seo_title=:seo_title,
       seo_keywords=:seo_keywords,
       seo_description=:seo_description,
       status=:status,
       order_sort=:order_sort
     WHERE categories_id={$_POST['categories_id']}");
     $update=$editData->execute(array(
       'categories_top_id' => $_POST['categories_top_id'],
       'banner'            => $vtpath,
       'title'             => $_POST["title"],
       'seo_url'           => $seoUrl,
       'seo_title'         => $seo_title,
       'seo_keywords'      => $seo_keywords,
       'seo_description'   => $seo_description,
       'status'            => $status,
       'order_sort'        => $order_sort
     ));
     if($update){
       Header("Location:../postCategoriesList?status=success");
     }else{
       Header("Location:../postCategoriesList?status=error");
     }
   }

   // ===================================== //
   // ===== Packet Categories Operation === //
   // ===================================== //
   if (isset($_POST['packetCategoriesUpdate'])) {
     // status control
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     // order sort control
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE categories SET
       title=:title,
       status=:status,
       order_sort=:order_sort
     WHERE categories_id={$_POST['categories_id']}");
     $update=$editData->execute(array(
       'title'             => $_POST["title"],
       'status'            => $status,
       'order_sort'        => $order_sort
     ));
     if($update){
       Header("Location:../packetCategoriesList?status=success");
     }else{
       Header("Location:../packetCategoriesList?status=error");
     }
   }

   // ===================================== //
   // ==== Product Categories Operation === //
   // ===================================== //
   if (isset($_POST['productCategoriesUpdate'])) {
     // categories type control
     $categories_type ='product_categories';
     // seo url control
     if (!$_POST["seo_url"]) {
       $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
     }else {
       $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
     }
     // status control
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     // order sort control
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // seo_title control
     if (empty($_POST["seo_title"])) {
       $seo_title = "";
     }else{
       $seo_title = $_POST["seo_title"];
     }
     // seo keywords control
     if (empty($_POST["seo_keywords"])) {
       $seo_keywords = "";
     }else{
       $seo_keywords = $_POST["seo_keywords"];
     }
     // seo description control
     if (empty($_POST["seo_description"])) {
       $seo_description = "";
     }else{
       $seo_description = $_POST["seo_description"];
     }
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath = $categories_type.'_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
         // Image resize 270x300
         $image->file_new_name_body = $imagepath.'-270x300';
         $image->image_resize = true;
         $image->image_x = 270;
         $image->image_y = 300;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       if(isset($_POST['isset_banner'])){
         $x = explode("/", $_POST['isset_banner']);
         $y = explode('.', $x[1]);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
         rmdir('dnmdizini');
       }
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE categories SET
       categories_top_id=:categories_top_id,
       banner=:banner,
       title=:title,
       seo_url=:seo_url,
       seo_title=:seo_title,
       seo_keywords=:seo_keywords,
       seo_description=:seo_description,
       status=:status,
       order_sort=:order_sort
     WHERE categories_id={$_POST['categories_id']}");
     $update=$editData->execute(array(
       'categories_top_id' => $_POST['categories_top_id'],
       'banner'            => $vtpath,
       'title'             => $_POST["title"],
       'seo_url'           => $seoUrl,
       'seo_title'         => $seo_title,
       'seo_keywords'      => $seo_keywords,
       'seo_description'   => $seo_description,
       'status'            => $status,
       'order_sort'        => $order_sort
     ));
     if($update){
       Header("Location:../productCategoriesList?status=success");
     }else{
       Header("Location:../productCategoriesList?status=error");
     }
   }


   // ===================================== //
   // ========= Project Operation ========= //
   // ===================================== //
   if (isset($_POST['projectUpdate'])) {
     // seo url control
     if (!$_POST["seo_url"]) {
       $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
     }else {
       $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
     }
     // status control
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     // order sort control
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // seo_title control
     if (empty($_POST["seo_title"])) {
       $seo_title = "";
     }else{
       $seo_title = $_POST["seo_title"];
     }
     // seo keywords control
     if (empty($_POST["seo_keywords"])) {
       $seo_keywords = "";
     }else{
       $seo_keywords = $_POST["seo_keywords"];
     }
     // seo description control
     if (empty($_POST["seo_description"])) {
       $seo_description = "";
     }else{
       $seo_description = $_POST["seo_description"];
     }
     // startdate Control
     if (empty($_POST["startdate"])) {
       $startdate = "";
     }else{
       $startdate = $_POST["startdate"];
     }
     // finishdate Control
     if (empty($_POST["finishdate"])) {
       $finishdate = "";
     }else{
       $finishdate = $_POST["finishdate"];
     }
     // website Control
     if (empty($_POST["website"])) {
       $website = "";
     }else{
       $website = $_POST["website"];
     }
     // video Control
     if (empty($_POST["video"])) {
       $video = "";
     }else{
       $video = $_POST["video"];
     }
     // maps Control
     if (empty($_POST["maps"])) {
       $maps = "";
     }else{
       $maps = $_POST["maps"];
     }
     $categoriesAdd = implode(",",$_POST["categories"]);
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath = 'project_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
         // Image resize 270x300
         $image->file_new_name_body = $imagepath.'-500x333';
         $image->image_resize = true;
         $image->image_x = 500;
         $image->image_y = 333;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $x = explode("/", $_POST['isset_banner']);
       $y = explode('.', $x[1]);
       mkdir('dnmdizini', 7777);
       unlink("../../uploads/". $x[1]);
       unlink("../uploads/".$y[0].'-500x333'.'.'.$y[1]);
       rmdir('dnmdizini');
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE posts SET
       banner=:banner,
       categories=:categories,
       title=:title,
       content=:content,
       seo_url=:seo_url,
       seo_title=:seo_title,
       seo_keywords=:seo_keywords,
       seo_description=:seo_description,
       status=:status,
       order_sort=:order_sort
     WHERE post_id={$_POST['post_id']}");
     $update=$editData->execute(array(
       'banner'           => $vtpath,
       'categories'       => $categoriesAdd,
       'title'            => $_POST["title"],
       'content'          => $_POST["content"],
       'seo_url'          => $seoUrl,
       'seo_title'        => $seo_title,
       'seo_keywords'     => $seo_keywords,
       'seo_description'  => $seo_description,
       'status'           => $status,
       'order_sort'       => $order_sort
     ));
     if($update){
       // Edit Database
       $projectEdit=$db->prepare("UPDATE projects SET
         project_post_id=:project_post_id,
         start_date=:start_date,
         end_date=:end_date,
         website=:website,
         video=:video,
         maps=:maps
       WHERE project_post_id={$_POST['post_id']}");
       $projectUpdate=$projectEdit->execute(array(
         'project_post_id'  => $_POST['post_id'],
         'start_date'       => $startdate,
         'end_date'         => $finishdate,
         'website'          => $website,
         'video'            => $video,
         'maps'             => $maps
       ));
       if ($projectUpdate){
         Header("Location:../projectList?status=success");
       }else{
         Header("Location:../projectList?status=error");
       }
     }else{
       Header("Location:../projectList?status=error");
     }
   }
   if($_GET['projectHome']=="ok"){
     $editData=$db->prepare("UPDATE posts SET
       home_status=:home_status
       WHERE post_id={$_GET['post_id']}");
     $update=$editData->execute(array(
       'home_status' => $_GET['status']
     ));
     if($update){
       Header("Location:../projectList?status=success");
     }else{
       Header("Location:../projectList?status=error");
     }
   }

   // ===================================== //
   // ========= Post Operation ============ //
   // ===================================== //
   if (isset($_POST['postUpdate'])) {
     if (!$_POST["seo_url"]) {
       $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
     }else {
       $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
     }
     // status control
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     // order sort control
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // seo_title control
     if (empty($_POST["seo_title"])) {
       $seo_title = "";
     }else{
       $seo_title = $_POST["seo_title"];
     }
     // seo keywords control
     if (empty($_POST["seo_keywords"])) {
       $seo_keywords = "";
     }else{
       $seo_keywords = $_POST["seo_keywords"];
     }
     // seo description control
     if (empty($_POST["seo_description"])) {
       $seo_description = "";
     }else{
       $seo_description = $_POST["seo_description"];
     }
     $categoriesAdd = implode(",",$_POST["categories"]);
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='post_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
         // Image resize 270x300
         $image->file_new_name_body = $imagepath.'-500x333';
         $image->image_resize = true;
         $image->image_x = 500;
         $image->image_y = 333;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $x = explode("/", $_POST['isset_banner']);
       $y = explode('.', $x[1]);
       mkdir('dnmdizini', 7777);
       unlink("../../uploads/". $x[1]);
       unlink("../uploads/".$y[0].'-500x333'.'.'.$y[1]);
       rmdir('dnmdizini');
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE posts SET
       categories=:categories,
       banner=:banner,
       title=:title,
       content=:content,
       seo_url=:seo_url,
       seo_title=:seo_title,
       seo_keywords=:seo_keywords,
       seo_description=:seo_description,
       status=:status,
       order_sort=:order_sort
     WHERE post_id={$_POST['post_id']}");
     $update=$editData->execute(array(
       'categories'       => $categoriesAdd,
       'banner'           => $vtpath,
       'title'            => $_POST['title'],
       'content'          => $_POST['content'],
       'seo_url'          => $seoUrl,
       'seo_title'        => $seo_title,
       'seo_keywords'     => $seo_keywords,
       'seo_description'  => $seo_description,
       'status'           => $status,
       'order_sort'       => $order_sort
     ));
     if($update){
       Header("Location:../postList?status=success");
     }else{
       Header("Location:../postList?status=error");
     }
   }
   if($_GET['postHome']=="ok"){
     $editData=$db->prepare("UPDATE posts SET
       home_status=:home_status
       WHERE post_id={$_GET['post_id']}");
     $update=$editData->execute(array(
       'home_status' => $_GET['status']
     ));
     if($update){
       Header("Location:../postList?status=success");
     }else{
       Header("Location:../postList?status=error");
     }
   }
   // ===================================== //
   // ===== Packet Features Operation ===== //
   // ===================================== //
   if (isset($_POST['packetFeatureUpdate'])) {
     // order sort control
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE packet_features SET
       title=:title,
       order_sort=:order_sort
     WHERE feature_id={$_POST['feature_id']}");
     $update=$editData->execute(array(
       'title'           => $_POST['title'],
       'order_sort'      => $order_sort
     ));
     if($update){
       Header("Location:../packetFeaturesList?status=success");
     }else{
       Header("Location:../packetFeaturesList?status=error");
     }
   }

   // ===================================== //
   // ========= Packets Operation ========= //
   // ===================================== //
   if (isset($_POST['packetUpdate'])) {
     // suggested control
     if (empty($_POST["suggested"])) {
       $suggested = 0;
     }else{
       $suggested = 1;
     }
     // status control
     if (empty($_POST["status"])) {
       $status = 0;
     }else{
       $status = 1;
     }
     // order_sort control
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // price control
     if (empty($_POST["price"])) {
       $price = 0;
     }else{
       $price = $_POST["price"];
     }
     $title = $_POST["title"];
     $featuresadd = implode(",",$_POST["features"]);
     // Edit Database
     $editData=$db->prepare("UPDATE packets SET
       categories=:categories,
       title=:title,
       features=:features,
       price=:price,
       option_type=:option_type,
       currency=:currency,
       suggested=:suggested,
       status=:status,
       order_sort=:order_sort
     WHERE packet_id={$_POST['packet_id']}");
     $update=$editData->execute(array(
       'categories'    => $_POST["categories"],
       'title'         => $title,
       'features'      => $featuresadd,
       'price'         => $price,
       'option_type'   => $_POST["option_type"],
       'currency'      => $_POST["currency"],
       'suggested'     => $suggested,
       'status'        => $status,
       'order_sort'    => $order_sort
     ));
     if($update){
       Header("Location:../packetList?status=success");
     }else{
       Header("Location:../packetList?status=error");
     }
   }
   if($_GET['packOrderStatus']=="ok"){
     $editData=$db->prepare("UPDATE orders SET
       status=:status
       WHERE order_id={$_GET['order_id']}");
     $update=$editData->execute(array(
       'status' => $_GET['status']
     ));
     if($update){
       Header("Location:../packetOrderList?status=success");
     }else{
       Header("Location:../packetOrderList?status=error");
     }
   }

   // ===================================== //
   // ========= Product Operation ========= //
   // ===================================== //
   if (isset($_POST['productUpdate'])) {
     // seo url control
     if (!$_POST["seo_url"]) {
       $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
     }else {
       $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
     }
     // status control
     if (empty($_POST["status"])) {
       $status = 0;
     }else{
       $status = 1;
     }
     // order_sort control
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath = 'product_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
         // Image resize 270x300
         $image->file_new_name_body = $imagepath.'-270x300';
         $image->image_resize = true;
         $image->image_x = 270;
         $image->image_y = 300;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
       $x = explode("/", $_POST['isset_banner']);
       $y = explode('.', $x[1]);
       mkdir('dnmdizini', 7777);
       unlink("../../uploads/". $x[1]);
       unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
       rmdir('dnmdizini');
     }else{
       $vtpath = $_POST['isset_banner'];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE posts SET
       banner=:banner,
       categories=:categories,
       title=:title,
       content=:content,
       seo_url=:seo_url,
       seo_title=:seo_title,
       seo_keywords=:seo_keywords,
       seo_description=:seo_description,
       status=:status,
       order_sort=:order_sort
     WHERE post_id={$_POST['post_id']}");
     $update=$editData->execute(array(
       'banner'           => $vtpath,
       'categories'       => $_POST["categories"],
       'title'            => $_POST["title"],
       'content'          => $_POST["content"],
       'seo_url'          => $seoUrl,
       'seo_title'        => $_POST["seo_title"],
       'seo_keywords'     => $_POST["seo_keywords"],
       'seo_description'  => $_POST["seo_description"],
       'status'           => $status,
       'order_sort'       => $order_sort
     ));
     if($update){
       // Edit Database
       $productEdit=$db->prepare("UPDATE products SET
         price=:price,
         discount_price=:discount_price,
         currency=:currency,
         product_code=:product_code,
         stock_number=:stock_number,
         vat=:vat,
         other_link=:other_link,
         video=:video,
         maps=:maps,
         order_sales=:order_sales
       WHERE product_post_id={$_POST['post_id']}");
       $productUpdate=$productEdit->execute(array(
         'price'           => $_POST["price"],
         'discount_price'  => $_POST["discount_price"],
         'currency'        => $_POST["currency"],
         'product_code'    => $_POST["product_code"],
         'stock_number'    => $_POST["stock_number"],
         'vat'             => $_POST["vat"],
         'other_link'      => $_POST["other_link"],
         'video'           => $_POST["video"],
         'maps'            => $_POST["maps"],
         'order_sales'     => $_POST["order_sales"]
       ));
       if ($productUpdate){
         Header("Location:../productList?status=success");
       }else{
         Header("Location:../productList?status=error");
       }
     }else{
       Header("Location:../productList?status=error");
     }
   }
   if($_GET['productHome']=="ok"){
     $editData=$db->prepare("UPDATE posts SET
       home_status=:home_status
       WHERE post_id={$_GET['post_id']}");
     $update=$editData->execute(array(
       'home_status' => $_GET['status']
     ));
     if($update){
       Header("Location:../productList?status=success");
     }else{
       Header("Location:../productList?status=error");
     }
   }
   if($_GET['orderStatus']=="ok"){
     $editData=$db->prepare("UPDATE orders SET
       status=:status
       WHERE order_id={$_GET['order_id']}");
     $update=$editData->execute(array(
       'status' => $_GET['status']
     ));
     if($update){
       Header("Location:../productOrderList?status=success");
     }else{
       Header("Location:../productOrderList?status=error");
     }
   }
   // ===================================== //
   // ======== iGallery Operation ========= //
   // ===================================== //
   if (isset($_POST['GalleryUpdate'])) {
     // seo url control
     if (!$_POST["seo_url"]) {
       $seoUrl = $_POST['prefix'] . seo($_POST["title"]);
     }else {
       $seoUrl = $_POST['prefix'] . seo($_POST["seo_url"]);
     }
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Image Length Control
     if ($_FILES['banner']['size'] > 0){
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']["name"];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath = 'gallery_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
         if($image->uploaded){
           $image->file_new_name_body = $imagepath;
           $image->allowed = array ('image/*');
           $image->Process('../../uploads/');
           // Image resize 270x300
           $image->file_new_name_body = $imagepath.'-270x300';
           $image->image_resize = true;
           $image->image_x = 270;
           $image->image_y = 300;
           $image->allowed = array ('image/*');
           $image->Process('../../uploads/');
         }
         $x = explode("/", $_POST['isset_banner']);
         $y = explode('.', $x[1]);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
         rmdir('dnmdizini');
       }else{
         $vtpath = $_POST['isset_banner'];
       }
     // Edit Sql
     $editData=$db->prepare("UPDATE posts SET
       banner=:banner,
       title=:title,
       content=:content,
       seo_url=:seo_url,
       seo_title=:seo_title,
       seo_keywords=:seo_keywords,
       seo_description=:seo_description,
       status=:status,
       order_sort=:order_sort
       WHERE post_id={$_POST['post_id']}");
     $update=$editData->execute(array(
       'banner'          => $vtpath,
       'title'           => $_POST['title'],
       'content'         => $_POST['content'],
       'seo_url'         => $seoUrl,
       'seo_title'       => $_POST['seo_title'],
       'seo_keywords'    => $_POST['seo_keywords'],
       'seo_description' => $_POST['seo_description'],
       'status'          => $status,
       'order_sort'      => $order_sort
     ));
     if($update){
       if ($_FILES['banner']['size'] > 0){
         $x = explode("/", $_POST['banner']);
         mkdir('dnmdizini', 7777);
         unlink("../../uploads/". $x[1]);
         rmdir('dnmdizini');
       }
       Header("Location:../GalleryList?status=success");
     }else{
       Header("Location:../GalleryList?status=error");
     }
   }

   // ===================================== //
   // ========= Menu Operation ============ //
   // ===================================== //
   if (isset($_POST['menuUpdate'])) {
     // newtab kontrol
     if (empty($_POST["new_tab"])) {
       $new_tab = 0;
     }else{
       $new_tab = 1;
     }
     // footer_menu kontrol
     if (empty($_POST["footer_menu"])) {
       $footer_menu = 0;
     }else{
       $footer_menu = 1;
     }
     // status control
     if (empty($_POST["status"])) {
       $status = 0;
     }else{
       $status = 1;
     }
     // order_sort control
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Edit Database
     $editData=$db->prepare("UPDATE menu SET
       menu_top_id=:menu_top_id,
       title=:title,
       ready_link=:ready_link,
       link=:link,
       new_tab=:new_tab,
       footer_menu=:footer_menu,
       status=:status,
       order_sort=:order_sort
     WHERE menu_id={$_POST['menu_id']}");
     $update=$editData->execute(array(
       'menu_top_id'   => $_POST['menu_top_id'],
       'title'         => $_POST['title'],
       'ready_link'    => $_POST['ready_link'],
       'link'          => $_POST['link'],
       'new_tab'       => $new_tab,
       'footer_menu'   => $footer_menu,
       'status'        => $status,
       'order_sort'    => $order_sort
     ));
     if($update){
       Header("Location:../menuList?status=success");
     }else{
       Header("Location:../menuList?status=error");
     }
   }

   // ===================================== //
   // ========= Skills Operation ========== //
   // ===================================== //
   if (isset($_POST['skillUpdate'])) {
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     if (empty($_POST['count'])) {
       $count = 0;
     }else {
       $count = $_POST['count'];
     }
     // Add Database
     $editData=$db->prepare("UPDATE skills SET
       title=:title,
       count=:count,
       status=:status,
       order_sort=:order_sort
     WHERE skill_id={$_POST['skill_id']}");
     $update=$editData->execute(array(
       'title'          => $_POST["title"],
       'count'          => $count,
       'status'         => $status,
       'order_sort'     => $order_sort
     ));
     if($update){
       Header("Location:../skillList?status=success");
     }else{
       Header("Location:../skillList?status=error");
     }
   }

   // ===================================== //
   // ======== Proccess Operation ========= //
   // ===================================== //
   if (isset($_POST['proccessEdit'])) {
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     if ($_FILES['banner']['size'] > 0) {
       // Image Upload
       $image = new Upload($_FILES['banner']);
       $uploads_dir = '../../uploads';
       @$name = $_FILES['banner']['name'];
       $extension = uzanti($name);
       $uniqnumber1 = rand(20000,32000);
       $uniqnumber2 = rand(20000,32000);
       $uniqname = $uniqnumber1.$uniqnumber2;
       $imagepath ='proccess_banner_'.$uniqname;
       $vtpath = substr($uploads_dir, 6)."/".$imagepath.".".$extension;
       if($image->uploaded){
         $image->file_new_name_body = $imagepath;
         $image->allowed = array ('image/*');
         $image->Process('../../uploads/');
       }
     }else{
       $vtpath = "";
     }
     $editData=$db->prepare("UPDATE posts SET
       banner=:banner,
       title=:title,
       content=:content,
       status=:status,
       order_sort=:order_sort
       WHERE post_id={$_POST['post_id']}");
     $update=$editData->execute(array(
       'banner'          => $vtpath,
       'title'           => $_POST['title'],
       'content'         => $_POST['content'],
       'status'          => $status,
       'order_sort'      => $order_sort
     ));
     if($update){
       Header("Location:../proccessList?status=success");
     }else{
       Header("Location:../proccessList?status=error");
     }
   }

   // ===================================== //
   // ========= MODULES Operation ========= //
   // ===================================== //
   if (isset($_POST['modulUpdate'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $order_sort;
     if (empty($_POST["order_sort"])) {
       $order_sort = 0;
     }else{
       $order_sort = $_POST["order_sort"];
     }
     // Add Database
     $editData=$db->prepare("UPDATE modules SET
       order_sort=:order_sort,
       status=:status
     WHERE module_id={$_POST['module_id']}");
     $update=$editData->execute(array(
       'order_sort'     => $order_sort,
       'status'         => $status
     ));
     if($update){
       Header("Location:../modules?status=success");
     }else{
       Header("Location:../modules?status=error");
     }
   }
   // ===================================== //
   // ========= Catalog Operation ========= //
   // ===================================== //
   if (isset($_POST['offerUpdate'])) {
     $status;
     if (empty($_POST['status'])) {
       $status = 0;
     }else {
       $status = 1;
     }
     $editData=$db->prepare("UPDATE offer SET
       status=:status
     WHERE offer_id={$_POST['offer_id']}");
     $update=$editData->execute(array(
       'status'       => $status
     ));
     if($update){
       Header("Location:../offerList?status=success");
     }else{
       Header("Location:../offerList?status=error");
     }
   }
   // ===================================== //
   // ========= User Operation ============ //
   // ===================================== //
   if (isset($_GET['usersDelete']) == "success") {
     opControl();
     $deleteData=$db->prepare("DELETE from user where user_id=:user_id");
     $control=$deleteData->execute(array(
       'user_id' => $_GET['user_id']
     ));
     if ($control) {
       $x = explode("/", $_GET['image']);
       mkdir('dnmdizini', 7777);
       unlink("../../uploads/". $x[1]);
       rmdir('dnmdizini');
       Header("Location:../usersList?status=success");
     }else{
       Header("Location:../usersList?status=error");
     }
   }

  // ===================================== //
  // ========= Bank Operation ============ //
  // ===================================== //
  if (isset($_GET['banksDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from banks where bank_id=:bank_id");
    $control=$deleteData->execute(array(
      'bank_id' => $_GET['bank_id']
    ));
    if ($control) {
      Header("Location:../banksList?status=success");
    }else{
      Header("Location:../banksList?status=error");
    }
  }

  // ===================================== //
  // ===== Branch Dealer Operation ======= //
  // ===================================== //
  if (isset($_GET['branchDealerDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from branchdealer where bd_id=:bd_id");
    $control=$deleteData->execute(array(
      'bd_id' => $_GET['bd_id']
    ));
    if ($control) {
      Header("Location:../branchDealerList?status=success");
    }else{
      Header("Location:../branchDealerList?status=error");
    }
  }

  // ===================================== //
  // ========= Catalog Operation ========= //
  // ===================================== //
  if (isset($_GET['catalogDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from catalog where catalog_id=:catalog_id");
    $control=$deleteData->execute(array(
      'catalog_id' => $_GET['catalog_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['link']);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      rmdir('dnmdizini');
      $x = explode("/", $_GET['image']);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      rmdir('dnmdizini');
      Header("Location:../catalogList?status=success");
    }else{
      Header("Location:../catalogList?status=error");
    }
  }

  // ===================================== //
  // ========= Counter Operation ========= //
  // ===================================== //
  if (isset($_GET['counterDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from counter where counter_id=:counter_id");
    $control=$deleteData->execute(array(
      'counter_id' => $_GET['counter_id']
    ));
    if ($control) {
      Header("Location:../counterList?status=success");
    }else{
      Header("Location:../counterList?status=error");
    }
  }

  // ===================================== //
  // ==== Customer Comments Operation ==== //
  // ===================================== //
  if (isset($_GET['customerCommentDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from comments where comment_id=:comment_id");
    $control=$deleteData->execute(array(
      'comment_id' => $_GET['comment_id']
    ));
    if ($control) {
      Header("Location:../customerCommentList?status=success");
    }else{
      Header("Location:../customerCommentList?status=error");
    }
  }

  // ===================================== //
  // ========= Document Operation ======== //
  // ===================================== //
  if (isset($_GET['documentDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from document where document_id=:document_id");
    $control=$deleteData->execute(array(
      'document_id' => $_GET['document_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['image']);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      rmdir('dnmdizini');
      Header("Location:../documentList?status=success");
    }else{
      Header("Location:../documentList?status=error");
    }
  }

  // ===================================== //
  // ========= Faqs Operation ============ //
  // ===================================== //
  if (isset($_GET['faqsDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from posts where post_id=:post_id");
    $control=$deleteData->execute(array(
      'post_id' => $_GET['post_id']
    ));
    if ($control) {
      Header("Location:../faqsList?status=success");
    }else{
      Header("Location:../faqsList?status=error");
    }
  }

  // ===================================== //
  // ========= Language Operation ======== //
  // ===================================== //
  if (isset($_GET['langDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from language where language_id=:language_id");
    $control=$deleteData->execute(array(
      'language_id' => $_GET['language_id']
    ));
    if ($control) {
      mkdir('dnmdizini', 7777);
      unlink("../lang/". $_GET['country_code'] .".php");
      rmdir('dnmdizini');
      Header("Location:../languageList?status=success");
    }else{
      Header("Location:../languageList?status=error");
    }
  }

  // ===================================== //
  // ========= Notice Operation ========== //
  // ===================================== //
  if (isset($_GET['noticesDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from posts where post_id=:post_id");
    $control=$deleteData->execute(array(
      'post_id' => $_GET['post_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      $y = explode('.', $x[1]);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
      rmdir('dnmdizini');
      Header("Location:../noticesList?status=success");
    }else{
      Header("Location:../noticesList?status=error");
    }
  }

  // ===================================== //
  // ========= Pages Operation =========== //
  // ===================================== //
  if (isset($_GET['pagesDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from posts where post_id=:post_id");
    $control=$deleteData->execute(array(
      'post_id' => $_GET['post_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      $y = explode('.', $x[1]);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
      rmdir('dnmdizini');
      Header("Location:../pagesList?status=success");
    }else{
      Header("Location:../pagesList?status=error");
    }
  }

  // ===================================== //
  // ========= Person Operation ========== //
  // ===================================== //
  if (isset($_GET['personSocialDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from person_social where social_id=:social_id");
    $control=$deleteData->execute(array(
      'social_id' => $_GET['social_id']
    ));
    if ($control) {
      Header("Location:../personSocialList?status=success");
    }else{
      Header("Location:../personSocialList?status=error");
    }
  }
  if (isset($_GET['personDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from person where person_id=:person_id");
    $control=$deleteData->execute(array(
      'person_id' => $_GET['person_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      rmdir('dnmdizini');
      Header("Location:../personList?status=success");
    }else{
      Header("Location:../personList?status=error");
    }
  }

  // ===================================== //
  // ========= Reference Operation ======= //
  // ===================================== //
  if (isset($_GET['referenceDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from reference where reference_id=:reference_id");
    $control=$deleteData->execute(array(
      'reference_id' => $_GET['reference_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      $y = explode('.', $x[1]);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      unlink("../uploads/".$y[0].'-200x100'.'.'.$y[1]);
      rmdir('dnmdizini');
      Header("Location:../referenceList?status=success");
    }else{
      Header("Location:../referenceList?status=error");
    }
  }

  // ===================================== //
  // ========= Services Operation ======== //
  // ===================================== //
  if (isset($_GET['servicesDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from posts where post_id=:post_id");
    $control=$deleteData->execute(array(
      'post_id' => $_GET['post_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      $y = explode('.', $x[1]);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      unlink("../uploads/".$y[0].'-500x333'.'.'.$y[1]);
      rmdir('dnmdizini');
      Header("Location:../servicesList?status=success");
    }else{
      Header("Location:../servicesList?status=error");
    }
  }

  // ===================================== //
  // ========= Slider Operation ========= //
  // ===================================== //
  if (isset($_GET['sliderDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from slider where slider_id=:slider_id");
    $control=$deleteData->execute(array(
      'slider_id' => $_GET['slider_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      rmdir('dnmdizini');
      Header("Location:../sliderList?status=success");
    }else{
      Header("Location:../sliderList?status=error");
    }
  }

  // ===================================== //
  // ========= Social Operation ========== //
  // ===================================== //
  if (isset($_GET['socialDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from social where social_id=:social_id");
    $control=$deleteData->execute(array(
      'social_id' => $_GET['social_id']
    ));
    if ($control) {
      Header("Location:../socialList?status=success");
    }else{
      Header("Location:../socialList?status=error");
    }
  }

  // ===================================== //
  // == Reference Categories Operation === //
  // ===================================== //
  if (isset($_GET['referenceCategoriesDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from categories where categories_id=:categories_id");
    $control=$deleteData->execute(array(
      'categories_id' => $_GET['categories_id']
    ));
    if ($control) {
      Header("Location:../referenceCategoriesList?status=success");
    }else{
      Header("Location:../referenceCategoriesList?status=error");
    }
  }

  // ===================================== //
  // ==== Project Categories Operation === //
  // ===================================== //
  if (isset($_GET['projectCategoriesDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from categories where categories_id=:categories_id");
    $control=$deleteData->execute(array(
      'categories_id' => $_GET['categories_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      $y = explode('.', $x[1]);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
      rmdir('dnmdizini');
      Header("Location:../projectCategoriesList?status=success");
    }else{
      Header("Location:../projectCategoriesList?status=error");
    }
  }

  // ===================================== //
  // ==== Post Categories Operation ====== //
  // ===================================== //
  if (isset($_GET['postCategoriesDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from categories where categories_id=:categories_id");
    $control=$deleteData->execute(array(
      'categories_id' => $_GET['categories_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      $y = explode('.', $x[1]);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
      rmdir('dnmdizini');
      Header("Location:../postCategoriesList?status=success");
    }else{
      Header("Location:../postCategoriesList?status=error");
    }
  }

  // ===================================== //
  // ===== Packet Categories Operation === //
  // ===================================== //
  if (isset($_GET['packetCategoriesDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from categories where categories_id=:categories_id");
    $control=$deleteData->execute(array(
      'categories_id' => $_GET['categories_id']
    ));
    if ($control) {
      Header("Location:../packetCategoriesList?status=success");
    }else{
      Header("Location:../packetCategoriesList?status=error");
    }
  }

  // ===================================== //
  // ==== Product Categories Operation === //
  // ===================================== //
  if (isset($_GET['productCategoriesDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from categories where categories_id=:categories_id");
    $control=$deleteData->execute(array(
      'categories_id' => $_GET['categories_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      $y = explode('.', $x[1]);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
      rmdir('dnmdizini');
      Header("Location:../productCategoriesList?status=success");
    }else{
      Header("Location:../productCategoriesList?status=error");
    }
  }


  // ===================================== //
  // ========= Project Operation ========= //
  // ===================================== //
  if (isset($_GET['projectDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from posts where post_id=:post_id");
    $control=$deleteData->execute(array(
      'post_id' => $_GET['post_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      $y = explode('.', $x[1]);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      unlink("../uploads/".$y[0].'-500x333'.'.'.$y[1]);
      rmdir('dnmdizini');
      $projectDetailDelete=$db->prepare("DELETE from projects where project_post_id=:project_post_id");
      $detailControl=$projectDetailDelete->execute(array(
        'project_post_id' => $_GET['post_id']
      ));
      if ($detailControl) {
        Header("Location:../projectList?status=success");
      }else{
        Header("Location:../projectList?status=error");
      }
    }else{
      Header("Location:../projectList?status=error");
    }
  }

  // ===================================== //
  // ========= Post Operation ============ //
  // ===================================== //
  if (isset($_GET['postDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from posts where post_id=:post_id");
    $control=$deleteData->execute(array(
      'post_id' => $_GET['post_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      $y = explode('.', $x[1]);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      unlink("../uploads/".$y[0].'-500x333'.'.'.$y[1]);
      rmdir('dnmdizini');
      Header("Location:../postList?status=success");
    }else{
      Header("Location:../postList?status=error");
    }
  }

  // ===================================== //
  // ===== Packet Features Operation ===== //
  // ===================================== //
  if (isset($_GET['packetFeatureDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from packet_features where feature_id=:feature_id");
    $control=$deleteData->execute(array(
      'feature_id' => $_GET['feature_id']
    ));
    if ($control) {
      Header("Location:../packetFeaturesList?status=success");
    }else{
      Header("Location:../packetFeaturesList?status=error");
    }
  }

  // ===================================== //
  // ========= Packets Operation ========= //
  // ===================================== //
  if (isset($_GET['packetDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from packets where packet_id=:packet_id");
    $control=$deleteData->execute(array(
      'packet_id' => $_GET['packet_id']
    ));
    if ($control) {
      Header("Location:../packetList?status=success");
    }else{
      Header("Location:../packetList?status=error");
    }
  }
  if (isset($_GET['packetOrderDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from orders where order_id=:order_id");
    $control=$deleteData->execute(array(
      'order_id' => $_GET['order_id']
    ));
    if ($control) {
      Header("Location:../productOrderList?status=success");
    }else{
      Header("Location:../productOrderList?status=error");
    }
  }
  // ===================================== //
  // ========= Product Operation ========= //
  // ===================================== //
  if (isset($_GET['productDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from posts where post_id=:post_id");
    $control=$deleteData->execute(array(
      'post_id' => $_GET['post_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      $y = explode('.', $x[1]);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
      rmdir('dnmdizini');
      $projectDetailDelete=$db->prepare("DELETE from products where product_post_id=:product_post_id");
      $detailControl=$projectDetailDelete->execute(array(
        'product_post_id' => $_GET['post_id']
      ));
      if ($detailControl) {
        Header("Location:../productList?status=success");
      }else{
        Header("Location:../productList?status=error");
      }
    }else{
      Header("Location:../productList?status=error");
    }
  }
  if (isset($_GET['productOrderDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from orders where order_id=:order_id");
    $control=$deleteData->execute(array(
      'order_id' => $_GET['order_id']
    ));
    if ($control) {
      Header("Location:../packetOrderList?status=success");
    }else{
      Header("Location:../packetOrderList?status=error");
    }
  }
  // ===================================== //
  // ======== iGallery Operation ========= //
  // ===================================== //
  if (isset($_GET['GalleryDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from posts where post_id=:post_id");
    $control=$deleteData->execute(array(
      'post_id' => $_GET['post_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      $y = explode('.', $x[1]);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      unlink("../uploads/".$y[0].'-270x300'.'.'.$y[1]);
      rmdir('dnmdizini');
      Header("Location:../GalleryList?status=success");
    }else{
      Header("Location:../GalleryList?status=error");
    }
  }

  // ===================================== //
  // ========= Menu Operation ============ //
  // ===================================== //
  if (isset($_GET['menuDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from menu where menu_id=:menu_id");
    $control=$deleteData->execute(array(
      'menu_id' => $_GET['menu_id']
    ));
    if ($control) {
      Header("Location:../menuList?status=success");
    }else{
      Header("Location:../menuList?status=error");
    }
  }

  // ===================================== //
  // ========= Skills Operation ========== //
  // ===================================== //
  if (isset($_GET['skillDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from skills where skill_id=:skill_id");
    $control=$deleteData->execute(array(
      'skill_id' => $_GET['skill_id']
    ));
    if ($control) {
      Header("Location:../skillList?status=success");
    }else{
      Header("Location:../skillList?status=error");
    }
  }

  // ===================================== //
  // ========= User Operation ============ //
  // ===================================== //
  if (isset($_GET['proccessDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from posts where post_id=:post_id");
    $control=$deleteData->execute(array(
      'post_id' => $_GET['post_id']
    ));
    if ($control) {
      $x = explode("/", $_GET['banner']);
      mkdir('dnmdizini', 7777);
      unlink("../../uploads/". $x[1]);
      rmdir('dnmdizini');
      Header("Location:../proccessList?status=success");
    }else{
      Header("Location:../proccessList?status=error");
    }
  }

  // ===================================== //
  // ========= Faqs Operation ============ //
  // ===================================== //
  if (isset($_GET['mailBoxDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from contact_log where log_id=:log_id");
    $control=$deleteData->execute(array(
      'log_id' => $_GET['log_id']
    ));
    if ($control) {
      Header("Location:../mailBoxs?status=success");
    }else{
      Header("Location:../mailBoxs?status=error");
    }
  }
  // ===================================== //
  // ========= Faqs Operation ============ //
  // ===================================== //
  if (isset($_GET['offerDelete']) == "success") {
    opControl();
    $deleteData=$db->prepare("DELETE from offer where offer_id=:offer_id");
    $control=$deleteData->execute(array(
      'offer_id' => $_GET['offer_id']
    ));
    if ($control) {
      Header("Location:../offerList?status=success");
    }else{
      Header("Location:../offerList?status=error");
    }
  }
  }
?>
