<?php
   // ===================================== //
   // ========= 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");
    }
  }
?>
