<?php
if ($_GET) {
	include("inc/vt.php"); 

	$id = $_GET['id'];
	$islem = $_GET['islem'];


	switch ($islem) {
		case 'iletisim-sil': 
		$iletisim_sil = $dbh->prepare("DELETE FROM contact WHERE id = ?");
		$iletisim_sil->execute([$id]);
		if ($iletisim_sil) {
			header("location:iletisim-liste.php");
		} 
		break;

		case 'slider-sil': 
		$slider_sil = $dbh->prepare("DELETE FROM home_banner WHERE id = ?");
		$slider_sil->execute([$id]);
		if ($slider_sil) {
			header("location:slider-liste.php");
		} 
		break;

		case 'haber-sil': 
		$haber_sil = $dbh->prepare("DELETE FROM news WHERE id = ?");
		$haber_sil->execute([$id]);
		if ($haber_sil) {
			header("location:duyuru-liste.php");
		} 
		break;

		case 'garson-sil': 
		$garson_sil = $dbh->prepare("DELETE FROM waiter WHERE id = ?");
		$garson_sil->execute([$id]);
		if ($garson_sil) {
			header("location:garson-liste.php");
		} 
		break;

		case 'hesap-sil': 
		$hesap_sil = $dbh->prepare("DELETE FROM account WHERE id = ?");
		$hesap_sil->execute([$id]);
		if ($hesap_sil) {
			header("location:hesap-liste.php");
		} 
		break;

		case 'musteri-sil': 
		$musteri_sil = $dbh->prepare("DELETE FROM users WHERE id = ?");
		$musteri_sil->execute([$id]);
		if ($musteri_sil) {
			header("location:musteri-liste.php");
		} 
		break;

		case 'yonetici-sil': 
		$yonetici_sil = $dbh->prepare("DELETE FROM admin WHERE id = ?");
		$yonetici_sil->execute([$id]);
		if ($yonetici_sil) {
			header("location:yonetici-liste.php");
		} 
		break;


		case 'siparis-sil': 
		$siparis_sil = $dbh->prepare("DELETE FROM product_orders WHERE siparis_id = ?");
		$siparis_sil->execute([$id]);
		if ($siparis_sil) {
			header("location:siparis-liste.php");
		} 
		break;
		case 'alerji-sil': 
		$alerji_sil = $dbh->prepare("DELETE FROM allergy WHERE id = ?");
		$alerji_sil->execute([$id]);
		if ($alerji_sil) {
			header("location:alerji-liste.php");
		} 
		break;

		case 'banka-sil': 
		$banka_sil = $dbh->prepare("DELETE FROM bank WHERE id = ?");
		$banka_sil->execute([$id]);
		if ($banka_sil) {
			header("location:banka-liste.php");
		} 
		break;

		case 'pgaleri-sil': 
		$pgaleri_sil = $dbh->prepare("DELETE FROM project_gallery WHERE id = ?");
		$pgaleri_sil->execute([$id]);
		if ($pgaleri_sil) {
			header("location:proje-liste.php");
		} 
		break;

		case 'proje-kategori-sil': 
		$proje_kategori_sil = $dbh->prepare("DELETE FROM project_categories WHERE id = ?");
		$proje_kategori_sil->execute([$id]);
		if ($proje_kategori_sil) {
			header("location:proje-kategori-liste.php");
		} 
		break;

		case 'proje-sil': 
		$project_sil = $dbh->prepare("DELETE FROM project WHERE id = ?");
		$project_sil->execute([$id]);
		if ($project_sil) {
			header("location:proje-liste.php");
		} 
		break;

		case 'urun-sil': 
		$urun_sil = $dbh->prepare("DELETE FROM product WHERE id = ?");
		$urun_sil->execute([$id]);
		if ($urun_sil) {
			header("location:urun-liste.php");
		} 
		break;

		case 'kupon-sil': 
		$kupon_sil = $dbh->prepare("DELETE FROM coupon WHERE id = ?");
		$kupon_sil->execute([$id]);
		if ($kupon_sil) {
			header("location:kupon-liste.php");
		} 
		break;

		case 'masa-sil': 
		$masa_sil = $dbh->prepare("DELETE FROM masa_no WHERE id = ?");
		$masa_sil->execute([$id]);
		if ($masa_sil) {
			header("location:masa-liste.php");
		} 
		break;

		case 'ugaleri-sil': 
		$ugaleri_sil = $dbh->prepare("DELETE FROM product_gallery WHERE id = ?");
		$ugaleri_sil->execute([$id]);
		if ($ugaleri_sil) {
			header("location:urun-liste.php");
		} 
		break;

		case 'urun-kategori-sil': 
		$urun_kategori_sil = $dbh->prepare("DELETE FROM product_categories WHERE id = ?");
		$urun_kategori_sil->execute([$id]);
		if ($urun_kategori_sil) {
			header("location:urun-kategori-liste.php");
		} 
		break;

		case 'hizmet-sil': 
		$hizmet_sil = $dbh->prepare("DELETE FROM services WHERE id = ?");
		$hizmet_sil->execute([$id]);
		if ($hizmet_sil) {
			header("location:hizmet-liste.php");
		} 
		break;

		case 'hgaleri-sil': 
		$hgaleri_sil = $dbh->prepare("DELETE FROM services_gallery WHERE id = ?");
		$hgaleri_sil->execute([$id]);
		if ($hgaleri_sil) {
			header("location:hizmet-liste.php");
		} 
		break;

		case 'galeri-sil': 
		$galeri_sil = $dbh->prepare("DELETE FROM gallery WHERE id = ?");
		$galeri_sil->execute([$id]);
		if ($galeri_sil) {
			header("location:galeri.php");
		} 
		break;

		case 'ziyaretci-sil': 
		$ziyaretci_sil = $dbh->prepare("DELETE FROM visitor_tracking ");
		$ziyaretci_sil->execute([$id]);
		if ($ziyaretci_sil) {
			header("location:ziyaretci-log.php");
		} 
		break;

		case 'garson-tsil': 
		$garson_tsil = $dbh->prepare("DELETE FROM waiter ");
		$garson_tsil->execute([$id]);
		if ($garson_tsil) {
			header("location:garson-liste.php");
		} 
		break;

		case 'iletisim-tsil': 
		$iletisim_tsil = $dbh->prepare("DELETE FROM contact ");
		$iletisim_tsil->execute([$id]);
		if ($iletisim_tsil) {
			header("location:iletisim-liste.php");
		} 
		break;

		case 'hesap-tsil': 
		$hesap_tsil = $dbh->prepare("DELETE FROM account ");
		$hesap_tsil->execute([$id]);
		if ($hesap_tsil) {
			header("location:hesap-liste.php");
		} 
		break;

		case "iletisim-onay":
		$iletisim_onay = $dbh -> prepare("UPDATE contact SET checking = ? WHERE id = ?");
		$iletisim_onay->execute([1, $id]);
		if ($iletisim_onay) {
			header("location:iletisim-liste.php");
		}
		break;

		case "garson-onay":
		$garson_onay = $dbh -> prepare("UPDATE waiter SET checking = ? WHERE id = ?");
		$garson_onay->execute([1, $id]);
		if ($garson_onay) {
			header("location:garson-liste.php");
		}
		break;

		case "hesap-onay":
		$hesap_onay = $dbh -> prepare("UPDATE account SET checking = ? WHERE id = ?");
		$hesap_onay->execute([1, $id]);
		if ($hesap_onay) {
			header("location:hesap-liste.php");
		}
		break;

		case "secenk-onay":
		$secenk_onay = $dbh -> prepare("UPDATE selectable SET status = ? WHERE id = ?");
		$secenk_onay->execute([2, $id]);
		if ($secenk_onay) {
			header("location:secenek-liste.php");
		}
		break;

		case "eksecenek-sil":
		$eksecenek_onay = $dbh -> prepare("UPDATE product_portion SET status = ? WHERE id = ?");
		$eksecenek_onay->execute([2, $id]);
		if ($eksecenek_onay) {
			header("location:porsiyon-liste.php");
		}
		break;



		case "ik-onay":
		$ik_onay = $dbh -> prepare("UPDATE ik SET checking = ? WHERE id = ?");
		$ik_onay->execute([1, $id]);
		if ($ik_onay) {
			header("location:ik-liste.php");
		}
		break;

		case 'ik-sil': 
		$ik_sil = $dbh->prepare("DELETE FROM ik ");
		$ik_sil->execute([$id]);
		if ($ik_sil) {
			header("location:ik-liste.php");
		} 
		break;

		case "fiyat-onay":
		$fiyat_onay = $dbh -> prepare("UPDATE price_offer SET checking = ? WHERE id = ?");
		$fiyat_onay->execute([1, $id]);
		if ($fiyat_onay) {
			header("location:fiyat-liste.php");
		}
		break;

		case 'fiyat-sil': 
		$fiyat_sil = $dbh->prepare("DELETE FROM price_offer ");
		$fiyat_sil->execute([$id]);
		if ($fiyat_sil) {
			header("location:fiyat-liste.php");
		} 
		break;

		case 'instagram-sil': 
		$instagram_sil = $dbh->prepare("DELETE FROM urunler_insta WHERE id = ?");
		$instagram_sil->execute([$id]);
		if ($instagram_sil) {
			header("location:instagram-liste.php");
		} 
		break;


		case 'mahalle-sil': 
		$adres_sil = $dbh->prepare("DELETE FROM mahalle WHERE mahalle_key = ?");
		$adres_sil->execute([$id]);
		if ($adres_sil) {
			header("location:adres-yonetimi.php");
		} 
		break;

		case "yapiliyor":
		$guncelle = $dbh -> prepare("UPDATE product_orders SET durum = ? WHERE siparis_id = ?");
		$guncelle->execute([1, $id]);
		if ($guncelle) {
			header("location:siparis-liste.php");
		}
		break;

		case "tamamlandi":
		$guncelle = $dbh -> prepare("UPDATE product_orders SET durum = ? WHERE siparis_id = ?");
		$guncelle->execute([2, $id]);
		if ($guncelle) {
			header("location:siparis-liste.php");
		}
		break;

		case "odendi":
		$guncelle = $dbh -> prepare("UPDATE product_orders SET odeme_durum = ? WHERE siparis_id = ?");
		$guncelle->execute([1, $id]);
		if ($guncelle) {
			header("location:siparis-liste.php");
		}
		break;

		case "odenmedi":
		$guncelle = $dbh -> prepare("UPDATE product_orders SET odeme_durum = ? WHERE siparis_id = ?");
		$guncelle->execute([0, $id]);
		if ($guncelle) {
			header("location:siparis-liste.php");
		}
		break;

		case "iptal-edildi":
		$guncelle = $dbh -> prepare("UPDATE product_orders SET durum = ? ,dk=' '  WHERE siparis_id = ?");
		$guncelle->execute([3, $id]);
		if ($guncelle) {
			header("location:siparis-liste.php");
		}
		break;

		case "teslimatta":
		$guncelle = $dbh -> prepare("UPDATE product_orders SET durum = ? WHERE siparis_id = ?");
		$guncelle->execute([4, $id]);
		if ($guncelle) {
			header("location:siparis-liste.php");
		}
		break;

		case "adres-duzenle":
		$guncelle = $dbh -> prepare("UPDATE mahalle SET mahalle_title = ?,tutar=?,aktif=? WHERE mahalle_key = ?");
		$guncelle->execute([$_POST['adres'],$_POST['fiyat'],$_POST['durum'], $id]);
		if ($guncelle) {
			header("location:adres-yonetimi.php");
		}
		break;

	}
}

?>