📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
blogscripti.demodesign.com.tr
/
admin
📝
bot.php
← Geri Dön
<?php include('inc/head.php'); ?> <?php include('inc/header.php'); if($kullanici['yetki'] == 0){ echo '<div class="container-xxl container-p-y"> <div class="misc-wrapper"> <h2 class="mb-1 mx-2">Yetkisiz erişim!</h2> <p class="mb-4 mx-2">Yetkiniz olmayan bir sayfaya girmeye çalışıyorsunuz. <br> Site yöneticisi ile iletişime geçin.</p> <a href="index" class="btn btn-primary mb-4">Anasayfa</a> <div class="mt-4"> <img src="assets/img/illustrations/page-misc-you-are-not-authorized.png" alt="page-misc-not-authorized" width="170" class="img-fluid"> </div> </div> </div> </div> '; } else { if ($_POST) { $rssLink = $_POST['rss']; $rssData = file_get_contents($rssLink); $rssXml = simplexml_load_string($rssData); foreach ($rssXml->channel->item as $item) { $guid = $item->title; $stmt = $db->prepare("SELECT * FROM blog WHERE baslik = :guid"); $stmt->bindParam(':guid', $guid); $stmt->execute(); $existingEntry = $stmt->fetch(PDO::FETCH_ASSOC); if (!$existingEntry) { $title = $item->title; $description = $item->description; $coco = $item->children("http://purl.org/rss/1.0/modules/content/")->encoded; $icerik = $coco; // Find all <img> tags with src attribute in the content $pattern = '/<img.*?src=["\'](.*?)["\'].*?>/i'; preg_match_all($pattern, $icerik, $matches); // Get the image URLs $imageURLs = $matches[1]; // Get the server name $serverName = $_SERVER['SERVER_NAME']; // Process and replace the images in the content foreach ($imageURLs as $imageURL) { $imageName = basename($imageURL); // Get the filename from the URL $imagePath = $_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $imageName; $webpFilename = seolink($title) . '-' . uniqid() . '.webp'; // Generate WebP filename using title $webpPath = '../uploads/' . $webpFilename; file_put_contents($imagePath, file_get_contents($imageURL)); $imageGD = imagecreatefromstring(file_get_contents($imagePath)); imagewebp($imageGD, $webpPath, 80); $newImageURL = 'https://' . $serverName . '/uploads/' . $webpFilename; $icerik = str_replace($imageURL, $newImageURL, $icerik); imagedestroy($imageGD); unlink($imagePath); } $pattern = '/<img.*?src=["\'](.*?)["\'].*?>/i'; preg_match($pattern, $icerik, $matches); if (isset($matches[1])) { $featuredImage = $matches[1]; $icerik = preg_replace($pattern, '', $icerik, 1); } preg_match($pattern, $coco, $matches); $image = isset($matches[1]) ? $matches[1] : ''; $image_name = basename($image); $kategori = $_POST['kategori']; $data = [ 'baslik' => $title, 'icerik' => $icerik, 'seobaslik' => $title, 'seodescription' => substr($description, 0, 150), 'seolink' => seolink($title), 'kategori' => $kategori, 'tur' => 'blog' ]; // Resmi indir ve WebP'ye dönüştür if (!empty($image)) { $image_path = $_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $image_name; file_put_contents($image_path, file_get_contents($image)); // WebP'ye dönüştürme $webp_destination = '../uploads/' . uniqid() . '.webp'; $image_gd = imagecreatefromstring(file_get_contents($image_path)); imagewebp($image_gd, $webp_destination, 80); // Resim yolunu güncelle $data['resim'] = $webp_destination; // Önbellekteki resmi serbest bırak imagedestroy($image_gd); // Orjinal resmi sil unlink($image_path); } $veriyaz = $db->prepare("INSERT INTO blog SET baslik=:baslik, icerik=:icerik, seobaslik=:seobaslik, seodescription=:seodescription, seolink=:seolink, resim=:resim, kategori=:kategori, tur=:tur "); $veriyaz->execute($data); $mesaj = '<div class="alert alert-success">RSS İçeriği başarıyla çekildi.</div>'; } else { $mesaj = '<div class="alert alert-danger">Bu RSS girdisi zaten veritabanında kaydedilmiş.</div>'; } } } ?> <div class="container-xxl flex-grow-1 container-p-y"> <h4 class="fw-bold py-3 mb-4"><span class="text-muted fw-light">İçerik Yönetimi/</span> RSS İçerik Botu</h4> <div class="row"> <div class="col-xl"> <?php if (isset($mesaj)) { echo $mesaj; } ?> <div class="card mb-4"> <div class="card-header d-flex justify-content-between align-items-center"> <h5 class="mb-0">RSS İçerik Botu</h5> </div> <div class="card-body"> <form action="" method="post" enctype="multipart/form-data"> <div class="mb-3"> <label class="form-label" for="basic-default-fullname">Yazı Kategorisi</label> <select class="form-control" name="kategori"> <?php $kategorilerigetir = $db->query("select * from kategori")->fetchAll(PDO::FETCH_ASSOC); foreach ($kategorilerigetir as $kategoriler) { ?> <option value="<?php echo $kategoriler['id']; ?>"><?php echo $kategoriler['name']; ?></option> <?php } ?> </select> </div> <div class="mb-3"> <label class="form-label" for="basic-default-fullname">RSS Linki</label> <input type="text" class="form-control" id="basic-default-fullname" name="rss" placeholder="RSS Linki"/> </div> <button type="submit" class="btn btn-primary">Çek</button> </form> </div> </div> </div> </div> </div> <?php } include('inc/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