<?php


ob_start();
session_start();
require_once "baglan.php";
require_once "fonk.php";
require "class.phpmailer.php";

if (isset($_POST["giris"])) {
    $token = md5(uniqid(rand()));
    $kullanici = $_POST["kullanici"];
    $sifre = $_POST["sifre"];
    $hatirla = $_POST["hatirla"];
    $giriskontrol = $db->prepare("SELECT * FROM yonetici WHERE kadi = ? AND sifre = ?");
    $giriskontrol->execute([$kullanici, $sifre]);
    if ($giriskontrol->rowCount()) {
        $Durum = $giriskontrol->fetch(PDO::FETCH_ASSOC);
        if ($Durum) {
            $son_giris = date("Y-m-d H:i:s");
            $son_giris = tarih($son_giris);
            $yonetici_id_sabit = $Durum["id"];
            $sorgu = $db->prepare("UPDATE yonetici SET\r\n\t\t\t\tson_giris = ?\r\n\t\t\t\tWHERE id = ?");
            $guncelle = $sorgu->execute([$son_giris, $yonetici_id_sabit]);
            $_SESSION["yonetici_ad_soyad"] = $Durum["isim"];
            $_SESSION["yonetici_kullanici"] = $Durum["kadi"];
            $_SESSION["yonetici_sifre"] = $Durum["sifre"];
            $_SESSION["rutbe"] = $Durum["rutbe"];
            $_SESSION["yonetici_id"] = $yonetici_id_sabit;
            $_SESSION["token"] = $token;
            if ($hatirla == "on") {
                setcookie("yonetici_ad_soyad", $_SESSION["yonetici_ad_soyad"], time() + 86400);
                setcookie("yonetici_kullanici", $_SESSION["yonetici_kullanici"], time() + 86400);
                setcookie("yonetici_sifre", $_SESSION["yonetici_sifre"], time() + 86400);
                setcookie("rutbe", $_SESSION["rutbe"], time() + 86400);
                setcookie("yonetici_id", $_SESSION["yonetici_id"], time() + 86400);
                setcookie("token", $_SESSION["token"], time() + 86400);
            }
            $_SESSION["giris"] = "yes";
            header("Location:../panel/index.html");
        } else {
            $_SESSION["giris"] = "kullanici";
            header("Location:../panel/index.html");
        }
    } else {
        $_SESSION["giris"] = "kullanici";
        header("Location:../panel/index.html");
    }
}
if (isset($_POST["sifirla"])) {
    $email = $_POST["email"];
    $varmi = $db->prepare("SELECT * FROM yonetici WHERE email = ?");
    $varmi->execute([$email]);
    if ($varmi->rowCount()) {
        $YSonuc = $varmi->fetch(PDO::FETCH_ASSOC);
        if ($YSonuc["rutbe"] == 0) {
            $isim = $YSonuc["isim"];
            $kullanici = $YSonuc["kadi"];
            $parola = $YSonuc["sifre"];
            $konu = "Yönetim Paneli Şifre Hatırlatma";
            $mesajj = "\r\n\t\t\t<div>\t\t\t\t\r\n\t\t\t\t<p>\r\n\t\t\t\tSayın " . $isim . ",</br>\t\t\t\r\n\t\t\t\tSisteme giriş bilgileriniz.</br>\t\t\t\r\n\t\t\t\t<strong>Kullanıcı Adı:</strong> " . $kullanici . "</br>\t\t\t\r\n\t\t\t\t<strong>Parola:</strong> " . $parola . "\r\n\t\t\t\t</p>\t\t\r\n\t\t\t</div>";
            mailgonder($email, "" . $isim . " Yönetim Paneli Şifre Hatırlatma", $mesajj);
            $_SESSION["sifirla"] = "yes";
            header("Location:../panel/index.html");
        } else {
            $_SESSION["demohesap"] = "no";
            header("Location:../panel/sifre_hatirlat.php");
        }
    } else {
        $_SESSION["sifirla"] = "no";
        header("Location:../panel/sifre_hatirlat.php");
    }
}
if ($_GET["cikis"] == "ok") {
    islemkontrol();
    unset($_SESSION["yonetici_ad_soyad"]);
    unset($_SESSION["yonetici_kullanici"]);
    unset($_SESSION["yonetici_sifre"]);
    unset($_SESSION["rutbe"]);
    unset($_SESSION["yonetici_id"]);
    unset($_SESSION["token"]);
    header("Location:../panel/index.html");
}
if ($_GET["aracresimsil"] == "ok") {
    islemkontrol();
    $resimid = $_GET["sid"];
    if ($_SESSION["rutbe"] == 0) {
        $resim_bul = $db->query("SELECT * FROM araclar WHERE id = '" . $resimid . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../" . TEMA . "/uploads/araclar/" . $resim_bul["resim"]);
        unlink("../" . TEMA . "/uploads/araclar/kucuk/" . $resim_bul["resim"]);
        $sorgu = $db->prepare("UPDATE araclar SET\r\n\t\t\t\t\tresim\t= ?\r\n\t\t\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute(["", $resimid]);
        if ($guncelle) {
            $_SESSION["aracresimsil"] = "yes";
            header("Location:../panel/arac-duzenle/" . $_GET["sid"] . ".html");
        } else {
            $_SESSION["aracresimsil"] = "no";
            header("Location:../panel/arac-duzenle/" . $_GET["sid"] . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/arac-duzenle/" . $_GET["sid"] . ".html");
    }
}
if ($_GET["aracsil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $resim_bul = $db->query("SELECT * FROM araclar WHERE id = '" . $id . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../" . TEMA . "/uploads/araclar/" . $resim_bul["resim"]);
        unlink("../" . TEMA . "/uploads/araclar/kucuk/" . $resim_bul["resim"]);
        $Sorgu = $db->prepare("DELETE FROM araclar WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["aracsil"] = "yes";
                header("Location:../panel/araclar.html");
            } else {
                $_SESSION["aracsil"] = "no";
                header("Location:../panel/araclar.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/araclar.html");
    }
}
if (isset($_POST["arac_bilgileri_kaydet"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $kategori = $_POST["kategori"];
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        if ($_POST["anasayfa"]) {
            $anasayfa = 1;
        } else {
            $anasayfa = 0;
        }
        if ($_POST["kampanya"]) {
            $kampanya = 1;
        } else {
            $kampanya = 0;
        }
        if ($_POST["yeni"]) {
            $yeni = 1;
        } else {
            $yeni = 0;
        }
        $aciklama = $_POST["aciklama"];
        $bir_uc = $_POST["bir_uc"];
        $dort_yedi = $_POST["dort_yedi"];
        $sekiz_onbes = $_POST["sekiz_onbes"];
        $onalti_yirmibir = $_POST["onalti_yirmibir"];
        $yirmiiki_yirmisekiz = $_POST["yirmiiki_yirmisekiz"];
        $yirmidokuz_doksandokuz = $_POST["yirmidokuz_doksandokuz"];
        $bagaj = $_POST["bagaj"];
        $yakit = $_POST["yakit"];
        $vites = $_POST["vites"];
        $klima = $_POST["klima"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../" . TEMA . "/uploads/araclar");
            $upload->file_auto_rename = true;
            $upload->image_resize = true;
            $upload->image_ratio_crop = true;
            $upload->image_x = 360;
            $upload->image_y = 296;
            $upload->process("../" . TEMA . "/uploads/araclar/kucuk");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        $Resim = "" . $upload->file_dst_name . "";
        $sorgu = $db->prepare("INSERT INTO araclar SET\r\n\t\t\t\tadi \t= ?,\r\n\t\t\t\tkategori= ?,\r\n\t\t\t\tseo \t= ?,\r\n\t\t\t\taciklama= ?,\r\n\t\t\t\tdurum \t= ?,\r\n\t\t\t\tanasayfa= ?,\r\n\t\t\t\tkampanya= ?,\r\n\t\t\t\tyeni\t= ?,\r\n\t\t\t\tbir_uc \t= ?,\r\n\t\t\t\tdort_yedi \t= ?,\r\n\t\t\t\tsekiz_onbes \t= ?,\r\n\t\t\t\tonalti_yirmibir \t= ?,\r\n\t\t\t\tyirmiiki_yirmisekiz \t= ?,\r\n\t\t\t\tyirmidokuz_doksandokuz \t= ?,\r\n\t\t\t\tbagaj \t= ?,\r\n\t\t\t\tyakit \t= ?,\r\n\t\t\t\tvites \t= ?,\r\n\t\t\t\tklima \t= ?,\r\n\t\t\t\tresim \t= ?,\r\n\t\t\t\tdil \t= ?,\r\n\t\t\t\ttarih \t= ?");
        $Ekle = $sorgu->execute([$adi, $kategori, $seo, $aciklama, $durum, $anasayfa, $kampanya, $yeni, $bir_uc, $dort_yedi, $sekiz_onbes, $onalti_yirmibir, $yirmiiki_yirmisekiz, $yirmidokuz_doksandokuz, $bagaj, $yakit, $vites, $klima, $Resim, $_SESSION["admin_dil"], $tarih]);
        if ($Ekle) {
            $_SESSION["arac_bilgileri_kaydet"] = "yes";
            header("Location:../panel/araclar.html");
        } else {
            $_SESSION["arac_bilgileri_kaydet"] = "no";
            header("Location:../panel/arac-ekle.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/arac-ekle.html");
    }
}
if (isset($_POST["arac_bilgileri_guncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $kategori = $_POST["kategori"];
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        if ($_POST["anasayfa"]) {
            $anasayfa = 1;
        } else {
            $anasayfa = 0;
        }
        if ($_POST["kampanya"]) {
            $kampanya = 1;
        } else {
            $kampanya = 0;
        }
        if ($_POST["yeni"]) {
            $yeni = 1;
        } else {
            $yeni = 0;
        }
        $aciklama = $_POST["aciklama"];
        $bir_uc = $_POST["bir_uc"];
        $dort_yedi = $_POST["dort_yedi"];
        $sekiz_onbes = $_POST["sekiz_onbes"];
        $onalti_yirmibir = $_POST["onalti_yirmibir"];
        $yirmiiki_yirmisekiz = $_POST["yirmiiki_yirmisekiz"];
        $yirmidokuz_doksandokuz = $_POST["yirmidokuz_doksandokuz"];
        $bagaj = $_POST["bagaj"];
        $yakit = $_POST["yakit"];
        $vites = $_POST["vites"];
        $klima = $_POST["klima"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../" . TEMA . "/uploads/araclar");
            $upload->file_auto_rename = true;
            $upload->image_resize = true;
            $upload->image_ratio_crop = true;
            $upload->image_x = 360;
            $upload->image_y = 296;
            $upload->process("../" . TEMA . "/uploads/araclar/kucuk");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        if (isset($Resim)) {
            $resim_bul = $db->query("SELECT * FROM araclar WHERE id = '" . $d_id . "'")->fetch(PDO::FETCH_ASSOC);
            unlink("../" . TEMA . "/uploads/araclar/" . $resim_bul["resim"]);
            unlink("../" . TEMA . "/uploads/araclar/kucuk/" . $resim_bul["resim"]);
            $guncelle = $db->prepare("UPDATE araclar SET resim = ? WHERE id = ?");
            $guncelle->execute([$Resim, $d_id]);
            $Resim = "" . $upload->file_dst_name . "";
        }
        $sorgu = $db->prepare("UPDATE araclar SET\r\n\t\t\tadi \t= ?,\r\n\t\t\tkategori= ?,\r\n\t\t\tseo \t= ?,\r\n\t\t\taciklama= ?,\r\n\t\t\tdurum \t= ?,\r\n\t\t\tanasayfa= ?,\r\n\t\t\tkampanya= ?,\r\n\t\t\tyeni\t= ?,\r\n\t\t\tbir_uc \t= ?,\r\n\t\t\tdort_yedi \t= ?,\r\n\t\t\tsekiz_onbes \t= ?,\r\n\t\t\tonalti_yirmibir \t= ?,\r\n\t\t\tyirmiiki_yirmisekiz \t= ?,\r\n\t\t\tyirmidokuz_doksandokuz \t= ?,\r\n\t\t\tbagaj \t= ?,\r\n\t\t\tyakit \t= ?,\r\n\t\t\tvites \t= ?,\r\n\t\t\tklima \t= ?,\r\n\t\t\ttarih \t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$adi, $kategori, $seo, $aciklama, $durum, $anasayfa, $kampanya, $yeni, $bir_uc, $dort_yedi, $sekiz_onbes, $onalti_yirmibir, $yirmiiki_yirmisekiz, $yirmidokuz_doksandokuz, $bagaj, $yakit, $vites, $klima, $tarih, $d_id]);
        if ($guncelle) {
            $_SESSION["arac_bilgileri_guncelle"] = "yes";
            header("Location:../panel/arac-duzenle/" . $d_id . ".html");
        } else {
            $_SESSION["arac_bilgileri_guncelle"] = "no";
            header("Location:../panel/arac-duzenle/" . $d_id . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/arac-duzenle/" . $d_id . ".html");
    }
}
if (isset($_POST["SiteAyarGuncelle"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $site_title = $_POST["site_title"];
        $site_url = $_POST["site_url"];
        $site_keyw = $_POST["site_keyw"];
        $site_desc = $_POST["site_desc"];
        $firma_adi = $_POST["firma_adi"];
        $firma_telefon = $_POST["firma_telefon"];
        $firma_fax = $_POST["firma_fax"];
        $firma_email = $_POST["firma_email"];
        $firma_adres = $_POST["firma_adres"];
        $google_maps = $_POST["google_maps"];
        $google_maps_link = $_POST["google_maps_link"];
        $google_analytics = $_POST["google_analytics"];
        $facebook = $_POST["facebook"];
        $twitter = $_POST["twitter"];
        $gplus = $_POST["gplus"];
        $instagram = $_POST["instagram"];
        $copyright = $_POST["copyright"];
        $pbirim = $_POST["pbirim"];
        if ($_POST["site_durum"]) {
            $site_durum = 1;
        } else {
            $site_durum = 0;
        }
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../" . TEMA . "/uploads/logo");
            if ($upload->processed) {
                $firmalogo = "" . $upload->file_dst_name . "";
            }
        }
        $upload2 = new upload($_FILES["footer"]);
        if ($upload2->uploaded) {
            $upload2->file_auto_rename = true;
            $upload2->process("../" . TEMA . "/uploads/logo/footer");
            if ($upload2->processed) {
                $footerlogo = "" . $upload2->file_dst_name . "";
            }
        }
        $upload = new upload($_FILES["favicon"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../" . TEMA . "/uploads/favicon");
            if ($upload->processed) {
                $favicon = "" . $upload->file_dst_name . "";
            }
        }
        if (isset($firmalogo)) {
            $resim_bul = $db->query("SELECT * FROM ayarlar WHERE id = '1'")->fetch(PDO::FETCH_ASSOC);
            unlink("../" . TEMA . "/uploads/logo/" . $resim_bul["firma_logo"]);
            $guncelle = $db->prepare("UPDATE ayarlar SET firma_logo = ? WHERE id = ?");
            $guncelle->execute([$firmalogo, 1]);
            $firmalogo = "" . $upload->file_dst_name . "";
        }
        if (isset($footerlogo)) {
            $resim_bul = $db->query("SELECT * FROM ayarlar WHERE id = '1'")->fetch(PDO::FETCH_ASSOC);
            unlink("../" . TEMA . "/uploads/logo/footer/" . $resim_bul["firma_footerlogo"]);
            $guncelle = $db->prepare("UPDATE ayarlar SET firma_footerlogo = ? WHERE id = ?");
            $guncelle->execute([$footerlogo, 1]);
            $footerlogo = "" . $upload2->file_dst_name . "";
        }
        if (isset($favicon)) {
            $resim_bul = $db->query("SELECT * FROM ayarlar WHERE id = '1'")->fetch(PDO::FETCH_ASSOC);
            unlink("../" . TEMA . "/uploads/favicon/" . $resim_bul["favicon"]);
            $guncelle = $db->prepare("UPDATE ayarlar SET favicon = ? WHERE id = ?");
            $guncelle->execute([$favicon, 1]);
            $favicon = "" . $upload->file_dst_name . "";
        }
        $sorgu = $db->prepare("UPDATE ayarlar SET\r\n\t\t\tsite_baslik\t= ?,\r\n\t\t\tsite_url \t= ?,\r\n\t\t\tsite_keyw\t= ?,\r\n\t\t\tsite_desc\t= ?,\r\n\t\t\tfirma_adi\t= ?,\r\n\t\t\tpbirim\t\t= ?,\r\n\t\t\tfirma_telefon= ?,\r\n\t\t\tfirma_fax\t= ?,\r\n\t\t\tfirma_email\t= ?,\r\n\t\t\tfirma_adres\t= ?,\r\n\t\t\tgoogle_maps\t= ?,\r\n\t\t\tgoogle_maps_link\t= ?,\r\n\t\t\tgoogle_analytics= ?,\r\n\t\t\tfacebook\t= ?,\r\n\t\t\ttwitter\t\t= ?,\r\n\t\t\tgplus\t\t= ?,\r\n\t\t\tinstagram\t= ?,\r\n\t\t\tcopyright\t= ?,\r\n\t\t\tsite_durum\t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$site_title, $site_url, $site_keyw, $site_desc, $firma_adi, $pbirim, $firma_telefon, $firma_fax, $firma_email, $firma_adres, $google_maps, $google_maps_link, $google_analytics, $facebook, $twitter, $gplus, $instagram, $copyright, $site_durum, "1"]);
        if ($guncelle) {
            $kodlar = $_POST["ekstra"];
            $degisken = "dil";
            if (strlen($kodlar) == 0) {
                return false;
            }
           
        }
        $_SESSION["SiteAyarGuncelle"] = "no";
        header("Location:../panel/site-ayar.html");
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/site-ayar.html");
    }
}
if ($_GET["bildirimsil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $Sorgu = $db->prepare("DELETE FROM bildirimler WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["bildirimsil"] = "yes";
                header("Location:../panel/bildirimler.html");
            } else {
                $_SESSION["bildirimsil"] = "no";
                header("Location:../panel/bildirimler.html");
            }
        } else {
            header("Location:../panel/bildirimler.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/bildirimler.html");
    }
}
if (isset($_POST["HaberKaydet"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $aciklama = $_POST["aciklama"];
        $keywords = $_POST["keywords"];
        $description = $_POST["description"];
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->file_new_name_body = $seo;
            $upload->process("../" . TEMA . "/uploads/haberler");
            $upload->file_auto_rename = true;
            $upload->file_new_name_body = $seo;
            $upload->image_resize = true;
            $upload->image_ratio_crop = true;
            $upload->image_x = 462;
            $upload->image_y = 320;
            $upload->process("../" . TEMA . "/uploads/haberler/kucuk/");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        $gitti = $Resim = "" . $upload->file_dst_name . "";
        $sorgu = $db->prepare("INSERT INTO haberler SET\r\n\t\t\t\tadi \t= ?,\r\n\t\t\t\tseo \t= ?,\r\n\t\t\t\tdescription = ?,\r\n\t\t\t\tkeywords = ?,\r\n\t\t\t\taciklama= ?,\r\n\t\t\t\tdurum\t= ?,\r\n\t\t\t\tresim\t= ?,\r\n\t\t\t\tdil\t\t= ?,\r\n\t\t\t\ttarih \t= ?");
        $Ekle = $sorgu->execute([$adi, $seo, $description, $keywords, $aciklama, $durum, $Resim, $_SESSION["admin_dil"], $tarih]);
        if ($Ekle) {
            $_SESSION["HaberKaydet"] = "yes";
            header("Location:../panel/haber-listele.html");
        } else {
            $_SESSION["HaberKaydet"] = "no";
            header("Location:../panel/haber-ekle.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/haber-ekle.html");
    }
}
if (isset($_POST["HaberGuncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $aciklama = $_POST["aciklama"];
        $keywords = $_POST["keywords"];
        $description = $_POST["description"];
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->file_new_name_body = $seo;
            $upload->process("../" . TEMA . "/uploads/haberler");
            $upload->file_auto_rename = true;
            $upload->file_new_name_body = $seo;
            $upload->image_resize = true;
            $upload->image_ratio_crop = true;
            $upload->image_x = 462;
            $upload->image_y = 320;
            $upload->process("../" . TEMA . "/uploads/haberler/kucuk/");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        if (isset($Resim)) {
            $resim_bul = $db->query("SELECT * FROM haberler WHERE id = '" . $d_id . "'")->fetch(PDO::FETCH_ASSOC);
            unlink("../" . TEMA . "/uploads/haberler/" . $resim_bul["resim"]);
            unlink("../" . TEMA . "/uploads/haberler/kucuk/" . $resim_bul["resim"]);
            $guncelle = $db->prepare("UPDATE haberler SET resim = ? WHERE id = ?");
            $guncelle->execute([$Resim, $d_id]);
            $Resim = "" . $upload->file_dst_name . "";
        }
        $sorgu = $db->prepare("UPDATE haberler SET\r\n\t\t\tadi \t= ?,\r\n\t\t\tseo \t= ?,\r\n\t\t\tdescription = ?,\r\n\t\t\tkeywords = ?,\r\n\t\t\taciklama = ?,\r\n\t\t\tdurum\t= ?,\r\n\t\t\ttarih = ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$adi, $seo, $description, $keywords, $aciklama, $durum, $tarih, $d_id]);
        if ($guncelle) {
            $_SESSION["HaberGuncelle"] = "yes";
            header("Location:../panel/haber-duzenle/" . $d_id . ".html");
        } else {
            $_SESSION["HaberGuncelle"] = "no";
            header("Location:../panel/haber-duzenle/" . $d_id . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/haber-duzenle/" . $d_id . ".html");
    }
}
if ($_GET["haberresimsil"] == "ok") {
    islemkontrol();
    $resimid = $_GET["sid"];
    if ($_SESSION["rutbe"] == 0) {
        $resim_bul = $db->query("SELECT * FROM haberler WHERE id = '" . $resimid . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../" . TEMA . "/uploads/haberler/" . $resim_bul["resim"]);
        unlink("../" . TEMA . "/uploads/haberler/kucuk/" . $resim_bul["resim"]);
        $sorgu = $db->prepare("UPDATE haberler SET\r\n\t\t\t\t\tresim\t= ?\r\n\t\t\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute(["", $resimid]);
        if ($guncelle) {
            $_SESSION["haberresimsil"] = "yes";
            header("Location:../panel/haber-duzenle/" . $resimid . ".html");
        } else {
            $_SESSION["haberresimsil"] = "no";
            header("Location:../panel/haber-duzenle/" . $resimid . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/haber-duzenle/" . $resimid . ".html");
    }
}
if ($_GET["habersil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $resim_bul = $db->query("SELECT * FROM haberler WHERE id = '" . $id . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../" . TEMA . "/uploads/haberler/" . $resim_bul["resim"]);
        unlink("../" . TEMA . "/uploads/haberler/kucuk/" . $resim_bul["resim"]);
        $Sorgu = $db->prepare("DELETE FROM haberler WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["habersil"] = "yes";
                header("Location:../panel/haber-listele.html");
            } else {
                $_SESSION["habersil"] = "no";
                header("Location:../panel/haber-listele.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/haber-listele.html");
    }
}
if (isset($_POST["KategoriEkle"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $keywords = $_POST["keywords"];
        $description = $_POST["description"];
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        $sorgu = $db->prepare("INSERT INTO kategori SET\r\n\t\t\t\tadi \t= ?,\r\n\t\t\t\tdescription \t= ?,\r\n\t\t\t\tkeywords \t= ?,\r\n\t\t\t\tseo \t= ?,\r\n\t\t\t\tdurum\t= ?,\r\n\t\t\t\tdil\t\t= ?,\r\n\t\t\t\ttarih = ?");
        $Ekle = $sorgu->execute([$adi, $description, $keywords, $seo, $durum, $_SESSION["admin_dil"], $tarih]);
        if ($Ekle) {
            $_SESSION["KategoriEkle"] = "yes";
            header("Location:../panel/kategoriler.html");
        } else {
            $_SESSION["KategoriEkle"] = "no";
            header("Location:../panel/kategoriler.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/kategoriler.html");
    }
}
if (isset($_POST["KategoriEGuncelle"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $kid = $_POST["kid"];
        $Gadi = $_POST["Gadi"];
        $Gkeywords = $_POST["Gkeywords"];
        $Gdescription = $_POST["Gdescription"];
        $Gseoo = seoyap($Gadi);
        if ($Gseoo) {
            $Gseo = seoyap($Gadi);
        } else {
            $Gseo = rand();
        }
        if ($_POST["Gdurum"]) {
            $Gdurum = 1;
        } else {
            $Gdurum = 0;
        }
        $Gtarih = date("Y-m-d H:i:s");
        $Gtarih = tarih($Gtarih);
        $Ksorgu = $db->prepare("UPDATE kategori SET\r\n\t\t\t\t\tadi \t= ?,\r\n\t\t\t\t\tdescription = ?,\r\n\t\t\t\t\tkeywords = ?,\r\n\t\t\t\t\tseo \t= ?,\r\n\t\t\t\t\tdurum\t= ?,\r\n\t\t\t\t\ttarih = ?\r\n\t\t\t\t\tWHERE id = ?");
        $guncelle = $Ksorgu->execute([$Gadi, $Gdescription, $Gkeywords, $Gseo, $Gdurum, $Gtarih, $kid]);
        if ($guncelle) {
            $_SESSION["KategoriEGuncelle"] = "yes";
            header("Location:../panel/kategoriler.html");
        } else {
            $_SESSION["KategoriEGuncelle"] = "yes";
            header("Location:../panel/kategoriler.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/kategoriler.html");
    }
}
if ($_GET["kategorisil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $Sorgu = $db->prepare("DELETE FROM kategori WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["kategorisil"] = "yes";
                header("Location:../panel/kategoriler.html");
            } else {
                $_SESSION["kategorisil"] = "no";
                header("Location:../panel/kategoriler.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/kategoriler.html");
    }
}
if (isset($_POST["Limit_Ayar"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $arac_listesi = $_POST["arac_listesi"];
        $haber_sayisi = $_POST["haber_sayisi"];
        $transfer_sayisi = $_POST["transfer_sayisi"];
        $kampanya_sayisi = $_POST["kampanya_sayisi"];
        $sorgu = $db->prepare("UPDATE limit_ayar SET\r\n\t\t\tarac_listesi\t= ?,\r\n\t\t\ttransfer_sayisi\t= ?,\r\n\t\t\tkampanya_sayisi\t= ?,\r\n\t\t\thaber_sayisi\t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$arac_listesi, $transfer_sayisi, $kampanya_sayisi, $haber_sayisi, "1"]);
        if ($guncelle) {
            $_SESSION["Limit_Ayar"] = "yes";
            header("Location:../panel/limit-ayar.html");
        } else {
            $_SESSION["Limit_Ayar"] = "no";
            header("Location:../panel/limit-ayar.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/limit-ayar.html");
    }
}
if (isset($_POST["Mail_Ayar"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $m_server = $_POST["m_server"];
        $m_adresi = $_POST["m_adresi"];
        $m_parola = $_POST["m_parola"];
        $m_baslik = $_POST["m_baslik"];
        $sorgu = $db->prepare("UPDATE mail_ayar SET\r\n\t\t\tm_server\t= ?,\r\n\t\t\tm_adresi \t= ?,\r\n\t\t\tm_parola\t= ?,\r\n\t\t\tm_baslik\t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$m_server, $m_adresi, $m_parola, $m_baslik, "1"]);
        if ($guncelle) {
            $_SESSION["Mail_Ayar"] = "yes";
            header("Location:../panel/mail-ayar.html");
        } else {
            $_SESSION["Mail_Ayar"] = "no";
            header("Location:../panel/mail-ayar.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/mail-ayar.html");
    }
}
if (isset($_POST["MenuKaydet"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $menu_sira = $_POST["menu_sira"];
        $menu_ust = $_POST["menu_ust"];
        $menu_isim = $_POST["menu_isim"];
        $menu_url = $_POST["menu_url"];
        $link = $_POST["link"];
        if ($_POST["sekme"]) {
            $sekme = 1;
        } else {
            $sekme = 0;
        }
        $menu_durum = $_POST["menu_durum"];
        $sorgu = $db->prepare("INSERT INTO menu SET\r\n\t\t\tmenu_sira \t= ?,\r\n\t\t\tmenu_ust \t= ?,\r\n\t\t\tmenu_isim \t= ?,\r\n\t\t\tmenu_url \t= ?,\r\n\t\t\tlink \t\t= ?,\r\n\t\t\tsekme \t\t= ?,\r\n\t\t\tdil \t\t= ?,\r\n\t\t\tmenu_durum \t= ?");
        $Ekle = $sorgu->execute([$menu_sira, $menu_ust, $menu_isim, $menu_url, $link, $sekme, $_SESSION["admin_dil"], $menu_durum]);
        if ($Ekle) {
            $_SESSION["MenuKaydet"] = "yes";
            header("Location:../panel/menu-ayar.html");
        } else {
            $_SESSION["MenuKaydet"] = "no";
            header("Location:../panel/menu-ayar.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/menu-ayar.html");
    }
}
if (isset($_POST["MenuGuncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $menu_sira = $_POST["menu_sira"];
        $menu_ust = $_POST["menu_ust"];
        $menu_isim = $_POST["menu_isim"];
        $menu_url = $_POST["menu_url"];
        $link = $_POST["link"];
        if ($_POST["sekme"]) {
            $sekme = 1;
        } else {
            $sekme = 0;
        }
        $menu_durum = $_POST["menu_durum"];
        $sorgu = $db->prepare("UPDATE menu SET\r\n\t\t\t\tmenu_sira \t= ?,\r\n\t\t\t\tmenu_ust \t= ?,\r\n\t\t\t\tmenu_isim \t= ?,\r\n\t\t\t\tmenu_url \t= ?,\r\n\t\t\t\tlink \t\t= ?,\r\n\t\t\t\tsekme \t\t= ?,\r\n\t\t\t\tmenu_durum \t= ?\r\n\t\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$menu_sira, $menu_ust, $menu_isim, $menu_url, $link, $sekme, $menu_durum, $d_id]);
        if ($guncelle) {
            $_SESSION["MenuGuncelle"] = "yes";
            header("Location:../panel/menu/duzenle/" . $d_id . ".html");
        } else {
            $_SESSION["MenuGuncelle"] = "no";
            header("Location:../panel/menu/duzenle/" . $d_id . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/menu/duzenle/" . $d_id . ".html");
    }
}
if ($_GET["menusil"] == "ok") {
    islemkontrol();
    $id = $_GET["id"];
    if ($_SESSION["rutbe"] == 0) {
        $Sorgu = $db->prepare("DELETE FROM menu WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $TopluSorgu = $db->prepare("SELECT * FROM menu WHERE menu_ust = ?");
                $TopluSorgu->execute([$_GET["id"]]);
                $Topluislem = $TopluSorgu->fetchALL(PDO::FETCH_ASSOC);
                foreach ($Topluislem as $TopluSonuc) {
                    $TSorgu = $db->prepare("DELETE FROM menu WHERE id = :id");
                    $TSorgu->execute(["id" => $TopluSonuc["id"]]);
                }
                $_SESSION["menusil"] = "yes";
                header("Location:../panel/menu/duzenle/" . $id . ".html");
            } else {
                $_SESSION["menusil"] = "no";
                header("Location:../panel/menu/duzenle/" . $id . ".html");
            }
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/menu/duzenle/" . $id . ".html");
    }
}
if (isset($_POST["secilen_sil"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        if ($_POST["id"]) {
            foreach ($_POST["id"] as $i) {
                $TopluSorgu = $db->prepare("DELETE FROM iletisim WHERE id = :id");
                $TopluSil = $TopluSorgu->execute(["id" => $i]);
                if ($TopluSil) {
                    $_SESSION["secilen_sil"] = "yes";
                    header("Location:../panel/mesajlar.html");
                } else {
                    $_SESSION["secilen_sil"] = "no";
                    header("Location:../panel/mesajlar.html");
                }
            }
        } else {
            $_SESSION["secilen"] = "no";
            header("Location:../panel/mesajlar.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/mesajlar.html");
    }
}
if (isset($_POST["secilen_okundu"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        if ($_POST["id"]) {
            foreach ($_POST["id"] as $i) {
                $TopluSorgu = $db->prepare("UPDATE iletisim SET durum = '1' WHERE id = :id");
                $Okundu = $TopluSorgu->execute(["id" => $i]);
                if ($Okundu) {
                    $_SESSION["secilen_okundu"] = "yes";
                    header("Location:../panel/mesajlar.html");
                } else {
                    $_SESSION["secilen_okundu"] = "no";
                    header("Location:../panel/mesajlar.html");
                }
            }
        } else {
            $_SESSION["secilen"] = "no";
            header("Location:../panel/mesajlar.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/mesajlar.html");
    }
}
if (isset($_POST["secilen_okunmadi"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        if ($_POST["id"]) {
            foreach ($_POST["id"] as $i) {
                $TopluSorgu = $db->prepare("UPDATE iletisim SET durum = '0' WHERE id = :id");
                $_obfuscated_4F6B756E6D6164C4B1_ = $TopluSorgu->execute(["id" => $i]);
                if ($_obfuscated_4F6B756E6D6164C4B1_) {
                    $_SESSION["secilen_okunmadi"] = "yes";
                    header("Location:../panel/mesajlar.html");
                } else {
                    $_SESSION["secilen_okunmadi"] = "no";
                    header("Location:../panel/mesajlar.html");
                }
            }
        } else {
            $_SESSION["secilen"] = "no";
            header("Location:../panel/mesajlar.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/mesajlar.html");
    }
}
if ($_GET["mesajsil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $Sorgu = $db->prepare("DELETE FROM iletisim WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $_GET["id"]]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $sill = $db->prepare("DELETE FROM bildirimler WHERE bid = ?");
                $sill->execute([$_GET["id"]]);
                $_SESSION["mesajsil"] = "yes";
                header("Location:../panel/mesajlar.html");
            } else {
                $_SESSION["mesajsil"] = "no";
                header("Location:../panel/mesajlar.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/mesajlar.html");
    }
}
if (isset($_POST["profilbtn"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $isim = $_POST["isim"];
        $kadi = $_POST["kadi"];
        $sifre = $_POST["sifre"];
        $email = $_POST["email"];
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../panel/assets/images/users");
            if ($upload->processed) {
                $avatar = "" . $upload->file_dst_name . "";
            }
        }
        if (isset($avatar) != "") {
            $resim_bul = $db->query("SELECT * FROM yonetici WHERE id = '" . $_SESSION["yonetici_id"] . "'")->fetch(PDO::FETCH_ASSOC);
            unlink("assets/images/users/" . $resim_bul["avatar"]);
            $sorgu = $db->prepare("UPDATE yonetici SET\r\n\t\t\t\tisim \t= ?,\r\n\t\t\t\tkadi\t= ?,\r\n\t\t\t\temail\t= ?,\r\n\t\t\t\tsifre\t= ?,\r\n\t\t\t\tavatar\t= ?\r\n\t\t\t\tWHERE id= ?");
            $guncelle = $sorgu->execute([$isim, $kadi, $email, $sifre, $avatar, $_SESSION["yonetici_id"]]);
            if ($guncelle) {
                $_SESSION["yonetici_kullanici"] = $kadi;
                $_SESSION["yonetici_sifre"] = $sifre;
                $_SESSION["profilbtn"] = "yes";
                header("Location:../panel/profil.html");
            } else {
                $_SESSION["profilbtn"] = "no";
                header("Location:../panel/profil.html");
            }
        } else {
            $sorgu = $db->prepare("UPDATE yonetici SET\r\n\t\t\t\t\t\tisim \t= ?,\r\n\t\t\t\t\t\tkadi\t= ?,\r\n\t\t\t\t\t\temail\t= ?,\r\n\t\t\t\t\t\tsifre\t= ?\r\n\t\t\t\t\t\tWHERE id= ?");
            $guncelle = $sorgu->execute([$isim, $kadi, $email, $sifre, $_SESSION["yonetici_id"]]);
            if ($guncelle) {
                $_SESSION["yonetici_kullanici"] = $kadi;
                $_SESSION["yonetici_sifre"] = $sifre;
                $_SESSION["profilbtn"] = "yes";
                header("Location:../panel/profil.html");
            } else {
                $_SESSION["profilbtn"] = "no";
                header("Location:../panel/profil.html");
            }
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/profil.html");
    }
}
if (isset($_POST["Renk_Ayar"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $renk1 = $_POST["renk1"];
        $renk2 = $_POST["renk2"];
        $renk3 = $_POST["renk3"];
        $sorgu = $db->prepare("UPDATE renkler SET\r\n\t\t\trenk1\t= ?,\r\n\t\t\trenk2 \t= ?,\r\n\t\t\trenk3\t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$renk1, $renk2, $renk3, "1"]);
        if ($guncelle) {
            $_SESSION["Renk_Ayar"] = "yes";
            header("Location:../panel/renk-ayar.html");
        } else {
            $_SESSION["Renk_Ayar"] = "no";
            header("Location:../panel/renk-ayar.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/renk-ayar.html");
    }
}
if (isset($_POST["sayfa_ekle"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        if ($_POST["anasayfa"]) {
            $anasayfa = 1;
            $kisa = $_POST["kisa"];
        } else {
            $anasayfa = 0;
            $kisa = "";
        }
        $aciklama = $_POST["aciklama"];
        $keywords = $_POST["keywords"];
        $description = $_POST["description"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../" . TEMA . "/uploads/sayfalar");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        $gitti = $Resim = "" . $upload->file_dst_name . "";
        $sorgu = $db->prepare("INSERT INTO sayfalar SET\r\n\t\t\t\tadi \t= ?,\r\n\t\t\t\tseo \t= ?,\r\n\t\t\t\tkisa \t= ?,\r\n\t\t\t\taciklama= ?,\r\n\t\t\t\tkeywords= ?,\r\n\t\t\t\tdescription\t= ?,\r\n\t\t\t\tdurum \t= ?,\r\n\t\t\t\tanasayfa = ?,\r\n\t\t\t\tresim \t= ?,\r\n\t\t\t\tdil \t= ?,\r\n\t\t\t\ttarih \t= ?");
        $Ekle = $sorgu->execute([$adi, $seo, $kisa, $aciklama, $keywords, $description, $durum, $anasayfa, $Resim, $_SESSION["admin_dil"], $tarih]);
        if ($Ekle) {
            $_SESSION["sayfa_ekle"] = "yes";
            header("Location:../panel/sayfa-listele.html");
        } else {
            $_SESSION["sayfa_ekle"] = "no";
            header("Location:../panel/sayfa-ekle.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/sayfa-ekle.html");
    }
}
if (isset($_POST["sayfa_guncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        if ($_POST["anasayfa"]) {
            $anasayfa = 1;
            $kisa = $_POST["kisa"];
        } else {
            $anasayfa = 0;
            $kisa = "";
        }
        $aciklama = $_POST["aciklama"];
        $keywords = $_POST["keywords"];
        $description = $_POST["description"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../" . TEMA . "/uploads/sayfalar");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        if (isset($Resim)) {
            $resim_bul = $db->query("SELECT * FROM sayfalar WHERE id = '" . $d_id . "'")->fetch(PDO::FETCH_ASSOC);
            unlink("../" . TEMA . "/uploads/sayfalar/" . $resim_bul["resim"]);
            $guncelle = $db->prepare("UPDATE sayfalar SET resim = ? WHERE id = ?");
            $guncelle->execute([$Resim, $d_id]);
        }
        $sorgu = $db->prepare("UPDATE sayfalar SET\r\n\t\t\tadi \t= ?,\r\n\t\t\tseo \t= ?,\r\n\t\t\tkisa \t= ?,\r\n\t\t\taciklama= ?,\r\n\t\t\tkeywords= ?,\r\n\t\t\tdescription\t= ?,\r\n\t\t\tdurum \t= ?,\r\n\t\t\tanasayfa = ?,\r\n\t\t\ttarih \t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$adi, $seo, $kisa, $aciklama, $keywords, $description, $durum, $anasayfa, $tarih, $d_id]);
        if ($guncelle) {
            $_SESSION["sayfa_guncelle"] = "yes";
            header("Location:../panel/sayfa-duzenle/" . $d_id . ".html");
        } else {
            $_SESSION["sayfa_guncelle"] = "no";
            header("Location:../panel/sayfa-duzenle/" . $d_id . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/sayfa-duzenle/" . $d_id . ".html");
    }
}
if ($_GET["sayfaresimsil"] == "ok") {
    islemkontrol();
    $resimid = $_GET["sid"];
    if ($_SESSION["rutbe"] == 0) {
        $resim_bul = $db->query("SELECT * FROM sayfalar WHERE id = '" . $resimid . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../" . TEMA . "/uploads/sayfalar/" . $resim_bul["resim"]);
        $sorgu = $db->prepare("UPDATE sayfalar SET\r\n\t\t\t\t\tresim\t= ?\r\n\t\t\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute(["", $resimid]);
        if ($guncelle) {
            $_SESSION["sayfaresimsil"] = "yes";
            header("Location:../panel/sayfa-duzenle/" . $resimid . ".html");
        } else {
            $_SESSION["sayfaresimsil"] = "no";
            header("Location:../panel/sayfa-duzenle/" . $resimid . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/sayfa-duzenle/" . $resimid . ".html");
    }
}
if ($_GET["sayfasil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $resim_bul = $db->query("SELECT * FROM sayfalar WHERE id = '" . $id . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../" . TEMA . "/uploads/sayfalar/" . $resim_bul["resim"]);
        $Sorgu = $db->prepare("DELETE FROM sayfalar WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["sayfasil"] = "yes";
                header("Location:../panel/sayfa-listele.html");
            } else {
                $_SESSION["sayfasil"] = "no";
                header("Location:../panel/sayfa-listele.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/sayfa-listele.html");
    }
}
if (isset($_POST["lokasyon_ekle"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $konum = $_POST["konum"];
        $adres = $_POST["adres"];
        $telefon = $_POST["telefon"];
        $email = $_POST["email"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        $sorgu = $db->prepare("INSERT INTO lokasyon SET\r\n\t\t\t\tadi \t= ?,\r\n\t\t\t\tseo \t= ?,\r\n\t\t\t\tkonum\t= ?,\r\n\t\t\t\tadres\t= ?,\r\n\t\t\t\ttelefon\t= ?,\r\n\t\t\t\temail\t= ?,\r\n\t\t\t\tdurum \t= ?,\r\n\t\t\t\tdil \t= ?,\r\n\t\t\t\ttarih \t= ?");
        $Ekle = $sorgu->execute([$adi, $seo, $konum, $adres, $telefon, $email, $durum, $_SESSION["admin_dil"], $tarih]);
        if ($Ekle) {
            $_SESSION["lokasyon_ekle"] = "yes";
            header("Location:../panel/lokasyon-listele.html");
        } else {
            $_SESSION["lokasyon_ekle"] = "no";
            header("Location:../panel/lokasyon-ekle.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/lokasyon-ekle.html");
    }
}
if (isset($_POST["lokasyon_guncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $konum = $_POST["konum"];
        $adres = $_POST["adres"];
        $telefon = $_POST["telefon"];
        $email = $_POST["email"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        $sorgu = $db->prepare("UPDATE lokasyon SET\r\n\t\t\tadi \t= ?,\r\n\t\t\tseo \t= ?,\r\n\t\t\tkonum\t= ?,\r\n\t\t\tdurum \t= ?,\r\n\t\t\tadres \t= ?,\r\n\t\t\ttelefon\t= ?,\r\n\t\t\temail \t= ?,\r\n\t\t\ttarih \t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$adi, $seo, $konum, $durum, $adres, $telefon, $email, $tarih, $d_id]);
        if ($guncelle) {
            $_SESSION["lokasyon_guncelle"] = "yes";
            header("Location:../panel/lokasyon-duzenle/" . $d_id . ".html");
        } else {
            $_SESSION["lokasyon_guncelle"] = "no";
            header("Location:../panel/lokasyon-duzenle/" . $d_id . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/lokasyon-duzenle/" . $d_id . ".html");
    }
}
if ($_GET["lokasyonsil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $Sorgu = $db->prepare("DELETE FROM lokasyon WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["lokasyonsil"] = "yes";
                header("Location:../panel/lokasyon-listele.html");
            } else {
                $_SESSION["lokasyonsil"] = "no";
                header("Location:../panel/lokasyon-listele.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/lokasyon-listele.html");
    }
}
if (isset($_POST["slider_ekle"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $url = $_POST["url"];
        if ($_POST["sekme"]) {
            $sekme = 1;
        } else {
            $sekme = 0;
        }
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $fiyat = $_POST["fiyat"];
        $bilgi = $_POST["bilgi"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../" . TEMA . "/uploads/slider");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        $gitti = $Resim = "" . $upload->file_dst_name . "";
        $sorgu = $db->prepare("INSERT INTO slider SET\r\n\t\t\t\tadi \t= ?,\r\n\t\t\t\tfiyat \t= ?,\r\n\t\t\t\tbilgi \t= ?,\r\n\t\t\t\turl \t= ?,\r\n\t\t\t\tsekme \t= ?,\r\n\t\t\t\tseo \t= ?,\r\n\t\t\t\tdurum \t= ?,\r\n\t\t\t\tresim \t= ?,\r\n\t\t\t\tdil \t= ?,\r\n\t\t\t\ttarih \t= ?");
        $Ekle = $sorgu->execute([$adi, $fiyat, $bilgi, $url, $sekme, $seo, $durum, $Resim, $_SESSION["admin_dil"], $tarih]);
        if ($Ekle) {
            $_SESSION["slider_ekle"] = "yes";
            header("Location:../panel/slider-listele.html");
        } else {
            $_SESSION["slider_ekle"] = "no";
            header("Location:../panel/slider-ekle.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/slider-ekle.html");
    }
}
if (isset($_POST["slider_guncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $url = $_POST["url"];
        if ($_POST["sekme"]) {
            $sekme = 1;
        } else {
            $sekme = 0;
        }
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $fiyat = $_POST["fiyat"];
        $bilgi = $_POST["bilgi"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../" . TEMA . "/uploads/slider");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        if (isset($Resim)) {
            $resim_bul = $db->query("SELECT * FROM slider WHERE id = '" . $d_id . "'")->fetch(PDO::FETCH_ASSOC);
            unlink("../" . TEMA . "/uploads/slider/" . $resim_bul["resim"]);
            $guncelle = $db->prepare("UPDATE slider SET resim = ? WHERE id = ?");
            $guncelle->execute([$Resim, $d_id]);
        }
        $sorgu = $db->prepare("UPDATE slider SET\r\n\t\t\tadi \t= ?,\r\n\t\t\tfiyat \t= ?,\r\n\t\t\tbilgi \t= ?,\r\n\t\t\turl \t= ?,\r\n\t\t\tsekme \t= ?,\r\n\t\t\tseo \t= ?,\r\n\t\t\tdurum \t= ?,\r\n\t\t\ttarih \t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$adi, $fiyat, $bilgi, $url, $sekme, $seo, $durum, $tarih, $d_id]);
        if ($guncelle) {
            $_SESSION["slider_guncelle"] = "yes";
            header("Location:../panel/slider-duzenle/" . $d_id . ".html");
        } else {
            $_SESSION["slider_guncelle"] = "no";
            header("Location:../panel/slider-duzenle/" . $d_id . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/slider-duzenle/" . $d_id . ".html");
    }
}
if ($_GET["sliderresimsil"] == "ok") {
    islemkontrol();
    $resimid = $_GET["sid"];
    if ($_SESSION["rutbe"] == 0) {
        $resim_bul = $db->query("SELECT * FROM slider WHERE id = '" . $resimid . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../" . TEMA . "/uploads/slider/" . $resim_bul["resim"]);
        $sorgu = $db->prepare("UPDATE slider SET\r\n\t\t\t\t\tresim\t= ?\r\n\t\t\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute(["", $resimid]);
        if ($guncelle) {
            $_SESSION["sliderresimsil"] = "yes";
            header("Location:../panel/slider-duzenle/" . $resimid . ".html");
        } else {
            $_SESSION["sliderresimsil"] = "no";
            header("Location:../panel/slider-duzenle/" . $resimid . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/slider-duzenle/" . $resimid . ".html");
    }
}
if ($_GET["slidersil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $resim_bul = $db->query("SELECT * FROM slider WHERE id = '" . $id . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../" . TEMA . "/uploads/slider/" . $resim_bul["resim"]);
        $Sorgu = $db->prepare("DELETE FROM slider WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["slidersil"] = "yes";
                header("Location:../panel/slider-listele.html");
            } else {
                $_SESSION["slidersil"] = "no";
                header("Location:../panel/slider-listele.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/slider-listele.html");
    }
}
if (isset($_POST["Sms_Ayar"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $postUrl = $_POST["postUrl"];
        $KULLANICINO = $_POST["KULLANICINO"];
        $KULLANICIADI = $_POST["KULLANICIADI"];
        $SIFRE = $_POST["SIFRE"];
        $ORGINATOR = $_POST["ORGINATOR"];
        $sorgu = $db->prepare("UPDATE sms SET\r\n\t\t\tpostUrl\t\t= ?,\r\n\t\t\tKULLANICINO = ?,\r\n\t\t\tKULLANICIADI= ?,\r\n\t\t\tSIFRE\t\t= ?,\r\n\t\t\tORGINATOR\t= ?\r\n\t\t\tWHERE id \t= ?");
        $guncelle = $sorgu->execute([$postUrl, $KULLANICINO, $KULLANICIADI, $SIFRE, $ORGINATOR, "1"]);
        if ($guncelle) {
            $_SESSION["Sms_Ayar"] = "yes";
            header("Location:../panel/sms-ayar.html");
        } else {
            $_SESSION["Sms_Ayar"] = "no";
            header("Location:../panel/sms-ayar.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/sms-ayar.html");
    }
}
if (isset($_POST["yonetici_kaydet"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $isim = $_POST["isim"];
        $email = $_POST["email"];
        $kadi = $_POST["kadi"];
        $sifre = $_POST["sifre"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../panel/assets/images/users");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        $gitti = $Resim = "" . $upload->file_dst_name . "";
        $sorgu = $db->prepare("INSERT INTO yonetici SET\r\n\t\t\t\tisim \t= ?,\r\n\t\t\t\temail = ?,\r\n\t\t\t\tkadi\t= ?,\r\n\t\t\t\tsifre\t= ?,\r\n\t\t\t\tavatar\t= ?,\r\n\t\t\t\tson_giris= ?");
        $Ekle = $sorgu->execute([$isim, $email, $kadi, $sifre, $Resim, $tarih]);
        if ($Ekle) {
            $_SESSION["yonetici_kaydet"] = "yes";
            header("Location:../panel/yonetici-listele.html");
        } else {
            $_SESSION["yonetici_kaydet"] = "no";
            header("Location:../panel/yonetici-ekle.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/yonetici-ekle.html");
    }
}
if (isset($_POST["yonetici_guncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $isim = $_POST["isim"];
        $email = $_POST["email"];
        $kadi = $_POST["kadi"];
        $sifre = $_POST["sifre"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../panel/assets/images/users");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        if (isset($Resim) != "") {
            $resim_bul = $db->query("SELECT * FROM yonetici WHERE id = '" . $d_id . "'")->fetch(PDO::FETCH_ASSOC);
            unlink("../panel/assets/images/users/" . $resim_bul["avatar"]);
            $sorgu = $db->prepare("UPDATE yonetici SET\r\n\t\t\t\t\tisim \t= ?,\r\n\t\t\t\t\temail = ?,\r\n\t\t\t\t\tkadi\t= ?,\r\n\t\t\t\t\tsifre\t= ?,\r\n\t\t\t\t\tavatar\t= ?,\r\n\t\t\t\t\tson_giris= ?\r\n\t\t\t\t\tWHERE id = ?");
            $guncelle = $sorgu->execute([$isim, $email, $kadi, $sifre, $Resim, $tarih, $d_id]);
            if ($guncelle) {
                $_SESSION["yonetici_kullanici"] = $kadi;
                $_SESSION["yonetici_sifre"] = $sifre;
                $_SESSION["yonetici_guncelle"] = "yes";
                header("Location:../panel/yonetici-duzenle/" . $d_id . ".html");
            } else {
                $_SESSION["yonetici_guncelle"] = "no";
                header("Location:../panel/yonetici-duzenle/" . $d_id . ".html");
            }
        } else {
            $sorgu = $db->prepare("UPDATE yonetici SET\r\n\t\t\t\t\tisim \t= ?,\r\n\t\t\t\t\temail = ?,\r\n\t\t\t\t\tkadi\t= ?,\r\n\t\t\t\t\tsifre\t= ?,\r\n\t\t\t\t\tson_giris= ?\r\n\t\t\t\t\tWHERE id = ?");
            $guncelle = $sorgu->execute([$isim, $email, $kadi, $sifre, $tarih, $d_id]);
            if ($guncelle) {
                $_SESSION["yonetici_kullanici"] = $kadi;
                $_SESSION["yonetici_sifre"] = $sifre;
                $_SESSION["yonetici_guncelle"] = "yes";
                header("Location:../panel/yonetici-duzenle/" . $d_id . ".html");
            } else {
                $_SESSION["yonetici_guncelle"] = "no";
                header("Location:../panel/yonetici-duzenle/" . $d_id . ".html");
            }
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/yonetici-duzenle/" . $d_id . ".html");
    }
}
if ($_GET["yoneticiresimsil"] == "ok") {
    islemkontrol();
    $resimid = $_GET["sid"];
    if ($_SESSION["rutbe"] == 0) {
        $resim_bul = $db->query("SELECT * FROM yonetici WHERE id = '" . $resimid . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../panel/assets/images/users/" . $resim_bul["avatar"]);
        $sorgu = $db->prepare("UPDATE yonetici SET\r\n\t\t\t\tavatar\t= ?\r\n\t\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute(["", $resimid]);
        if ($guncelle) {
            $_SESSION["yoneticiresimsil"] = "yes";
            header("Location:../panel/yonetici-duzenle/" . $resimid . ".html");
        } else {
            $_SESSION["yoneticiresimsil"] = "no";
            header("Location:../panel/yonetici-duzenle/" . $resimid . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/yonetici-duzenle/" . $resimid . ".html");
    }
}
if ($_GET["yoneticisil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $resim_bul = $db->query("SELECT * FROM yonetici WHERE id = '" . $id . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../panel/assets/images/users/" . $resim_bul["avatar"]);
        $Sorgu = $db->prepare("DELETE FROM yonetici WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["yoneticisil"] = "yes";
                header("Location:../panel/yonetici-listele.html");
            } else {
                $_SESSION["yoneticisil"] = "no";
                header("Location:../panel/yonetici-listele.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/yonetici-listele.html");
    }
}
if ($_GET["transferformusil"] == "ok") {
    islemkontrol();
    $url = $_GET["url"];
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $Sorgu = $db->prepare("DELETE FROM transfer_formu WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["transferformusil"] = "yes";
                header("Location:" . $url . "");
            } else {
                $_SESSION["transferformusil"] = "no";
                header("Location:" . $url . "");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:" . $url . "");
    }
}
if ($_GET["ebultensil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $Sorgu = $db->prepare("DELETE FROM ebulten WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["ebultensil"] = "yes";
                header("Location:../panel/ebulten.html");
            } else {
                $_SESSION["ebultensil"] = "no";
                header("Location:../panel/ebulten.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/ebulten.html");
    }
}
if (isset($_POST["modul_guncelle"])) {
    islemkontrol();
    $url = $_POST["url"];
    if ($_SESSION["rutbe"] == 0) {
        if ($_POST["alan1"]) {
            $alan1 = 1;
        } else {
            $alan1 = 0;
        }
        if ($_POST["alan2"]) {
            $alan2 = 1;
        } else {
            $alan2 = 0;
        }
        if ($_POST["alan3"]) {
            $alan3 = 1;
        } else {
            $alan3 = 0;
        }
        if ($_POST["alan4"]) {
            $alan4 = 1;
        } else {
            $alan4 = 0;
        }
        if ($_POST["alan5"]) {
            $alan5 = 1;
        } else {
            $alan5 = 0;
        }
        if ($_POST["alan6"]) {
            $alan6 = 1;
        } else {
            $alan6 = 0;
        }
        if ($_POST["alan7"]) {
            $alan7 = 1;
        } else {
            $alan7 = 0;
        }
        if ($_POST["alan8"]) {
            $alan8 = 1;
        } else {
            $alan8 = 0;
        }
        if ($_POST["alan9"]) {
            $alan9 = 1;
        } else {
            $alan9 = 0;
        }
        $sorgu = $db->prepare("UPDATE moduller SET\r\n\t\t\talan1\t= ?,\r\n\t\t\talan2\t= ?,\r\n\t\t\talan3\t= ?,\r\n\t\t\talan4\t= ?,\r\n\t\t\talan5\t= ?,\r\n\t\t\talan6\t= ?,\r\n\t\t\talan7\t= ?,\r\n\t\t\talan8\t= ?,\r\n\t\t\talan9\t= ?\r\n\t\t\tWHERE id= ?");
        $guncelle = $sorgu->execute([$alan1, $alan2, $alan3, $alan4, $alan5, $alan6, $alan7, $alan8, $alan9, "1"]);
        if ($guncelle) {
            $_SESSION["modul_guncelle"] = "yes";
            header("Location:" . $url . "");
        } else {
            $_SESSION["modul_guncelle"] = "no";
            header("Location:" . $url . "");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:" . $url . "");
    }
}
if (isset($_POST["dil_kaydet"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $sira = (int) $_POST["sira"];
        $adi = $_POST["adi"];
        $anadil = (int) $_POST["anadil"];
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../" . TEMA . "/uploads/diller");
            $upload->file_auto_rename = true;
            $upload->image_resize = true;
            $upload->image_ratio_crop = true;
            $upload->image_x = 54;
            $upload->image_y = 36;
            $upload->process("../" . TEMA . "/uploads/diller/kucuk");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        $Resim = "" . $upload->file_dst_name . "";
        $anadil = $db->query("SELECT * FROM diller WHERE anadil = 1")->fetch(PDO::FETCH_ASSOC);
        $sorgu = $db->prepare("INSERT INTO diller SET\r\n\t\t\tsira \t= ?,\r\n\t\t\tadi \t= ?,\r\n\t\t\tanadil \t= ?,\r\n\t\t\tbayrak\t= ?");
        $Ekle = $sorgu->execute([$sira, $adi, $anadil, $Resim]);
        $lastid = $db->lastInsertId();
        if ($anadil == 1) {
            $db->query("UPDATE diller SET anadil = 0 WHERE id NOT IN(" . $lastid . ")");
        }
        if ($Ekle) {
            $_SESSION["dil_ekle"] = "yes";
            copy("../" . TEMA . "/../../language/dil_" . $anadil["id"] . ".php", "../" . TEMA . "/../../language/dil_" . $lastid . ".php");
            header("Location:../panel/dil-listele.html");
        } else {
            $_SESSION["dil_ekle"] = "no";
            header("Location:../panel/dil-ekle.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/dil-ekle.html");
    }
}
if (isset($_POST["dil_guncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $sira = (int) $_POST["sira"];
        $adi = $_POST["adi"];
        $anadil = (int) $_POST["anadil"];
        include_once "../panel/class.upload.php";
        $upload = new upload($_FILES["resim"]);
        if ($upload->uploaded) {
            $upload->file_auto_rename = true;
            $upload->process("../" . TEMA . "/uploads/diller");
            $upload->file_auto_rename = true;
            $upload->image_resize = true;
            $upload->image_ratio_crop = true;
            $upload->image_x = 54;
            $upload->image_y = 36;
            $upload->process("../" . TEMA . "/uploads/diller/kucuk");
            if ($upload->processed) {
                $Resim = "" . $upload->file_dst_name . "";
            }
        }
        if (isset($Resim)) {
            $resim_bul = $db->query("SELECT * FROM diller WHERE id = '" . $d_id . "'")->fetch(PDO::FETCH_ASSOC);
            if ($resim_bul["anadil"] != $anadil) {
                if ($anadil == 0) {
                    $_SESSION["dil_guncelle"] = "anadil";
                    header("Location:../panel/dil-duzenle/" . $d_id . ".html");
                } else {
                    $db->query("UPDATE diller SET anadil = 0");
                }
            }
            unlink("../" . TEMA . "/uploads/diller/" . $resim_bul["bayrak"]);
            $guncelle = $db->prepare("UPDATE diller SET bayrak = ? WHERE id = ?");
            $guncelle->execute([$Resim, $d_id]);
        }
        $sorgu = $db->prepare("UPDATE diller SET\r\n\t\t\tsira \t= ?,\r\n\t\t\tadi \t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$sira, $adi, $d_id]);
        if ($anadil == 0) {
            $_SESSION["dil_guncelle"] = "anadil";
            header("Location:../panel/dil-duzenle/" . $d_id . ".html");
        } else {
            $db->query("UPDATE diller SET anadil = 0");
            $db->query("UPDATE diller SET anadil = 1 WHERE id = " . $d_id);
        }
        $kodlar = $_POST["ekstra"];
        if (strlen($kodlar) == 0) {
            return false;
        }
        $yaz = fopen("../language/dil_" . $d_id . ".php", "w");
        exit("Dosya açılamadı lütfen dizin yetkilerini kontrol edin!");
    }
    $_SESSION["demohesap"] = "no";
    header("Location:../panel/dil-duzenle/" . $d_id . ".html");
}
if ($_GET["dilresimsil"] == "ok") {
    islemkontrol();
    $resimid = $_GET["sid"];
    if ($_SESSION["rutbe"] == 0) {
        $resim_bul = $db->query("SELECT * FROM diller WHERE id = '" . $resimid . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../" . TEMA . "/uploads/diller/" . $resim_bul["bayrak"]);
        unlink("../" . TEMA . "/uploads/diller/kucuk/" . $resim_bul["bayrak"]);
        $sorgu = $db->prepare("UPDATE diller SET\r\n\t\t\t\t\tbayrak\t= ?\r\n\t\t\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([NULL, $resimid]);
        if ($guncelle) {
            $_SESSION["dilresimsil"] = "yes";
            header("Location:../panel/dil-duzenle/" . $resimid . ".html");
        } else {
            $_SESSION["dilresimsil"] = "no";
            header("Location:../panel/dil-duzenle/" . $resimid . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/dil-duzenle/" . $resimid . ".html");
    }
}
if ($_GET["dilsil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $resim_bul = $db->query("SELECT * FROM diller WHERE id = '" . $id . "'")->fetch(PDO::FETCH_ASSOC);
        unlink("../" . TEMA . "/uploads/diller/" . $resim_bul["bayrak"]);
        unlink("../" . TEMA . "/uploads/diller/kucuk/" . $resim_bul["bayrak"]);
        unlink("../language/dil_" . $resim_bul["id"] . ".php");
        $Sorgu = $db->prepare("DELETE FROM diller WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["dilsil"] = "yes";
                header("Location:../panel/dil-listele.html");
            } else {
                $_SESSION["dilsil"] = "no";
                header("Location:../panel/dil-listele.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/dil-listele.html");
    }
}
if (isset($_POST["ekstra_ekle"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $adet = $_POST["adet"];
        $fiyat = $_POST["fiyat"];
        $pbirim = $_POST["pbirim"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        $sorgu = $db->prepare("INSERT INTO ekstra SET\r\n\t\t\t\tadi \t= ?,\r\n\t\t\t\tseo \t= ?,\r\n\t\t\t\tadet \t= ?,\r\n\t\t\t\tfiyat\t= ?,\r\n\t\t\t\tpbirim\t= ?,\r\n\t\t\t\tdurum \t= ?,\r\n\t\t\t\tdil \t= ?,\r\n\t\t\t\ttarih \t= ?");
        $Ekle = $sorgu->execute([$adi, $seo, $adet, $fiyat, $pbirim, $durum, $_SESSION["admin_dil"], $tarih]);
        if ($Ekle) {
            $_SESSION["ekstra_ekle"] = "yes";
            header("Location:../panel/ekstra-listele.html");
        } else {
            $_SESSION["ekstra_ekle"] = "no";
            header("Location:../panel/ekstra-ekle.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/ekstra-ekle.html");
    }
}
if (isset($_POST["ekstra_guncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $seoo = seoyap($adi);
        if ($seoo) {
            $seo = seoyap($adi);
        } else {
            $seo = rand();
        }
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $adet = $_POST["adet"];
        $fiyat = $_POST["fiyat"];
        $pbirim = $_POST["pbirim"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        $sorgu = $db->prepare("UPDATE ekstra SET\r\n\t\t\tadi \t= ?,\r\n\t\t\tseo \t= ?,\r\n\t\t\tadet \t= ?,\r\n\t\t\tfiyat\t= ?,\r\n\t\t\tpbirim\t= ?,\r\n\t\t\tdurum \t= ?,\r\n\t\t\ttarih \t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$adi, $seo, $adet, $fiyat, $pbirim, $durum, $tarih, $d_id]);
        if ($guncelle) {
            $_SESSION["ekstra_guncelle"] = "yes";
            header("Location:../panel/ekstra-duzenle/" . $d_id . ".html");
        } else {
            $_SESSION["ekstra_guncelle"] = "no";
            header("Location:../panel/ekstra-duzenle/" . $d_id . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/ekstra-duzenle/" . $d_id . ".html");
    }
}
if ($_GET["ekstrasil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $Sorgu = $db->prepare("DELETE FROM ekstra WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["ekstrasil"] = "yes";
                header("Location:../panel/ekstra-listele.html");
            } else {
                $_SESSION["ekstrasil"] = "no";
                header("Location:../panel/ekstra-listele.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/ekstra-listele.html");
    }
}
if (isset($_POST["rehber_ekle"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $email = $_POST["email"];
        $telefon = $_POST["telefon"];
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $notunuz = $_POST["notunuz"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        $sorgu = $db->prepare("INSERT INTO rehber SET\r\n\t\t\t\tadi \t= ?,\r\n\t\t\t\temail \t= ?,\r\n\t\t\t\ttelefon = ?,\r\n\t\t\t\tnotunuz= ?,\r\n\t\t\t\tdurum \t= ?,\r\n\t\t\t\ttarih \t= ?");
        $Ekle = $sorgu->execute([$adi, $email, $telefon, $notunuz, $durum, $tarih]);
        if ($Ekle) {
            $_SESSION["rehber_ekle"] = "yes";
            header("Location:../panel/rehber-listele.html");
        } else {
            $_SESSION["rehber_ekle"] = "no";
            header("Location:../panel/rehber-ekle.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/rehber-ekle.html");
    }
}
if (isset($_POST["rehber_guncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $adi = $_POST["adi"];
        $email = $_POST["email"];
        $telefon = $_POST["telefon"];
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $notunuz = $_POST["notunuz"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        $sorgu = $db->prepare("UPDATE rehber SET\r\n\t\t\tadi \t= ?,\r\n\t\t\temail \t= ?,\r\n\t\t\ttelefon\t= ?,\r\n\t\t\tnotunuz\t= ?,\r\n\t\t\tdurum \t= ?,\r\n\t\t\ttarih \t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$adi, $email, $telefon, $notunuz, $durum, $tarih, $d_id]);
        if ($guncelle) {
            $_SESSION["rehber_guncelle"] = "yes";
            header("Location:../panel/rehber-duzenle/" . $d_id . ".html");
        } else {
            $_SESSION["rehber_guncelle"] = "no";
            header("Location:../panel/rehber-duzenle/" . $d_id . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/rehber-duzenle/" . $d_id . ".html");
    }
}
if ($_GET["rehbersil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $Sorgu = $db->prepare("DELETE FROM rehber WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["rehbersil"] = "yes";
                header("Location:../panel/rehber-listele.html");
            } else {
                $_SESSION["rehbersil"] = "no";
                header("Location:../panel/rehber-listele.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/rehber-listele.html");
    }
}
if (isset($_POST["toplu_email_gonder"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $uyeler = $_POST["uyeler"];
        $konu = $_POST["konu"];
        $aciklama = $_POST["aciklama"];
        if (empty($uyeler) || empty($aciklama) || empty($konu)) {
            $_SESSION["toplu_email_gonder"] = "bos";
            header("Location:../panel/toplu-email.html");
        } else {
            require "../class.phpmailer.php";
            $mail = new PHPMailer();
            $mail->IsSMTP();
            $mail->SMTPAuth = true;
            $mail->Host = "" . m_server . "";
            $mail->Port = 587;
            $mail->IsHTML(true);
            $mail->Username = "" . m_adresi . "";
            $mail->Password = "" . m_parola . "";
            $mail->SetFrom(m_adresi, "" . FIRMAADI . "");
            foreach ($uyeler as $uye) {
                $mail->AddBCC("" . $uye . "", "" . FIRMAADI . "");
            }
            $mail->CharSet = "UTF-8";
            $mail->Subject = $konu;
            $mail->Body = $aciklama;
            if (!$mail->Send()) {
                echo $mail->ErrorInfo;
            } else {
                $_SESSION["toplu_email_gonder"] = "yes";
                header("Location:../panel/toplu-email.html");
            }
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/toplu-email.html");
    }
}
if (isset($_POST["toplu_sms_gonder"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $uyeler = implode(",", NumaraDuzelt($_POST["uyeler"]));
        $aciklama = $_POST["aciklama"];
        if (empty($uyeler) || empty($aciklama)) {
            $_SESSION["toplu_sms_gonder"] = "bos";
            header("Location:../panel/toplu-sms.html");
        } else {
            header("Content-Type: text/html; charset=utf-8");
            $postUrl = "" . $sms["postUrl"] . "";
            $_obfuscated_4D5553544552C4B04E4F_ = "" . $sms["KULLANICINO"] . "";
            $KULLANICIADI = "" . $sms["KULLANICIADI"] . "";
            $SIFRE = "" . $sms["SIFRE"] . "";
            $ORGINATOR = "" . $sms["ORGINATOR"] . "";
            $TUR = "Normal";
            $ZAMAN = "2014-04-07 10:00:00";
            $xmlString = "data=<sms>\r\n\t\t\t<kno>" . $_obfuscated_4D5553544552C4B04E4F_ . "</kno>\r\n\t\t\t<kulad>" . $KULLANICIADI . "</kulad>\r\n\t\t\t<sifre>" . $SIFRE . "</sifre>\r\n\t\t\t<gonderen>" . $ORGINATOR . "</gonderen>\r\n\t\t\t<mesaj>" . $aciklama . "</mesaj>\r\n\t\t\t<numaralar>" . $uyeler . "</numaralar>\r\n\t\t\t<tur>" . $TUR . "</tur>\r\n\t\t\t</sms>";
            $Veriler = $xmlString;
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $postUrl);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $Veriler);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
            curl_setopt($ch, CURLOPT_TIMEOUT, 30);
            $response = curl_exec($ch);
            curl_close($ch);
            $_SESSION["toplu_sms_gonder"] = "yes";
            header("Location:../panel/toplu-sms.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/toplu-email.html");
    }
}
if (isset($_POST["FooterMenuKaydet"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $menu_sira = $_POST["menu_sira"];
        $menu_ust = $_POST["menu_ust"];
        $menu_isim = $_POST["menu_isim"];
        $menu_url = $_POST["menu_url"];
        $link = $_POST["link"];
        if ($_POST["sekme"]) {
            $sekme = 1;
        } else {
            $sekme = 0;
        }
        $menu_durum = $_POST["menu_durum"];
        $sorgu = $db->prepare("INSERT INTO footer_menu SET\r\n\t\t\tmenu_sira \t= ?,\r\n\t\t\tmenu_ust \t= ?,\r\n\t\t\tmenu_isim \t= ?,\r\n\t\t\tmenu_url \t= ?,\r\n\t\t\tlink \t\t= ?,\r\n\t\t\tsekme \t\t= ?,\r\n\t\t\tdil \t\t= ?,\r\n\t\t\tmenu_durum \t= ?");
        $Ekle = $sorgu->execute([$menu_sira, $menu_ust, $menu_isim, $menu_url, $link, $sekme, $_SESSION["admin_dil"], $menu_durum]);
        if ($Ekle) {
            $_SESSION["FooterMenuKaydet"] = "yes";
            header("Location:../panel/footer-menu-ayar.html");
        } else {
            $_SESSION["FooterMenuKaydet"] = "no";
            header("Location:../panel/footer-menu-ayar.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/footer-menu-ayar.html");
    }
}
if (isset($_POST["FooterMenuGuncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $menu_sira = $_POST["menu_sira"];
        $menu_ust = $_POST["menu_ust"];
        $menu_isim = $_POST["menu_isim"];
        $menu_url = $_POST["menu_url"];
        $link = $_POST["link"];
        if ($_POST["sekme"]) {
            $sekme = 1;
        } else {
            $sekme = 0;
        }
        $menu_durum = $_POST["menu_durum"];
        $sorgu = $db->prepare("UPDATE footer_menu SET\r\n\t\t\t\tmenu_sira \t= ?,\r\n\t\t\t\tmenu_ust \t= ?,\r\n\t\t\t\tmenu_isim \t= ?,\r\n\t\t\t\tmenu_url \t= ?,\r\n\t\t\t\tlink \t\t= ?,\r\n\t\t\t\tsekme \t\t= ?,\r\n\t\t\t\tmenu_durum \t= ?\r\n\t\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$menu_sira, $menu_ust, $menu_isim, $menu_url, $link, $sekme, $menu_durum, $d_id]);
        if ($guncelle) {
            $_SESSION["FooterMenuGuncelle"] = "yes";
            header("Location:../panel/footermenu/duzenle/" . $d_id . ".html");
        } else {
            $_SESSION["FooterMenuGuncelle"] = "no";
            header("Location:../panel/footermenu/duzenle/" . $d_id . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/footermenu/duzenle/" . $d_id . ".html");
    }
}
if ($_GET["footermenusil"] == "ok") {
    islemkontrol();
    $id = $_GET["id"];
    if ($_SESSION["rutbe"] == 0) {
        $Sorgu = $db->prepare("DELETE FROM footer_menu WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $TopluSorgu = $db->prepare("SELECT * FROM footer_menu WHERE menu_ust = ?");
                $TopluSorgu->execute([$_GET["id"]]);
                $Topluislem = $TopluSorgu->fetchALL(PDO::FETCH_ASSOC);
                foreach ($Topluislem as $TopluSonuc) {
                    $TSorgu = $db->prepare("DELETE FROM footer_menu WHERE id = :id");
                    $TSorgu->execute(["id" => $TopluSonuc["id"]]);
                }
                $_SESSION["footermenusil"] = "yes";
                header("Location:../panel/footermenu/duzenle/" . $id . ".html");
            } else {
                $_SESSION["footermenusil"] = "no";
                header("Location:../panel/footermenu/duzenle/" . $id . ".html");
            }
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/footermenu/duzenle/" . $id . ".html");
    }
}
if ($_GET["rezervasyonsil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $url = $_GET["url"];
        $Sorgu = $db->prepare("DELETE FROM rezervasyon WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["rezervasyonsil"] = "yes";
                header("Location:" . $url . "");
            } else {
                $_SESSION["rezervasyonsil"] = "no";
                header("Location:" . $url . "");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:" . $url . "");
    }
}
if ($_GET["transfersil"] == "ok") {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $id = $_GET["id"];
        $Sorgu = $db->prepare("DELETE FROM transfer WHERE id = :id");
        $sil_sorgu = $Sorgu->execute(["id" => $id]);
        if ($Sorgu->rowCount()) {
            if ($sil_sorgu) {
                $_SESSION["transfersil"] = "yes";
                header("Location:../panel/transferler.html");
            } else {
                $_SESSION["transfersil"] = "no";
                header("Location:../panel/transferler.html");
            }
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=404.html\">";
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/transferler.html");
    }
}
if (isset($_POST["transfer_bilgileri_kaydet"])) {
    islemkontrol();
    if ($_SESSION["rutbe"] == 0) {
        $alis = $_POST["alis"];
        $varis = $_POST["varis"];
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $mesafe = $_POST["mesafe"];
        $t1_4 = $_POST["t1_4"];
        $t5_8 = $_POST["t5_8"];
        $t9_15 = $_POST["t9_15"];
        $t16_30 = $_POST["t16_30"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        $sorgu = $db->prepare("INSERT INTO transfer SET\r\n\t\t\t\talis \t= ?,\r\n\t\t\t\tvaris\t= ?,\r\n\t\t\t\tmesafe \t= ?,\r\n\t\t\t\tt1_4\t= ?,\r\n\t\t\t\tt5_8\t= ?,\r\n\t\t\t\tt9_15\t= ?,\r\n\t\t\t\tt16_30\t= ?,\r\n\t\t\t\tdurum \t= ?,\r\n\t\t\t\tdil \t= ?,\r\n\t\t\t\ttarih \t= ?");
        $Ekle = $sorgu->execute([$alis, $varis, $mesafe, $t1_4, $t5_8, $t9_15, $t16_30, $durum, $_SESSION["admin_dil"], $tarih]);
        if ($Ekle) {
            $_SESSION["transfer_bilgileri_kaydet"] = "yes";
            header("Location:../panel/transferler.html");
        } else {
            $_SESSION["transfer_bilgileri_kaydet"] = "no";
            header("Location:../panel/transfer-ekle.html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/transfer-ekle.html");
    }
}
if (isset($_POST["transfer_bilgileri_guncelle"])) {
    islemkontrol();
    $d_id = $_POST["id"];
    if ($_SESSION["rutbe"] == 0) {
        $alis = $_POST["alis"];
        $varis = $_POST["varis"];
        if ($_POST["durum"]) {
            $durum = 1;
        } else {
            $durum = 0;
        }
        $mesafe = $_POST["mesafe"];
        $t1_4 = $_POST["t1_4"];
        $t5_8 = $_POST["t5_8"];
        $t9_15 = $_POST["t9_15"];
        $t16_30 = $_POST["t16_30"];
        $tarih = date("Y-m-d H:i:s");
        $tarih = tarih($tarih);
        $sorgu = $db->prepare("UPDATE transfer SET\r\n\t\t\talis \t= ?,\r\n\t\t\tvaris\t= ?,\r\n\t\t\tmesafe \t= ?,\r\n\t\t\tt1_4\t= ?,\r\n\t\t\tt5_8\t= ?,\r\n\t\t\tt9_15\t= ?,\r\n\t\t\tt16_30\t= ?,\r\n\t\t\tdurum \t= ?,\r\n\t\t\ttarih \t= ?\r\n\t\t\tWHERE id = ?");
        $guncelle = $sorgu->execute([$alis, $varis, $mesafe, $t1_4, $t5_8, $t9_15, $t16_30, $durum, $tarih, $d_id]);
        if ($guncelle) {
            $_SESSION["transfer_bilgileri_guncelle"] = "yes";
            header("Location:../panel/transfer-duzenle/" . $d_id . ".html");
        } else {
            $_SESSION["transfer_bilgileri_guncelle"] = "no";
            header("Location:../panel/transfer-duzenle/" . $d_id . ".html");
        }
    } else {
        $_SESSION["demohesap"] = "no";
        header("Location:../panel/transfer-duzenle/" . $d_id . ".html");
    }
}
ob_end_flush();

?>