| Server IP : 172.67.201.108 / Your IP : 216.73.217.139 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
/**
* boardsearch.php - Board search with dynamic criteria (replaces boardsearch.cfm)
*
* Auth check. Uses buildSearchCriteria() from functions.php for parameterized queries.
* Displays results with pagination (50 per page).
*/
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>Search the 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['Crit1_FieldName'])): ?>
<?php
$fieldName = $_POST['Crit1_FieldName'] ?? 'wb.message';
$fieldType = $_POST['Crit1_FieldType'] ?? 'CHAR';
$operator = $_POST['Crit1_Operator'] ?? 'contains';
$searchValue = $_POST['Crit1_Value'] ?? '';
?>
<br>
<form action="boardsearch.php" method="post">
<table><input name="Crit1_FieldName" type="hidden" value="wb.message">
<input name="Crit1_FieldType" type="hidden" value="CHAR">
<tr>
<td valign="top"><font face="Arial" size="2"><strong>Search the Board...</strong></font> </td>
<td>
<input name="Crit1_Operator" type="hidden" value="contains">
</td>
<td>
<input name="Crit1_Value" value="<?php echo h($searchValue); ?>" style="border: 1px;border-style: dashed;border-color:purple;"><input name="Crit1_Value_required" type="hidden" value="You must enter something to search for."> <input type="submit" value="Search!"></font>
</center></td>
</form></strong></font></td></tr>
</table>
<?php
// Build search criteria using parameterized query
$criteria = buildSearchCriteria($fieldName, $fieldType, $operator, $searchValue);
if (!empty($criteria['sql'])) {
$db = getReadDb();
$sql = "SELECT * FROM wb WHERE " . $criteria['sql'] . " ORDER BY dt DESC";
$stmt = $db->prepare($sql);
$stmt->execute($criteria['params']);
$results = $stmt->fetchAll();
$totalResults = count($results);
// Pagination
$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
$perPage = 50;
$startRow = ($page - 1) * $perPage;
$pageResults = array_slice($results, $startRow, $perPage);
?>
<br><br></center>
<?php foreach ($pageResults as $row): ?>
<font face="ARIAL" size="-1"> <a href="readmessage2.php?M=<?php echo urlencode($row['id']); ?>&MID=<?php echo urlencode($row['threadid']); ?>&SP=<?php echo urlencode($row['subparent']); ?>"><strong><?php echo h($row['subject']); ?></strong></a> - <b>
<?php echo h($row['fname']) . ' ' . h(strtoupper(mb_substr($row['lname'], 0, 1))); ?>.
</b>
<font color="black" size="-1"><i> <?php echo date('M j', strtotime($row['dt'])); ?>, <?php echo date('h:i A', strtotime($row['dt'])); ?></i><br>
<font color="black" size="-1">
<?php echo h(mb_substr($row['message'], 0, 500)); ?>... (<a href="readmessage2.php?M=<?php echo urlencode($row['id']); ?>&MID=<?php echo urlencode($row['threadid']); ?>&SP=<?php echo urlencode($row['subparent']); ?>">more...)
</font>
</font>
<br><br>
<?php endforeach; ?>
<?php
// "More..." pagination button
$totalPages = ceil($totalResults / $perPage);
if ($totalPages > $page):
$nextPage = $page + 1;
?>
<form action="boardsearch.php?page=<?php echo $nextPage; ?>" method="post">
<font face="Arial">
<input name="Crit1_FieldName" type="hidden" value="wb.message">
<input name="Crit1_FieldType" type="hidden" value="CHAR">
<input name="Crit1_Operator" type="hidden" value="contains">
<input name="Crit1_Value" type="hidden" value="<?php echo h($searchValue); ?>">
<div align="right"><input type="submit" value="More..."></div>
</form>
<?php
endif; // totalPages > page
} // !empty criteria
?>
<?php else: ?>
<br>
<form action="boardsearch.php" method="post">
<table>
<input name="Crit1_FieldName" type="hidden" value="wb.message">
<input name="Crit1_FieldType" type="hidden" value="CHAR">
<tr>
<td valign="top"><font face="Arial" size="2"><strong>Search the Board...</strong></font> </td>
<td>
<input name="Crit1_Operator" type="hidden" value="contains" style="border: 1px;border-style: dashed;border-color:purple;">
</td>
<td><input name="Crit1_Value" style="border: 1px;border-style: dashed;border-color:purple;"><input name="Crit1_Value_required" type="hidden" value="You must enter something to search for."> <input type="submit" value="Search!"></font>
</center></td>
</form></strong></font></td></tr>
</table>
<?php endif; ?>
<!--/ .about-author-->
</div>
<!--/ .entry-body-->
</article>
<!--/ .entry-->
</section> <!--/ #main-->
<?php require 'sidebar.php'; ?>
<?php require 'footer.php'; ?>