From 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:45:02 +0100 Subject: initial checking of customized version 1.0rc9 --- js/callbacks/searchnames.php | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 js/callbacks/searchnames.php (limited to 'js/callbacks/searchnames.php') diff --git a/js/callbacks/searchnames.php b/js/callbacks/searchnames.php new file mode 100644 index 0000000..f696955 --- /dev/null +++ b/js/callbacks/searchnames.php @@ -0,0 +1,55 @@ +check_account_ok(); +} else { + $user = new User(0, $proj); +} + +if ($user->isAnon()) { + # at least allow for guests when user registration is enabled, fix FS#2528 + if( !($user->can_register() or $user->can_self_register()) ){ + die(); + } +} + +if (Req::has('name')) { + $searchterm = strtolower(Req::val('name')); +} else { + die(); +} + +// Get the list of users from the global groups above +$get_users = $db->query(' + SELECT count(u.user_name) AS anz_u_user, count(r.user_name) AS anz_r_user + FROM {users} u + LEFT JOIN {registrations} r ON u.user_name = r.user_name + WHERE LOWER(u.user_name) = ? OR LOWER(r.user_name) = ?', + array($searchterm, $searchterm) +); + +load_translations(); + +while ($row = $db->fetchRow($get_users)){ + if ($row['anz_u_user'] > '0' || $row['anz_r_user'] > '0') { + $html = 'false|' . eL('usernametaken'); + } else { + $html = 'true'; + } +} + +echo $html; +?> -- cgit v1.2.3-54-g00ecf