| Server IP : 104.21.21.239 / Your IP : 216.73.216.101 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
/**
* postmessage.php - Post new thread (replaces postmessage.cfm)
*
* Auth check. Preview + Post modes.
* On post: INSERT into wb, INSERT into wbtable, optionally INSERT into responses.
* 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'] ?? '';
?>
<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="postmessage.php" 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>
<?php else: ?>
<?php
// Post mode - actually insert the message
$db = getReadDb();
// Get last message ID
$stmt = $db->prepare("SELECT wb.ID as lastmessage FROM wb ORDER BY id DESC LIMIT 1");
$stmt->execute();
$messageinfo = $stmt->fetch();
$lastMessageId = $messageinfo ? (int)$messageinfo['lastmessage'] : 0;
// Get user info
$usernum = 1;
if ($getUser) {
$dbr = getReadDb();
$stmt2 = $dbr->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';
$newThreadId = $lastMessageId + 1;
$dbw = getWriteDb();
// INSERT into wb
$stmt = $dbw->prepare("INSERT INTO wb (fname, lname, Member, Subject, EMail, Message, Link, DT, LinkTitle, Image, ReplyID, ThreadID, ParentID, userID, SubParent, ipadd, browser, spoiler) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, 0, ?, 999, ?, ?, ?)");
$stmt->execute([
$fname, $lname, $member, $subject, $email, $message, $link,
$currentDateTime, $linkTitle, $image, $newThreadId, $usernum,
$ipadd, $browser, $spoilervar
]);
// INSERT into wbtable
$stmt = $dbw->prepare("INSERT INTO wbtable (topic, replies, lastcomment, lastcommentbyfirst, lastcommentbylast, topicstartedbyfirst, topicstartedbylast, id) VALUES (?, 0, ?, ?, ?, ?, ?, ?)");
$stmt->execute([
$subject, $currentDateTime, $fname, $lname, $fname, $lname, $newThreadId
]);
// Optional email responses
if (isset($_POST['responses']) && $_POST['responses'] !== '') {
$stmt = $dbw->prepare("INSERT INTO responses (email, threadid) VALUES (?, ?)");
$stmt->execute([$email, $newThreadId]);
}
// 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'; ?>