<?php


echo !defined("GUVENLIK") ? exit : NULL;
$limit = $limitayar["arac_listesi"];
$str = "";
if (isset($_GET["kategori"])) {
    $kat = implode(",", $_GET["kategori"]);
    $str .= " AND kategori IN (" . $kat . ")";
    $kategori = explode(",", $kat);
}
if ($_GET["yakit"]) {
    $ykt = implode(",", $_GET["yakit"]);
    $str .= " AND yakit IN (" . $ykt . ")";
    $yakit = explode(",", $ykt);
}
if (isset($_GET["vites"])) {
    $vts = implode(",", $_GET["vites"]);
    $str .= " AND vites IN (" . $vts . ")";
    $vites = explode(",", $vts);
}
if (isset($_GET["klima"])) {
    $klm = implode(",", $_GET["klima"]);
    $str .= " AND klima IN (" . $klm . ")";
    $klima = explode(",", $klm);
}
$ttsorgu = $db->prepare("SELECT COUNT(*) FROM araclar WHERE durum = ? AND dil = ? " . $str);
$ttsorgu->execute(["1", $_SESSION["k_dil"]]);
$total = $ttsorgu->fetchColumn();
$ARACSorgu = $db->prepare("SELECT * FROM araclar WHERE durum = ? AND dil = ? " . $str . " ORDER BY id ASC, bir_uc ASC LIMIT " . $limit);
$ARACSorgu->execute(["1", $_SESSION["k_dil"]]);
$ARACislem = $ARACSorgu->fetchALL(PDO::FETCH_ASSOC);
echo "<section class=\"site-content\">\t\r\n    <div class=\"page-content\">\r\n        <div class=\"container\">\r\n            <div class=\"row\">\r\n                <div class=\"col-md-4 col-sm-5 col-xs-12 pull-right\">\r\n                    <div class=\"page-sidebar\">\r\n\t\t\t\t\t\t<form action=\"\" method=\"GET\" autocomplete=\"off\">\r\n\t\t\t\t\t\t\t<div class=\"widget widget-filter\">\r\n\t\t\t\t\t\t\t\t<div class=\"widget-head\"><span><i class=\"fa fa-filter\"></i> ";
echo $dil["sonuc_filtre"];
echo "</span></div>\r\n\t\t\t\t\t\t\t\t<div class=\"widget-body\">\r\n\t\t\t\t\t\t\t\t\t<div class=\"filter-list\">\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"list-head\"><span><i class=\"fa fa-car\"></i> ";
echo $dil["arac_sinifi"];
echo "</span></div>\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"list-body\">\r\n\t\t\t\t\t\t\t\t\t\t";
$KATSorgu = $db->prepare("SELECT * FROM kategori WHERE durum = ? AND dil = ? ORDER BY id ASC");
$KATSorgu->execute(["1", $_SESSION["k_dil"]]);
$KATislem = $KATSorgu->fetchALL(PDO::FETCH_ASSOC);
echo "\t\t\t\t\t\t\t\t\t\t\t";
foreach ($KATislem as $KATSonuc) {
    echo "\t\t\t\t\t\t\t\t\t\t\t<div class=\"checkbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"kategori[]\" ";
    echo in_array($KATSonuc["id"], $kategori) ? "checked" : "";
    echo " value=\"";
    echo $KATSonuc["id"];
    echo "\" /><span>";
    echo $KATSonuc["adi"];
    echo "</span>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t";
}
echo "\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t<div class=\"filter-list\">\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"list-head\"><span><i class=\"fa fa-tachometer\"></i> ";
echo $dil["vites_turu"];
echo "</span></div>\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"list-body\">\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"checkbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"vites[]\" value=\"1\" ";
echo in_array("1", $vites) ? "checked" : "";
echo " /><span>";
echo $dil["manuel_vites"];
echo "</span>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"checkbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"vites[]\" value=\"2\" ";
echo in_array("2", $vites) ? "checked" : "";
echo " /><span>";
echo $dil["otomatik_vites"];
echo "</span>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"checkbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"vites[]\" value=\"3\" ";
echo in_array("3", $vites) ? "checked" : "";
echo " /><span>";
echo $dil["triptonik"];
echo "</span>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t<div class=\"filter-list\">\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"list-head\"><span><i class=\"fa fa-battery-three-quarters\"></i> ";
echo $dil["yakit_turu"];
echo "</span></div>\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"list-body\">\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"checkbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input name=\"yakit[]\" type=\"checkbox\" value=\"1\" ";
echo in_array("1", $yakit) ? "checked" : "";
echo " /><span>";
echo $dil["dizel"];
echo "</span>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"checkbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input name=\"yakit[]\" type=\"checkbox\" value=\"2\" ";
echo in_array("2", $yakit) ? "checked" : "";
echo " /><span>";
echo $dil["benzin"];
echo "</span>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"checkbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input name=\"yakit[]\" type=\"checkbox\" value=\"3\" ";
echo in_array("3", $yakit) ? "checked" : "";
echo " /><span>";
echo $dil["lpg"];
echo "</span>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t<div class=\"filter-list\">\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"list-head\"><span><i class=\"fa fa-recycle\"></i> ";
echo $dil["klima_turu"];
echo "</span></div>\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"list-body\">\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"checkbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input name=\"klima[]\" type=\"checkbox\" ";
echo in_array("1", $klima) ? "checked" : "";
echo " value=\"1\" /><span>";
echo $dil["dijital"];
echo "</span>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"checkbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input name=\"klima[]\" type=\"checkbox\" ";
echo in_array("2", $klima) ? "checked" : "";
echo " value=\"2\" /><span>";
echo $dil["analog"];
echo "</span>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"checkbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input name=\"klima[]\" type=\"checkbox\" ";
echo in_array("3", $klima) ? "checked" : "";
echo " value=\"3\" /><span>";
echo $dil["yok"];
echo "</span>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t<button type=\"submit\" class=\"btn btn-primary-o\" style=\"width:100%\" /><i class=\"fa fa-search\"></i> ";
echo $dil["listele"];
echo "</button>\r\n\t\t\t\t\t\t</form>\r\n                    </div>\r\n                </div>\r\n                <div class=\"col-md-8 col-sm-6 col-xs-12\">\r\n                    <div class=\"car-list-page\">\r\n                        <div class=\"row\" id=\"row\">\r\n\t\t\t\t\t\t";
if ($ARACSorgu->rowCount() != "0") {
    echo "\t\t\t\t\t\t\t";
    foreach ($ARACislem as $ARACSonuc) {
        echo "\t\t\t\t\t\t\t";
        $kategoriler = $db->query("SELECT * FROM kategori WHERE durum = '1' AND id='" . $ARACSonuc["kategori"] . "' AND dil = '" . $_SESSION["k_dil"] . "'")->fetch(PDO::FETCH_ASSOC);
        echo "                            <div class=\"col-md-12\">\r\n                                <div class=\"item\" id=\"";
        echo $ARACSonuc["id"];
        echo "\">\r\n\t\t\t\t\t\t\t\t\t";
        if ($ARACSonuc["yeni"] == 1) {
            echo "<div class='new-box'><span>";
            echo $dil["yeni"];
            echo "</span></div>";
        }
        echo "                                    <div class=\"row\">\r\n                                        <div class=\"col-md-6\">\r\n                                            <div class=\"price-box\"><span class=\"price-value\">";
        echo para_birim();
        echo intval($ARACSonuc["bir_uc"]);
        echo " </span><span class=\"price-text\"><b>/</b> ";
        echo $dil["gun"];
        echo "</span></div>\r\n                                            <div class=\"image-box\"><img src=\"";
        echo TEMA;
        echo "/uploads/araclar/";
        echo $ARACSonuc["resim"];
        echo "\"></div>\r\n                                        </div>\r\n                                        <div class=\"col-md-6\">\r\n                                            <div class=\"car-info\">\r\n                                                <div class=\"car-name\">";
        echo $ARACSonuc["adi"];
        echo " <span></span></div>\r\n                                                <div class=\"car-class\"> ";
        echo $kategoriler["adi"];
        echo " </div>\r\n                                            </div>\r\n                                            <div class=\"car-option-list\">\r\n                                                <ul>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<li><i class=\"fa fa-battery-three-quarters\"></i><span>";
        if ($ARACSonuc["yakit"] == 1) {
            echo "Dizel";
        }
        if ($ARACSonuc["yakit"] == 2) {
            echo "Benzin";
        }
        if ($ARACSonuc["yakit"] == 3) {
            echo "Lpg";
        }
        echo "</span></li>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<li><i class=\"fa fa-tachometer\"></i><span>";
        if ($ARACSonuc["vites"] == 1) {
            echo "Manuel";
        }
        if ($ARACSonuc["vites"] == 2) {
            echo "Otomatik";
        }
        if ($ARACSonuc["vites"] == 3) {
            echo "Triptonik";
        }
        echo "</span></li>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<li><i class=\"fa fa-recycle\"></i><span>";
        if ($ARACSonuc["klima"] == 1) {
            echo "Dijital";
        }
        if ($ARACSonuc["klima"] == 2) {
            echo "Analog";
        }
        if ($ARACSonuc["klima"] == 3) {
            echo "Yok";
        }
        echo "</span></li>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<li><i class=\"fa fa-suitcase\"></i><span>";
        echo $ARACSonuc["bagaj"];
        echo " ";
        echo $dil["lt"];
        echo "</span></li>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ul>\r\n                                            </div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"fiyatliste hidden-xs hidden-sm\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"fiyatlisteborder\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"fiyatlistehizala\"> \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"gunlukfiyatlar\">1-3 ";
        echo $dil["gun"];
        echo "<em> ";
        echo para_birim();
        echo " ";
        echo intval($ARACSonuc["bir_uc"]);
        echo "</em></span> \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"gunlukfiyatlar\">4-7 ";
        echo $dil["gun"];
        echo "<em> ";
        echo para_birim();
        echo " ";
        echo intval($ARACSonuc["dort_yedi"]);
        echo "</em></span> \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"gunlukfiyatlar\">8-15 ";
        echo $dil["gun"];
        echo "<em> ";
        echo para_birim();
        echo " ";
        echo intval($ARACSonuc["sekiz_onbes"]);
        echo "</em></span> \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"gunlukfiyatlar\">16-21 ";
        echo $dil["gun"];
        echo "<em> ";
        echo para_birim();
        echo " ";
        echo intval($ARACSonuc["onalti_yirmibir"]);
        echo "</em></span> \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"gunlukfiyatlar\">22-28 ";
        echo $dil["gun"];
        echo "<em> ";
        echo para_birim();
        echo " ";
        echo intval($ARACSonuc["yirmiiki_yirmisekiz"]);
        echo "</em></span> \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"gunlukfiyatlar\">29-99 ";
        echo $dil["gun"];
        echo "<em> ";
        echo para_birim();
        echo " ";
        echo intval($ARACSonuc["yirmidokuz_doksandokuz"]);
        echo "</em></span> \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n                                            <div class=\"action-btn\">\r\n                                                <a href=\"arac/";
        echo $ARACSonuc["seo"];
        echo ".html\" class=\"btn btn-primary-o\"><i class=\"fa fa-external-link\" aria-hidden=\"true\"></i>  ";
        echo $dil["incele"];
        echo "</a>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n                                        </div>\r\n                                    </div>\r\n                                </div>\r\n                            </div>\r\n\t\t\t\t\t\t\t";
    }
    echo "\t\t\t\t\t\t\t";
} else {
    echo "\t\r\n\t\t\t\t\t\t\t<div class=\"well\" style=\"margin-bottom: 30px;\"><b>";
    echo $dil["uzgunuz"];
    echo "</b>\r\n\t\t\t\t\t\t\t\t<br>";
    echo $dil["kayit_bulunamadi"];
    echo "\t\t\t\t\t\t\t\t<br>\r\n\t\t\t\t\t\t\t\t<br>\r\n\t\t\t\t\t\t\t\t<button type=\"button\" class=\"btn btn-primary margin-top-10\" onclick=\"window.history.back();\">";
    echo $dil["onceki_sayfaya_don"];
    echo "</button>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t";
}
echo "                           \r\n                        </div>\r\n                    </div>\r\n\t\t\t\t\t";
if ($limitayar["arac_listesi"] < $total) {
    echo "\t\t\t\t\t<div class=\"show-more daha\">\r\n\t\t\t\t\t\t<div style=\"display:none;min-width: 220px;height: 40px;padding: 0;position: relative;background: #fff;border-color: #dddddd;\"><img src=\"";
    echo TEMA;
    echo "/images/yukleniyor.gif\" /></div>\r\n\t\t\t\t\t\t<button class=\"btn btn-primary-o\">";
    echo $dil["daha_fazla"];
    echo "</button>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t";
}
echo "                </div>\t\t\t\t\t\r\n            </div>\r\n        </div>\r\n    </div>\r\n</section>\r\n<script type=\"text/javascript\">\r\n\$(function(){\r\n\t\$(\".daha\").click(function(){\r\n\t\tvar id = \$(\".car-list-page .item:last\").attr(\"id\");\r\n\t\tvar t = \$(this);\r\n\t\t\$(\"button\", this).hide();\r\n\t\t\$(\"div\", this).show();\r\n\t\t\$.ajax({\r\n\t\t\ttype:\"POST\",\r\n\t\t\turl: \"";
echo TEMA;
echo "/ajax/arac_listesi.php\",\r\n\t\t\tdata: {\"id\":id},\r\n\t\t\tsuccess: function(cevap){\r\n\t\t\t\tif(cevap == \"yok\")\r\n\t\t\t\t{\r\n\t\t\t\t\tswal({\r\n\t\t\t\t\t\ttype: 'warning',\r\n\t\t\t\t\t\ttitle: '";
echo $dil["uyari"];
echo "',\r\n\t\t\t\t\t\ttext: '";
echo $dil["daha_fazla_veri_kalmadi"];
echo "',\r\n\t\t\t\t\t\tconfirmButtonText: '";
echo $dil["tamam"];
echo "',\r\n\t\t\t\t\t\ttimer: 5000\r\n\t\t\t\t\t})\r\n\t\t\t\t\t\$(\".daha\").remove();\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t\$(\".car-list-page #row\").append(cevap);\r\n\t\t\t\t\t\$(\"div\", t).hide();\r\n\t\t\t\t\t\$(\"button\", t).show();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\t});\r\n});\r\n</script>";

?>