Login , Register ,and onboarding
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
session_start();
|
||||
require '../../../assets/utils/db_auth.php';
|
||||
|
||||
try {
|
||||
|
||||
$keyword = trim($data['keyword'] ?? '');
|
||||
|
||||
if ($keyword === '') {
|
||||
$answer['success'] = 1;
|
||||
$answer['result'] = [];
|
||||
exit(json_encode($answer));
|
||||
}
|
||||
|
||||
$like = '%' . $keyword . '%';
|
||||
|
||||
// Search users by email NOT already active/pending in this company
|
||||
$sth = $pdo1->prepare("
|
||||
SELECT
|
||||
u.user_id,
|
||||
u.username,
|
||||
u.name,
|
||||
u.surname,
|
||||
u.email
|
||||
FROM user u
|
||||
WHERE
|
||||
u.email LIKE :kw
|
||||
AND u.user_id NOT IN (
|
||||
SELECT user_id FROM company_map_user
|
||||
WHERE company_id = :company_id
|
||||
)
|
||||
ORDER BY u.email ASC
|
||||
LIMIT 10
|
||||
");
|
||||
$sth->execute([
|
||||
':kw' => $like,
|
||||
':company_id' => $company_id,
|
||||
]);
|
||||
db_check($sth, $answer);
|
||||
|
||||
$answer['success'] = 1;
|
||||
$answer['result'] = $sth->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
} catch (Exception $e) {
|
||||
$answer['message'] = 'Search failed.';
|
||||
http_response_code(500);
|
||||
}
|
||||
|
||||
exit(json_encode($answer));
|
||||
?>
|
||||
Reference in New Issue
Block a user