Add userexists by UID API
This commit is contained in:
parent
4f6e23e6b2
commit
1e2b5d7e7f
9
api.php
9
api.php
@ -69,6 +69,13 @@ switch ($VARS['action']) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "userexists":
|
case "userexists":
|
||||||
|
if (!is_empty($VARS['uid'])) {
|
||||||
|
if ($database->has('accounts', ['uid' => $VARS['uid']])) {
|
||||||
|
exit(json_encode(["status" => "OK", "exists" => true]));
|
||||||
|
} else {
|
||||||
|
exit(json_encode(["status" => "OK", "exists" => false]));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (user_exists($VARS['username'])) {
|
if (user_exists($VARS['username'])) {
|
||||||
exit(json_encode(["status" => "OK", "exists" => true]));
|
exit(json_encode(["status" => "OK", "exists" => true]));
|
||||||
} else {
|
} else {
|
||||||
@ -196,7 +203,7 @@ switch ($VARS['action']) {
|
|||||||
if (is_empty($VARS['search']) || strlen($VARS['search']) < 3) {
|
if (is_empty($VARS['search']) || strlen($VARS['search']) < 3) {
|
||||||
exit(json_encode(["status" => "OK", "result" => []]));
|
exit(json_encode(["status" => "OK", "result" => []]));
|
||||||
}
|
}
|
||||||
$data = $database->select('accounts', ['uid', 'username', 'realname (name)'], ["OR" => ['username[~]' => $VARS['search'], 'realname[~]' => $VARS['search']], "LIMIT" => QUERY_LIMIT]);
|
$data = $database->select('accounts', ['uid', 'username', 'realname (name)'], ["OR" => ['username[~]' => $VARS['search'], 'realname[~]' => $VARS['search']], "LIMIT" => 10]);
|
||||||
exit(json_encode(["status" => "OK", "result" => $data]));
|
exit(json_encode(["status" => "OK", "result" => $data]));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user