LiteSpeed Linux server2.poyrazhosting.com 3.10.0-962.3.2.lve1.5.77.el7.x86_64 #1 SMP Mon Dec 12 07:06:14 EST 2022 x86_64 safemode : OFF MySQL: OFF | Perl: OFF | cURL: ON | WGet: OFF > / home / cuneytsener53 / public_html / | Server Ip : 172.67.216.244 |
Filename | /home/cuneytsener53/public_html/urunler3.php |
Size | 10.68 kb |
Permission | rw-r--r-- |
Owner | |
Create time | 03-Mar-2025 07:07 |
Last modified | 12-Dec-2024 12:27 |
Last accessed | 29-Mar-2025 23:21 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
require 'include/header.php';
// Kategori ve Arama Parametreleri
$kategori = htmlspecialchars(trim(@$_GET['kategori_id']));
$arama = isset($_GET['arama']) ? htmlspecialchars(trim($_GET['arama'])) : '';
// Meta Bilgileri Ayarlama
if (!empty($kategori)) {
$kategoriedit = $db->prepare("SELECT * FROM kategoriler WHERE kategori_id=:kategori_id");
$kategoriedit->execute(array(
'kategori_id' => $kategori
));
$kategoriwrite = $kategoriedit->fetch(PDO::FETCH_ASSOC);
$meta = [
'title' => $kategoriwrite['kategori_title'],
'keywords' => $kategoriwrite['kategori_keyword'],
'description' => $kategoriwrite['kategori_descr']
];
} else {
$metakey = $db->prepare("SELECT * FROM meta WHERE meta_id=1");
$metakey->execute();
$metakeyprint = $metakey->fetch(PDO::FETCH_ASSOC);
$meta = [
'title' => $metakeyprint['meta_title'],
'keywords' => $metakeyprint['meta_keyword'],
'description' => $metakeyprint['meta_descr']
];
}
require 'include/menu.php';
// Sayfalama Ayarları
$sayfada = 9; // Sayfada gösterilecek içerik miktarı
$sayfa = isset($_GET['sayfa']) ? (int) $_GET['sayfa'] : 1;
if ($sayfa < 1) $sayfa = 1;
// SQL Sorgusu ve Arama Özelliği
$limit = ($sayfa - 1) * $sayfada;
// Toplam Ürün Sayısını Hesaplama
if (!empty($arama)) {
if (!empty($kategori)) {
$toplamSorgu = $db->prepare("SELECT COUNT(*) as toplam FROM urunler WHERE urun_paket='0' AND urun_kategori=:kategori AND urun_baslik LIKE :arama");
$toplamSorgu->execute(array(
'kategori' => $kategori,
'arama' => '%' . $arama . '%'
));
} else {
$toplamSorgu = $db->prepare("SELECT COUNT(*) as toplam FROM urunler WHERE urun_paket='0' AND urun_baslik LIKE :arama");
$toplamSorgu->execute(array(
'arama' => '%' . $arama . '%'
));
}
} else {
if (!empty($kategori)) {
$toplamSorgu = $db->prepare("SELECT COUNT(*) as toplam FROM urunler WHERE urun_paket='0' AND urun_kategori=:kategori");
$toplamSorgu->execute(array(
'kategori' => $kategori
));
} else {
$toplamSorgu = $db->prepare("SELECT COUNT(*) as toplam FROM urunler WHERE urun_paket='0'");
$toplamSorgu->execute();
}
}
$toplamSonuc = $toplamSorgu->fetch(PDO::FETCH_ASSOC);
$toplam_icerik = $toplamSonuc['toplam'];
$toplam_sayfa = ceil($toplam_icerik / $sayfada);
if ($sayfa > $toplam_sayfa) $sayfa = $toplam_sayfa;
// Ürünleri Listeleme
if (!empty($arama)) {
if (!empty($kategori)) {
$blog = $db->prepare("SELECT * FROM urunler WHERE urun_paket='0' AND urun_kategori=:kategori AND urun_baslik LIKE :arama ORDER BY urun_id DESC LIMIT $limit, $sayfada");
$blog->execute(array(
'kategori' => $kategori,
'arama' => '%' . $arama . '%'
));
} else {
$blog = $db->prepare("SELECT * FROM urunler WHERE urun_paket='0' AND urun_baslik LIKE :arama ORDER BY urun_id DESC LIMIT $limit, $sayfada");
$blog->execute(array(
'arama' => '%' . $arama . '%'
));
}
} else {
if (!empty($kategori)) {
$blog = $db->prepare("SELECT * FROM urunler WHERE urun_paket='0' AND urun_kategori=:kategori ORDER BY urun_id DESC LIMIT $limit, $sayfada");
$blog->execute(array(
'kategori' => $kategori
));
} else {
$blog = $db->prepare("SELECT * FROM urunler WHERE urun_paket='0' ORDER BY urun_id DESC LIMIT $limit, $sayfada");
$blog->execute();
}
}
?>
<div id="content" class="site-content">
<div class="page-header dtable text-center" style="background-image: url(admin/<?php echo $settingsprint['resim_title']; ?>);">
<div class="dcell">
<div class="container">
<h1 class="page-title">
<?php if (empty($kategori)) { ?>
Ürünler
<?php } else { ?>
<a class="text-dark" href="<?= seo('konu-kategori-' . $kategoriwrite["kategori_ad"]) . '-' . $kategoriwrite["kategori_id"] ?>">
<?php echo $kategoriwrite['kategori_ad']; ?>
</a>
<?php } ?>
</h1>
<form method="GET" action="" style="margin-bottom: 20px;">
<input type="text" name="arama" id="arama" class="form-control" placeholder="Ürün ara..." value="<?php echo $arama; ?>" style="display: inline-block; width: 80%; margin-right: 10px;">
</form>
</div>
</div>
</div>
<section class="woocommerce particles-js m-t100">
<div class="container">
<div class="row">
<div class="col-md-9 col-xs-12">
<main id="main" class="site-main">
<ul class="products columns-3" id="urunSonuclari">
<?php
$urunSiralama = 0;
foreach ($blog as $uruncek) {
if ($urunSiralama == 3) { $urunSiralama = 0; }
$urunSiralama++;
$resimsor = $db->prepare("SELECT * FROM resim WHERE resim_urun=:resim_urun LIMIT 1");
$resimsor->execute(array(
'resim_urun' => $uruncek['urun_id']
));
?>
<li class="product <?php if ($urunSiralama == 1) echo "first"; elseif ($urunSiralama == 3) echo "last"; ?>">
<div class="product-media">
<?php while ($resimcek = $resimsor->fetch(PDO::FETCH_ASSOC)) { ?>
<img src="admin/<?php echo $resimcek['resim_link']; ?>" alt="<?php echo $uruncek['urun_baslik']; ?>">
<?php } ?>
<div class="wrapper-add-to-cart">
<div class="add-to-cart-inner">
<a target="_blank" href="<?php echo $uruncek['urun_demo']; ?>" style="margin-bottom: 15px;" class="button product_type_simple add_to_cart_button ajax_add_to_cart octf-btn octf-btn-primary octf-btn-icon">Demo Göster <i class="fas fa-link"></i></a>
<a href="<?=seo('detay-' . $uruncek["urun_baslik"]) . '-' . $uruncek["urun_id"]?>" class="button product_type_simple add_to_cart_button ajax_add_to_cart octf-btn octf-btn-primary octf-btn-icon">Ürün Detayı <i class="fas fa-angle-double-right"></i></a>
</div>
</div>
</div>
<h2 class="woocommerce-loop-product__title">
<a href="<?=seo('detay-' . $uruncek["urun_baslik"]) . '-' . $uruncek["urun_id"]?>">
<?php
$urunkarakter = strlen($uruncek['urun_baslik']);
if ($urunkarakter > 30) {
echo mb_substr($uruncek['urun_baslik'], 0, 30, 'UTF-8') . '...';
} else {
echo $uruncek['urun_baslik'];
}
?>
</a>
</h2>
<span class="price">
<span class="woocommerce-Price-amount amount">
<span class="woocommerce-Price-currencySymbol"><i class="fas fa-lira-sign"></i></span>
<?php echo $uruncek['urun_fiyat']; ?>
</span>
</span>
</li>
<?php } ?>
</ul>
</main>
<!-- Sayfalama -->
<div class="row">
<div class="col-md-12">
<ul class="page-pagination text-center p-b60">
<?php
$gosterilecekbuton = 3;
if ($sayfa > 1) { ?>
<li><a class="next page-numbers" href="?sayfa=<?php echo $sayfa - 1; ?>&arama=<?php echo $arama; ?>"><i class="flaticon-arrow-pointing-to-left"></i></a></li>
<?php }
for ($i = $sayfa - $gosterilecekbuton; $i < $sayfa + $gosterilecekbuton + 1; $i++) {
if ($i > 0 && $i <= $toplam_sayfa) {
if ($i == $sayfa) { ?>
<li><span aria-current="page" class="page-numbers current"><?php echo $i; ?></span></li>
<?php } else { ?>
<li><a class="page-numbers" href="?sayfa=<?php echo $i; ?>&arama=<?php echo $arama; ?>"><?php echo $i; ?></a></li>
<?php }
}
}
if ($sayfa != $toplam_sayfa) { ?>
<li><a class="next page-numbers" href="?sayfa=<?php echo $sayfa + 1; ?>&arama=<?php echo $arama; ?>"><i class="flaticon-arrow-pointing-to-right"></i></a></li>
<?php } ?>
</ul>
</div>
</div>
</div>
<?php include 'include/sidebar-pr.php'; ?>
</div>
</div>
</section>
</div>
<script>
document.getElementById("arama").addEventListener("input", function () {
const aramaKelimesi = this.value;
const xhr = new XMLHttpRequest();
xhr.open("GET", "ajax_urunler.php?arama=" + encodeURIComponent(aramaKelimesi), true);
xhr.onload = function () {
if (xhr.status === 200) {
document.getElementById("urunSonuclari").innerHTML = xhr.responseText;
}
};
xhr.send();
});
</script>
<?php include 'include/footer.php'; ?>
require 'include/header.php';
// Kategori ve Arama Parametreleri
$kategori = htmlspecialchars(trim(@$_GET['kategori_id']));
$arama = isset($_GET['arama']) ? htmlspecialchars(trim($_GET['arama'])) : '';
// Meta Bilgileri Ayarlama
if (!empty($kategori)) {
$kategoriedit = $db->prepare("SELECT * FROM kategoriler WHERE kategori_id=:kategori_id");
$kategoriedit->execute(array(
'kategori_id' => $kategori
));
$kategoriwrite = $kategoriedit->fetch(PDO::FETCH_ASSOC);
$meta = [
'title' => $kategoriwrite['kategori_title'],
'keywords' => $kategoriwrite['kategori_keyword'],
'description' => $kategoriwrite['kategori_descr']
];
} else {
$metakey = $db->prepare("SELECT * FROM meta WHERE meta_id=1");
$metakey->execute();
$metakeyprint = $metakey->fetch(PDO::FETCH_ASSOC);
$meta = [
'title' => $metakeyprint['meta_title'],
'keywords' => $metakeyprint['meta_keyword'],
'description' => $metakeyprint['meta_descr']
];
}
require 'include/menu.php';
// Sayfalama Ayarları
$sayfada = 9; // Sayfada gösterilecek içerik miktarı
$sayfa = isset($_GET['sayfa']) ? (int) $_GET['sayfa'] : 1;
if ($sayfa < 1) $sayfa = 1;
// SQL Sorgusu ve Arama Özelliği
$limit = ($sayfa - 1) * $sayfada;
// Toplam Ürün Sayısını Hesaplama
if (!empty($arama)) {
if (!empty($kategori)) {
$toplamSorgu = $db->prepare("SELECT COUNT(*) as toplam FROM urunler WHERE urun_paket='0' AND urun_kategori=:kategori AND urun_baslik LIKE :arama");
$toplamSorgu->execute(array(
'kategori' => $kategori,
'arama' => '%' . $arama . '%'
));
} else {
$toplamSorgu = $db->prepare("SELECT COUNT(*) as toplam FROM urunler WHERE urun_paket='0' AND urun_baslik LIKE :arama");
$toplamSorgu->execute(array(
'arama' => '%' . $arama . '%'
));
}
} else {
if (!empty($kategori)) {
$toplamSorgu = $db->prepare("SELECT COUNT(*) as toplam FROM urunler WHERE urun_paket='0' AND urun_kategori=:kategori");
$toplamSorgu->execute(array(
'kategori' => $kategori
));
} else {
$toplamSorgu = $db->prepare("SELECT COUNT(*) as toplam FROM urunler WHERE urun_paket='0'");
$toplamSorgu->execute();
}
}
$toplamSonuc = $toplamSorgu->fetch(PDO::FETCH_ASSOC);
$toplam_icerik = $toplamSonuc['toplam'];
$toplam_sayfa = ceil($toplam_icerik / $sayfada);
if ($sayfa > $toplam_sayfa) $sayfa = $toplam_sayfa;
// Ürünleri Listeleme
if (!empty($arama)) {
if (!empty($kategori)) {
$blog = $db->prepare("SELECT * FROM urunler WHERE urun_paket='0' AND urun_kategori=:kategori AND urun_baslik LIKE :arama ORDER BY urun_id DESC LIMIT $limit, $sayfada");
$blog->execute(array(
'kategori' => $kategori,
'arama' => '%' . $arama . '%'
));
} else {
$blog = $db->prepare("SELECT * FROM urunler WHERE urun_paket='0' AND urun_baslik LIKE :arama ORDER BY urun_id DESC LIMIT $limit, $sayfada");
$blog->execute(array(
'arama' => '%' . $arama . '%'
));
}
} else {
if (!empty($kategori)) {
$blog = $db->prepare("SELECT * FROM urunler WHERE urun_paket='0' AND urun_kategori=:kategori ORDER BY urun_id DESC LIMIT $limit, $sayfada");
$blog->execute(array(
'kategori' => $kategori
));
} else {
$blog = $db->prepare("SELECT * FROM urunler WHERE urun_paket='0' ORDER BY urun_id DESC LIMIT $limit, $sayfada");
$blog->execute();
}
}
?>
<div id="content" class="site-content">
<div class="page-header dtable text-center" style="background-image: url(admin/<?php echo $settingsprint['resim_title']; ?>);">
<div class="dcell">
<div class="container">
<h1 class="page-title">
<?php if (empty($kategori)) { ?>
Ürünler
<?php } else { ?>
<a class="text-dark" href="<?= seo('konu-kategori-' . $kategoriwrite["kategori_ad"]) . '-' . $kategoriwrite["kategori_id"] ?>">
<?php echo $kategoriwrite['kategori_ad']; ?>
</a>
<?php } ?>
</h1>
<form method="GET" action="" style="margin-bottom: 20px;">
<input type="text" name="arama" id="arama" class="form-control" placeholder="Ürün ara..." value="<?php echo $arama; ?>" style="display: inline-block; width: 80%; margin-right: 10px;">
</form>
</div>
</div>
</div>
<section class="woocommerce particles-js m-t100">
<div class="container">
<div class="row">
<div class="col-md-9 col-xs-12">
<main id="main" class="site-main">
<ul class="products columns-3" id="urunSonuclari">
<?php
$urunSiralama = 0;
foreach ($blog as $uruncek) {
if ($urunSiralama == 3) { $urunSiralama = 0; }
$urunSiralama++;
$resimsor = $db->prepare("SELECT * FROM resim WHERE resim_urun=:resim_urun LIMIT 1");
$resimsor->execute(array(
'resim_urun' => $uruncek['urun_id']
));
?>
<li class="product <?php if ($urunSiralama == 1) echo "first"; elseif ($urunSiralama == 3) echo "last"; ?>">
<div class="product-media">
<?php while ($resimcek = $resimsor->fetch(PDO::FETCH_ASSOC)) { ?>
<img src="admin/<?php echo $resimcek['resim_link']; ?>" alt="<?php echo $uruncek['urun_baslik']; ?>">
<?php } ?>
<div class="wrapper-add-to-cart">
<div class="add-to-cart-inner">
<a target="_blank" href="<?php echo $uruncek['urun_demo']; ?>" style="margin-bottom: 15px;" class="button product_type_simple add_to_cart_button ajax_add_to_cart octf-btn octf-btn-primary octf-btn-icon">Demo Göster <i class="fas fa-link"></i></a>
<a href="<?=seo('detay-' . $uruncek["urun_baslik"]) . '-' . $uruncek["urun_id"]?>" class="button product_type_simple add_to_cart_button ajax_add_to_cart octf-btn octf-btn-primary octf-btn-icon">Ürün Detayı <i class="fas fa-angle-double-right"></i></a>
</div>
</div>
</div>
<h2 class="woocommerce-loop-product__title">
<a href="<?=seo('detay-' . $uruncek["urun_baslik"]) . '-' . $uruncek["urun_id"]?>">
<?php
$urunkarakter = strlen($uruncek['urun_baslik']);
if ($urunkarakter > 30) {
echo mb_substr($uruncek['urun_baslik'], 0, 30, 'UTF-8') . '...';
} else {
echo $uruncek['urun_baslik'];
}
?>
</a>
</h2>
<span class="price">
<span class="woocommerce-Price-amount amount">
<span class="woocommerce-Price-currencySymbol"><i class="fas fa-lira-sign"></i></span>
<?php echo $uruncek['urun_fiyat']; ?>
</span>
</span>
</li>
<?php } ?>
</ul>
</main>
<!-- Sayfalama -->
<div class="row">
<div class="col-md-12">
<ul class="page-pagination text-center p-b60">
<?php
$gosterilecekbuton = 3;
if ($sayfa > 1) { ?>
<li><a class="next page-numbers" href="?sayfa=<?php echo $sayfa - 1; ?>&arama=<?php echo $arama; ?>"><i class="flaticon-arrow-pointing-to-left"></i></a></li>
<?php }
for ($i = $sayfa - $gosterilecekbuton; $i < $sayfa + $gosterilecekbuton + 1; $i++) {
if ($i > 0 && $i <= $toplam_sayfa) {
if ($i == $sayfa) { ?>
<li><span aria-current="page" class="page-numbers current"><?php echo $i; ?></span></li>
<?php } else { ?>
<li><a class="page-numbers" href="?sayfa=<?php echo $i; ?>&arama=<?php echo $arama; ?>"><?php echo $i; ?></a></li>
<?php }
}
}
if ($sayfa != $toplam_sayfa) { ?>
<li><a class="next page-numbers" href="?sayfa=<?php echo $sayfa + 1; ?>&arama=<?php echo $arama; ?>"><i class="flaticon-arrow-pointing-to-right"></i></a></li>
<?php } ?>
</ul>
</div>
</div>
</div>
<?php include 'include/sidebar-pr.php'; ?>
</div>
</div>
</section>
</div>
<script>
document.getElementById("arama").addEventListener("input", function () {
const aramaKelimesi = this.value;
const xhr = new XMLHttpRequest();
xhr.open("GET", "ajax_urunler.php?arama=" + encodeURIComponent(aramaKelimesi), true);
xhr.onload = function () {
if (xhr.status === 200) {
document.getElementById("urunSonuclari").innerHTML = xhr.responseText;
}
};
xhr.send();
});
</script>
<?php include 'include/footer.php'; ?>