forked from opencaching/opencaching-pl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_searchuser.php
37 lines (29 loc) · 1.17 KB
/
admin_searchuser.php
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;
//prepare the templates and include all neccessary
require_once('./lib/common.inc.php');
if ($usr['admin']) {
$tplname = 'admin_searchuser';
$options['username'] = isset($_POST['username']) ? $_POST['username'] : '';
if (!isset($options['username'])) {
$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('admin_users.php?userid=' . htmlspecialchars($record['user_id'], ENT_COMPAT, 'UTF-8'));
} else { // Nie znaleziono użytkownika
tpl_set_var('username', $options['username']);
tpl_set_var('not_found', '<b>' . tr("message_user_not_found") . ': ' . $options['username'] . '</b><br/><br/>');
}
XDb::xFreeResults($rs);
} else {
tpl_set_var('username', '');
tpl_set_var('not_found', '');
}
tpl_BuildTemplate();
}