| Server IP : 172.67.201.108 / Your IP : 216.73.217.39 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_regional.cfm
// RSS feed by region id - 30 items, special handling for regions 1 and 32
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'];
// Block region 77
if ($regionId === 77) {
exit;
}
$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 regions WHERE id = ?");
$stmtRegion->execute([$regionId]);
$region = $stmtRegion->fetch();
if (!$region) {
exit;
}
// Build content query with conditional joins/filters for regions 1 and 32
$sql = "SELECT authorname, title, copy AS blurb, dateposted, seo_friendly,
mainswaptv AS mainswap, columntable.id AS colid, media
FROM bway_bww.columntable
INNER JOIN bway_bww.regionstable ON columntable.id = regionstable.colid";
if ($regionId === 1 || $regionId === 32) {
$sql .= " INNER JOIN bway_bww.columntableimages ON columntable.id = columntableimages.ID";
}
$sql .= " WHERE columntable.status = 1 AND regionstable.regionsid = ?";
$params = [$regionId];
if ($regionId === 32) {
$sql .= " AND columntableimages.id > 2281154 AND columntableimages.regionaltop <> 1";
}
if ($regionId === 1) {
$sql .= " AND columntableimages.id > 2281154 AND columntable.showinfolink2 = 1";
}
$sql .= " AND columntable.id > 2281154 AND regionstable.colid > 2281154
ORDER BY columntable.id DESC
LIMIT 0, 30";
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
$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 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 foreach ($rows as $row):
// 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="https://www.broadwayworld.com/videoplay.php?colid=' . $colid . '">Click Here to Play!</a>', ENT_XML1, 'UTF-8');
}
// Comscore pixel
$comscore = htmlspecialchars('<img src="http://b.scorecardresearch.com/p?c1=2&c2=18162732&cv=2.0&cj=1" />', ENT_XML1, 'UTF-8');
?>
<item><title><?php echo $title; ?></title>
<description><?php echo $description; ?><?php if (!empty($row['media'])) echo $videoLink; ?><?php echo $comscore; ?></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>