Add date search ability to action.php transactionsearch
This commit is contained in:
parent
9e6d4dfa0a
commit
a5f369fe00
15
action.php
15
action.php
@ -328,16 +328,25 @@ switch ($VARS['action']) {
|
||||
break;
|
||||
case "transactionsearch":
|
||||
header("Content-Type: application/json");
|
||||
if (!is_empty($VARS['q'])) {
|
||||
$where = [];
|
||||
if (!empty($VARS['q'])) {
|
||||
$where["AND"]["OR"] = [
|
||||
"txid" => $VARS['q'],
|
||||
"name[~]" => $VARS['q'],
|
||||
"email[~]" => $VARS['q'],
|
||||
"phone[~]" => $VARS['q']
|
||||
];
|
||||
} else {
|
||||
exit(json_encode(["status" => "ERROR", "transactions" => false]));
|
||||
}
|
||||
$start = date('Y-m-d H:i:s', 946684800); // Jan 1 2000
|
||||
$end = date('Y-m-d H:i:s');
|
||||
if (!empty($VARS['start']) && strtotime($VARS['start']) !== FALSE) {
|
||||
$start = date('Y-m-d H:i:s', strtotime($VARS['start']));
|
||||
}
|
||||
if (!empty($VARS['end']) && strtotime($VARS['end']) !== FALSE) {
|
||||
$end = date('Y-m-d H:i:s', strtotime($VARS['end']));
|
||||
}
|
||||
$where["AND"]['txdate[>=]'] = $start;
|
||||
$where["AND"]['txdate[<=]'] = $end;
|
||||
$where["LIMIT"] = 50;
|
||||
|
||||
$transactions = $database->select('transactions', [
|
||||
|
Loading…
x
Reference in New Issue
Block a user