📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
esnafbul.demodesign.com.tr
📝
galeri.php
← Geri Dön
<?php include "includes/header.php"; $firmaid = $_GET['firmaid']; $uyeid = $_GET['uyeid']; $uyesor=$db->prepare("SELECT * FROM uyeler where id=:id"); $uyesor->execute(array('id' => $_SESSION['id'])); $uyecek=$uyesor->fetch(PDO::FETCH_ASSOC); $firmasor=$db->prepare("SELECT * FROM uyefirma where id=:id"); $firmasor->execute(array('id' => $firmaid)); $firmacek=$firmasor->fetch(PDO::FETCH_ASSOC); ?> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> <?php $ListeCekGaleri = $db ->prepare("select * from uyefirma where id='$firmaid'"); $ListeCekGaleri ->execute(); $row = $ListeCekGaleri->fetch(PDO::FETCH_ASSOC); $projeGaleriCek = $db ->prepare("select * from firmagaleri where firma_id='$firmaid' order by sira asc "); $projeGaleriCek ->execute(); $foto = $projeGaleriCek->fetch(PDO::FETCH_ASSOC); $fotolar = $db ->prepare("select * from firmagaleri where firma_id='$firmaid' order by sira asc "); $fotolar ->execute(); ?> <?php if(empty($_SESSION['oturum'])) { header("Location:index.html"); } ?> <title>Galeri (<?=$firmacek['firmaismi']?>)</title> <!-- Banner --> <div class="section-space--sm bg-neutral-900"> <div class="container"> <div class="row g-4 align-items-center"> <div class="col-md-6"> <h1 class="d4 clr-neutral-0 mb-3"> Galeri (<?=$firmacek['firmaismi']?>)</h1> <ul class="list list-row list-arrow align-items-center"> <li> <a href="#" class="link d-inline-block clr-neutral-0 :clr-tertiary-300"> Anasayfa </a> </li> <li> <a href="#" class="link d-inline-block clr-tertiary-300"> Galeri (<?=$firmacek['firmaismi']?>) </a> </li> </ul> </div> <div class="col-md-6"> <div class="text-md-end"> <a href="cikis.php" class="link d-inline-flex align-items-center gap-2 py-3 px-6 rounded-pill bg-neutral-700 :bg-primary-300"> <span class="material-symbols-outlined mat-icon clr-neutral-0"> logout </span> <span class="d-inline-block clr-neutral-0 fw-semibold"> Çıkış Yap </span> </a> </div> </div> </div> </div> </div> <!-- /Banner --> <!-- Dashboard --> <div class="section-space--sm pt-0 position-relative z-1"> <span class="w-100 h-30 position-absolute start-0 end-0 top-0 z-n1 bg-neutral-900"></span> <div class="container"> <div class="row g-4"> <?php include "includes/sidebar.php"; ?> <div class="col-md-7 col-lg-8 col-xl-9"> <div class="p-6 p-xl-10 rounded-4 bg-neutral-0 shadow-3"> <div class="d-flex flex-wrap justify-content-between align-items-center gap-4"> <h3 class="mb-0 flex-grow-1"> Galeri <span style="color: #0d6efd">(<?=$firmacek['firmaismi']?>)</span> </h3> </div> <div class="hr-line my-6"></div> <form action="" method="post" enctype='multipart/form-data'> <input type="hidden" name="firma_id" value="<?=$row['id']?>"> <input type="hidden" name="uye_id" value="<?=$uyeid?>"> <div class="file-drop-area"> <span class="fake-btn"><i class="fa fa-photo"></i> Fotoğrafları Seçin</span> <span class="file-msg">ya da dosyaları sürükleyip buraya bırakın</span> <input class="file-input" name='gorsel[]' type="file" required multiple> </div> <button class="btn btn-success" name="topluresimyukle" type="submit" style="color: white;margin-top: 20px;margin-bottom: 20px"><i class="fa fa-upload" style="margin-right: 5px"></i> YÜKLE</button> </form> <div class="card"> <div class="card-body" style="padding: 15px !important; "> <?php if ($projeGaleriCek->rowCount() > 0) {?> <table class="table table-bordered table-striped" style="font-family: 'Open Sans', Arial; font-size:15px; font-weight: 500"> <tbody class="row_position"> <?php foreach ($fotolar as $galeri) { ?> <tr id="<?=$galeri['id']?>"> <td width="200" height="60" style="text-align: center;" ><?php echo $galeri['sira'] ?></td> <td style="cursor: all-scroll"> <div id="<?=$galeri['id']?>" class="degisken" style="margin: 10px; display: inline-block !important;"> <div class="btn btn-sm btn-danger" style="position: absolute; margin: 5px 0 0 5px; padding: 0!important;"> <a onclick="deletebutton('<?=$galeri['id']?>','<?=$row['id']?>')" class="btn btn-sm btn-danger" style="color:#FFF; "> <i class="fa fa-times"></i> </a> </div> <img src="images/gallery/<?=$galeri['gorsel']?>" style="width: 185px; height: 130px; border:1px solid #EBEBEB;object-fit: cover"> </div> </td> </tr> <?php } ?> </tbody> </table> <?php } else {?> <div class="alert alert-danger text-center" style="font-weight: 400; margin-top: 15px;"> Galeriye Hiç Fotoğraf Eklenmemiş! </div> <?php }?> </div> </div> </div> </div> </div> </div> </div> <!-- /Dashboard --> <?php if (isset($_POST['topluresimyukle'])) { $errors = array(); foreach ($_FILES['gorsel']['tmp_name'] as $key => $tmp_name) { $random = rand(0, 9999999999999); $file_name = $key . $random . $_FILES['gorsel']['name'][$key]; $file_size = $_FILES['gorsel']['size'][$key]; $file_tmp = $_FILES['gorsel']['tmp_name'][$key]; $file_type = $_FILES['gorsel']['type'][$key]; if ($file_size <= 0) { Header("location: galeri?firmaid=$firmaid&uyeid=$uyeid&status=nofile"); } else { if ($file_type == 'image/jpg' || $file_type == 'image/jpeg' || $file_type == 'image/png') { $kaydet = $db->prepare("INSERT INTO firmagaleri SET gorsel=:gorsel, firma_id=:firma_id, uye_id=:uye_id, sira=:sira "); $ekle = $kaydet->execute(array( 'gorsel' => $file_name, 'firma_id' => $_POST['firma_id'], 'uye_id' => $_POST['uye_id'], 'sira' => $key )); $desired_dir = "images/gallery"; if (empty($errors) == true) { if (is_dir($desired_dir) == false) { mkdir("$desired_dir", 0700); // Create directory if it does not exist } if (is_dir("$desired_dir/" . $file_name) == false) { move_uploaded_file($file_tmp, "$desired_dir/" . $file_name); } else { // rename the file if another one exist $new_dir = "$desired_dir/" . $file_name . time(); rename($file_tmp, $new_dir); } Header("location: galeri?firmaid=$firmaid&uyeid=$uyeid&status=success"); } else { print_r($errors); } } else { Header("location: galeri?firmaid=$firmaid&uyeid=$uyeid&status=imgtype"); } } } } ?> <script type="text/javascript"> $( ".row_position" ).sortable({ delay: 150, stop: function() { var selectedData = new Array(); $('.row_position>tr').each(function() { selectedData.push($(this).attr("id")); }); updateOrder(selectedData); } }); function updateOrder(data) { $.ajax({ url:"includes/post/galeri-foto-siralama.php", type:'post', data:{position:data}, success:function(){ setTimeout(function(){// wait for 5 secs(2) location.reload(); // then reload the page.(3) }, 1); } }) } </script> <script type="text/javascript"> function deletebutton(fotoid,galeriid){ swal({ title: "Silmek İstediğinize Emin Misiniz?", text: "Seçtiğiniz içerik kalıcı olarak silinecektir", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Sil", cancelButtonText: "İptal", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { window.location.href = "includes/post/galeri-foto-sil.php?galeri=success&id="+fotoid+"&firma_id="+galeriid; } else { swal("İptal Edildi", "Seçtiğiniz içerik silinmemiştir", "error"); } }); } </script> <?php include "includes/footer.php"; ?>
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula