mirror of
https://github.com/myronblair/do-server-config
synced 2026-07-28 05:22:53 -05:00
[orbis] Weekly backup 2026-07-07 — 318 files changed, 48597 insertions(+), 7 deletions(-)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Tom's Java Jive - Customer Search API
|
||||
*/
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
require_once __DIR__ . '/../includes/functions.php';
|
||||
require_once __DIR__ . '/../includes/auth.php';
|
||||
|
||||
if (!AdminAuth::isLoggedIn()) {
|
||||
jsonResponse(['error' => 'Unauthorized'], 401);
|
||||
}
|
||||
|
||||
$query = $_GET['q'] ?? '';
|
||||
|
||||
if (strlen($query) < 2) {
|
||||
jsonResponse([]);
|
||||
}
|
||||
|
||||
$customers = db()->fetchAll(
|
||||
"SELECT customer_id, email, name, phone, wallet_balance, reward_points
|
||||
FROM customers
|
||||
WHERE (email LIKE :q1 OR name LIKE :q2 OR phone LIKE :q3) AND is_active = 1
|
||||
ORDER BY name ASC
|
||||
LIMIT 20",
|
||||
['q1' => '%' . $query . '%', 'q2' => '%' . $query . '%', 'q3' => '%' . $query . '%']
|
||||
);
|
||||
|
||||
jsonResponse($customers);
|
||||
Reference in New Issue
Block a user