Gazelle/sections/tools/managers/email_blacklist_search.php

46 lines
852 B
PHP
Raw Normal View History

2013-01-21 08:00:33 +00:00
<?
$Search = db_string($_GET['email']);
$JSON = array();
if (!check_perms('users_view_email') || empty($Search)) {
2013-05-16 08:00:10 +00:00
$JSON['status'] = 'error';
2013-01-21 08:00:33 +00:00
echo json_encode($JSON);
exit();
}
else {
2013-05-16 08:00:10 +00:00
$JSON['status'] = 'success';
2013-01-21 08:00:33 +00:00
}
2013-05-16 08:00:10 +00:00
$DB->query("
SELECT
2013-11-17 08:00:47 +00:00
ID,
UserID,
Time,
Email,
Comment
FROM email_blacklist
WHERE Email LIKE '%$Search%'");
2013-01-21 08:00:33 +00:00
$EmailResults = $DB->to_array(false, MYSQLI_ASSOC, false);
$Results = array();
$Count = $DB->record_count();
$Results['count'] = $Count;
$Emails = array();
if ($Count > 0) {
foreach ($EmailResults as $Email) {
2013-05-16 08:00:10 +00:00
$Emails[] = array(
2013-10-30 08:01:19 +00:00
'id' => (int)$Email['ID'],
2013-05-16 08:00:10 +00:00
'email' => $Email['Email'],
'comment' => $Email['Comment'],
2013-10-30 08:01:19 +00:00
'userid' => (int)$Email['UserID'],
2013-05-16 08:00:10 +00:00
'time' => $Email['Time']);
2013-01-21 08:00:33 +00:00
}
}
$Results['emails'] = $Emails;
$JSON['results'] = $Results;
echo json_encode($JSON);
2013-05-16 08:00:10 +00:00
exit();