| Server IP : 172.67.201.108 / Your IP : 216.73.216.11 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/ |
Upload File : |
<?php
// Replaces: feed_regionalblurb.cfm
// RSS feed by region id - 10 items from regionstable join, with video play link
require_once __DIR__ . '/db/mysql_bootstrap.php';
/**
* Clean special characters from text for XML safety.
* Replaces smart quotes, em dashes, and other problematic characters,
* then applies htmlspecialchars for proper XML encoding.
*/
function cleanXmlText($text) {
$text = str_replace(
["\x91", "\x92", "\x93", "\x94", "\x96", "\xE2\x80\x98", "\xE2\x80\x99", "\xE2\x80\x9C", "\xE2\x80\x9D", "\xE2\x80\x93", "\xE2\x80\x94", " "],
["'", "'", "'", "'", "-", "'", "'", '"', '"', "-", "--", ""],
$text
);
return htmlspecialchars($text, ENT_XML1, 'UTF-8');
}
header('Content-Type: text/xml; charset=utf-8');
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
exit;
}
$regionId = (int)$_GET['id'];
$dsn = 'mysql:host=amazonaurora.cluster-ro-cemzxojvmybt.us-east-1.rds.amazonaws.com;dbname=amazonrds;charset=utf8mb4';
$dbUser = 'admin';
$dbPass = 'xxatN6Lb8Kbwb9MiU1At';
try {
$pdo = new PDO($dsn, $dbUser, $dbPass, mysqlPdoOptions([
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
]));
} catch (PDOException $e) {
exit('Database connection failed.');
}
// Get region info
$stmtRegion = $pdo->prepare("SELECT regions.name, regions.regionurl FROM bway_bww.regions WHERE id = ?");
$stmtRegion->execute([$regionId]);
$region = $stmtRegion->fetch();
if (!$region) {
exit;
}
$numberOfFeedItems = 10;
$sql = "SELECT authorname, title, blurb, dateposted, seo_friendly,
mainswapbig AS mainswap, columntable.id AS colid, media
FROM bway_bww.columntable
INNER JOIN bway_bww.regionstable ON columntable.id = regionstable.colid
WHERE columntable.status = 1 AND regionstable.regionsid = ?
AND columntable.id > 2281154
AND regionstable.colid > 2281154
ORDER BY columntable.id DESC
LIMIT 0, 20";
$stmt = $pdo->prepare($sql);
$stmt->execute([$regionId]);
$rows = $stmt->fetchAll();
if (empty($rows)) {
exit;
}
$now = new DateTime('now', new DateTimeZone('America/Los_Angeles'));
$theDatetime = $now->format('D, d M Y H:i:s') . ' PST';
$regionName = htmlspecialchars($region['name'], ENT_XML1, 'UTF-8');
$regionUrl = htmlspecialchars($region['regionurl'], ENT_XML1, 'UTF-8');
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<rss version="2.0">
<channel>
<title>BroadwayWorld.com <?php echo $regionName; ?> Stories</title>
<link>https://www.broadwayworld.com</link>
<description>Latest BroadwayWorld.com <?php echo $regionName; ?> News, Reviews, and More...</description>
<language>en-us</language>
<copyright>Copyright 2019 BroadwayWorld.com</copyright>
<docs>http://backend.userland.com/rss</docs>
<lastBuildDate><?php echo $theDatetime; ?></lastBuildDate>
<ttl>10</ttl>
<image>
<title>BroadwayWorld.com</title>
<url>https://www.broadwayworld.com/broadwaymain.gif</url>
<link>https://www.broadwayworld.com</link>
</image>
<?php
$itemCount = 0;
foreach ($rows as $row):
if ($itemCount >= $numberOfFeedItems) break;
// Skip TV Scoop items
if (stripos($row['title'], 'TV Scoop') !== false) {
continue;
}
$datePosted = new DateTime($row['dateposted']);
$pubDate = $datePosted->format('D, d M Y H:i:s') . ' PST';
$title = cleanXmlText($row['title']);
$description = cleanXmlText($row['blurb']);
$seoFriendly = htmlspecialchars($row['seo_friendly'], ENT_XML1, 'UTF-8');
$mainswap = htmlspecialchars($row['mainswap'], ENT_XML1, 'UTF-8');
$colid = (int)$row['colid'];
$link = 'https://' . $regionUrl . '/article/' . $seoFriendly;
// Build video play link if media exists
$videoLink = '';
if (!empty($row['media'])) {
$videoLink = htmlspecialchars('<p><a href="http://www2.broadwayworld.com/videoipad.cfm?colid=' . $colid . '">Click Here to Play!</a>', ENT_XML1, 'UTF-8');
}
$itemCount++;
?>
<item>
<title><?php echo $title; ?></title>
<description><?php echo $description; ?><?php if (!empty($row['media'])) echo $videoLink; ?></description>
<link><?php echo $link; ?></link>
<image><?php echo $mainswap; ?></image>
<guid isPermaLink="true"><?php echo $link; ?></guid>
<pubDate><?php echo $pubDate; ?></pubDate>
</item>
<?php endforeach; ?>
</channel>
</rss>