| Server IP : 172.67.201.108 / Your IP : 216.73.217.54 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/mcifa.com/public_html/ |
Upload File : |
<?php
/**
* postmessage2.php - Post reply to existing message (replaces postmessage2.cfm)
*
* Auth check. Preview + Post modes.
* On post: INSERT into wb, UPDATE wbtable reply count, optionally INSERT into responses.
* Email notifications to subscribers. Then redirect to board.php.
*/
$browser = $_SERVER['HTTP_USER_AGENT'] ?? '';
$ipadd = $_SERVER['REMOTE_ADDR'] ?? '';
$currentDateTime = date('Y-m-d H:i:s');
require 'header.php';
requireLogin();
?>
<section id="content" class="sbr">
<div class="menu-shadow"></div>
<div class="container clearfix">
<div class="page-header clearfix" style="margin-bottom: 20px;">
<h1>Message Board</h1>
<div class="line"></div>
</div>
<!--/ .page-header-->
<section id="main" class="twelve columns">
<article class="entry clearfix">
<!--/ .entry-title-->
<!--/ .preloader-->
<!--/ .entry-meta-->
<div class="entry-body">
<?php if (isset($_POST['Preview'])): ?>
<?php
// Preview mode
$fname = $_POST['fname'] ?? '';
$lname = $_POST['lname'] ?? '';
$member = $_POST['member'] ?? '';
$email = $_POST['email'] ?? '';
$subject = $_POST['Subject'] ?? '';
$message = $_POST['Message'] ?? '';
$link = $_POST['Link'] ?? '';
$linkTitle = $_POST['LinkTitle'] ?? '';
$image = $_POST['Image'] ?? '';
$responses = $_POST['responses'] ?? '';
$spoiler = $_POST['spoiler'] ?? '';
// Preserve URL params for the post action
$urlM = $_GET['M'] ?? '';
$urlMID = $_GET['MID'] ?? '';
$urlSP = $_GET['SP'] ?? '';
?>
<font face="Arial" size="+1">
<b><?php echo h($subject); ?><br></font></b>
<font face="Arial" size="-1">Posted by <b>
<?php if ($email !== ''): ?>
<a href="mailto:<?php echo h($email); ?>">
<?php endif; ?>
<?php echo h($fname) . ' ' . h($lname); ?></a></b> <i><?php echo h($currentDateTime); ?></i>
<font face="arial" size="-2">
<div align="right"><?php echo h($ipadd); ?></div>
</font>
<br>
<p>
<?php if ($image !== ''): ?>
<img src="<?php echo h($image); ?>">
<?php endif; ?>
<p>
<font face="arial" size="-1">
<?php echo paragraphFormat($message); ?>
<p>
<a href="<?php echo h($link); ?>"><?php echo h($linkTitle); ?></a>
</font>
<hr color="black">
<form action="postmessage2.php?M=<?php echo urlencode($urlM); ?>&MID=<?php echo urlencode($urlMID); ?>&SP=<?php echo urlencode($urlSP); ?>" method="post">
<input name="fname" type="hidden" value="<?php echo h($fname); ?>">
<input name="lname" type="hidden" value="<?php echo h($lname); ?>">
<input name="Member" type="hidden" value="<?php echo h($member); ?>">
<input name="email" type="hidden" value="<?php echo h($email); ?>">
<input name="Subject" type="hidden" value="<?php echo h($subject); ?>">
<input name="Message" type="hidden" value="<?php echo h($message); ?>">
<input name="Link" type="hidden" value="<?php echo h($link); ?>">
<input name="LinkTitle" type="hidden" value="<?php echo h($linkTitle); ?>">
<input name="Image" type="hidden" value="<?php echo h($image); ?>">
<?php if ($responses !== ''): ?>
<input name="responses" type="hidden" value="<?php echo h($responses); ?>">
<?php endif; ?>
<?php if ($spoiler !== ''): ?>
<input name="spoiler" type="hidden" value="<?php echo h($spoiler); ?>">
<?php endif; ?>
<center><b><input type="button" value="Edit Message" onclick="history.go(-1)">
<input type="submit" value="Post Message"></b></center>
</form>
<p><b>
<?php else: ?>
<?php
// Post mode - actually insert the reply
$urlM = isset($_GET['M']) ? (int)$_GET['M'] : 0;
$urlMID = isset($_GET['MID']) ? (int)$_GET['MID'] : 0;
$db = getReadDb();
// Get parent message info
$stmt = $db->prepare("SELECT id, replyid, threadid FROM wb WHERE ID = ?");
$stmt->execute([$urlM]);
$showmessage = $stmt->fetch();
if (!$showmessage) {
echo '<p>Message not found.</p>';
} else {
echo '<center><font face="Arial" size="-1">Thank you for your entry. </font></b>';
echo '<form action="board.php" method="post">';
echo '<input type="submit" value="Return to the Message Board"><br>';
echo '</form>';
// Get user info
$usernum = 1;
if ($getUser) {
$stmt2 = $db->prepare("SELECT Member, Password, EMail, fname, lname, ID FROM users WHERE users.ID = ?");
$stmt2->execute([$getUser['id']]);
$usersquery = $stmt2->fetch();
if ($usersquery && !empty($usersquery['id'])) {
$usernum = (int)$usersquery['id'];
}
}
$fname = $_POST['fname'] ?? '';
$lname = $_POST['lname'] ?? '';
$member = $_POST['member'] ?? '';
$email = $_POST['email'] ?? '';
$subject = $_POST['Subject'] ?? '';
$message = $_POST['Message'] ?? '';
$link = $_POST['Link'] ?? '';
$linkTitle = $_POST['LinkTitle'] ?? '';
$image = $_POST['Image'] ?? '';
$spoilervar = isset($_POST['spoiler']) ? $_POST['spoiler'] : 'Off';
$newReplyId = (int)$showmessage['replyid'] + 1;
$threadId = (int)$showmessage['threadid'];
$parentId = (int)$showmessage['id'];
$dbw = getWriteDb();
// INSERT reply into wb
$stmt = $dbw->prepare("INSERT INTO wb (fname, lname, Member, Subject, EMail, Message, Link, DT, LinkTitle, Image, ReplyID, ThreadID, ParentID, userID, ipadd, browser, spoiler) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->execute([
$fname, $lname, $member, $subject, $email, $message, $link,
$currentDateTime, $linkTitle, $image, $newReplyId, $threadId,
$parentId, $usernum, $ipadd, $browser, $spoilervar
]);
// UPDATE wbtable: increment replies, update last comment info
$stmt = $db->prepare("SELECT id, replies FROM wbtable WHERE ID = ?");
$stmt->execute([$threadId]);
$getinsertinfo = $stmt->fetch();
if ($getinsertinfo) {
$newReplies = (int)$getinsertinfo['replies'] + 1;
$stmt = $dbw->prepare("UPDATE wbtable SET replies = ?, lastcomment = ?, lastcommentbyfirst = ?, lastcommentbylast = ? WHERE id = ?");
$stmt->execute([$newReplies, $currentDateTime, $fname, $lname, $threadId]);
}
// Optional: insert into responses table for email notifications
if (isset($_POST['responses']) && $_POST['responses'] !== '') {
$stmt = $dbw->prepare("INSERT INTO responses (email, threadid) VALUES (?, ?)");
$stmt->execute([$email, $threadId]);
}
// Email notifications to existing subscribers
$stmt = $db->prepare("SELECT * FROM responses WHERE threadid = ?");
$stmt->execute([$threadId]);
$subscribers = $stmt->fetchAll();
foreach ($subscribers as $person) {
$emailTo = $person['email'] ?? '';
if ($emailTo !== '') {
$emailSubject = "MCIFA.com - " . $subject;
$emailBody = "{$subject}\n{$fname} {$lname}\n{$email}\n\n{$message}\n\nhttp://www.mcifa.com";
sendEmail($emailTo, $email, $emailSubject, $emailBody);
}
}
// Redirect to board
header('Location: board.php');
exit;
}
?>
<?php endif; ?>
<!--/ .about-author-->
</div>
<!--/ .entry-body-->
</article>
<!--/ .entry-->
</section> <!--/ #main-->
<?php require 'sidebar.php'; ?>
<?php require 'footer.php'; ?>