forked from opencaching/opencaching-pl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_searchuser.php
More file actions
37 lines (30 loc) · 1.28 KB
/
admin_searchuser.php
File metadata and controls
37 lines (30 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
use Utils\Database\XDb;
use Utils\Uri\SimpleRouter;
use Utils\Text\UserInputFilter;
//prepare the templates and include all neccessary
require_once('./lib/common.inc.php');
if ($usr['admin']) {
$tplname = 'admin_searchuser';
$options = [];
$options['username'] = isset($_POST['username']) ? $_POST['username'] : '';
$options['username'] = UserInputFilter::purifyHtmlString($options['username']);
if ($options['username'] != '') {
$rs = XDb::xSql(
"SELECT user_id FROM user WHERE username = ? LIMIT 1", $options['username']);
$record = XDb::xFetchArray($rs);
if ($record != false) { // Przekierowanie do profilu użytkownika
tpl_set_var('username', '');
tpl_set_var('not_found', '');
tpl_redirect(ltrim(SimpleRouter::getLink('Admin.UserAdmin', 'index', $record['user_id']), '/'));
} else { // Nie znaleziono użytkownika
tpl_set_var('username', $options['username']);
tpl_set_var('not_found', '<div class="callout callout-warning">' . tr("message_user_not_found") . ': ' . $options['username'] . '</div>');
}
XDb::xFreeResults($rs);
} else {
tpl_set_var('username', '');
tpl_set_var('not_found', '');
}
tpl_BuildTemplate();
}