| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/wcfs/tabs/Backups/ |
Upload File : |
<?php
include 'db.php';
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$letter = isset($_GET['letter']) ? strtoupper($_GET['letter']) : '';
$search = isset($_GET['search']) ? trim($_GET['search']) : '';
$customers = [];
if ($letter) {
$stmt = $conn->prepare("SELECT id, first_name, last_name FROM customers WHERE last_name LIKE ? ORDER BY last_name, first_name");
$like = $letter . '%';
$stmt->bind_param("s", $like);
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
$customers[] = $row;
}
} elseif ($search) {
$stmt = $conn->prepare("SELECT id, first_name, last_name FROM customers WHERE first_name LIKE ? OR last_name LIKE ? ORDER BY last_name, first_name");
$term = '%' . $search . '%';
$stmt->bind_param("ss", $term, $term);
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
$customers[] = $row;
}
}
?>
<h1>Farm Account Dashboard</h1>
<!-- A�Z Filter -->
<h3>A�Z Last Name Filter</h3>
<p>
<?php foreach (range('A', 'Z') as $l): ?>
<a href="?letter=<?= $l ?>" style="margin-right:10px;"><?= $l ?></a>
<?php endforeach; ?>
</p>
<!-- Search Box -->
<h3>Search for a Customer</h3>
<form method="get">
<input type="text" name="search" placeholder="First or Last Name" value="<?= htmlspecialchars($search) ?>">
<input type="submit" value="Search">
</form>
<!-- Customer List -->
<?php if (!empty($customers)): ?>
<h4>Matching Customers:</h4>
<ul>
<?php foreach ($customers as $c): ?>
<li>
<a href="view_account.php?customer_id=<?= $c['id'] ?>">
<?= htmlspecialchars($c['last_name'] . ', ' . $c['first_name']) ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php elseif ($letter || $search): ?>
<p>No customers found.</p>
<?php endif; ?>
<!-- Main Navigation -->
<hr>
<h3>Quick Actions</h3>
<p>
<a href="add_transaction.php">? Add Transaction</a> |
<a href="add_customer.php">? Add Customer</a>
</p>
<!-- Clear All Customers Tabs -->
<hr>
<h3>Clear All Customer Tabs</h3>
<form method="post" action="clear_all.php">
<input type="hidden" name="confirm" value="start">
<input type="submit" value="?? Clear ALL Tabs (Monthly Reset)">
</form>