"); $c_name = 'usertbl_results'; $default_selected = ['user_joined', 'user_lastvisit', 'user_groups']; $default_status_selected = ['0']; $s_name = 'usertbl_status'; $selected_status = []; $statuses = []; if (isset($_POST['apply_filter'])) { // Display Cookie if (isset($_POST['display']) && is_array($_POST['display'])) { $selected_display_keys = \defender::sanitize_array(array_keys($_POST['display'])); $cookie_selected = implode(',', $selected_display_keys); setcookie($c_name, $cookie_selected, time() + (86400 * 30), "/"); } else { // Prevent cookie tampering and reverted to default result $cookie_selected = implode(',', $default_selected); setcookie($c_name, $cookie_selected, time() + (86400 * 30), "/"); } if (isset($_POST['user_status']) && is_array($_POST['user_status'])) { $selected_display_keys = \defender::sanitize_array(array_keys($_POST['user_status'])); $status_cookie_selected = implode(',', $selected_display_keys); setcookie($s_name, $status_cookie_selected, time() + (86400 * 30), "/"); } else { // Prevent cookie tampering and reverted to default result $status_cookie_selected = implode(',', $default_status_selected); setcookie($s_name, $status_cookie_selected, time() + (86400 * 30), "/"); } } else { if (!isset($_COOKIE[$c_name])) { $cookie_selected = implode(',', $default_selected); setcookie($c_name, $cookie_selected, time() + (86400 * 30), "/"); } else { $cookie_selected = stripinput($_COOKIE[$c_name]); } if (isset($_GET['status']) && isnum($_GET['status']) && $_GET['status'] <= 7) { $status_cookie_selected = $_GET['status']; setcookie($s_name, $status_cookie_selected, time() + (86400 * 30), "/"); } else { if (!isset($_COOKIE[$s_name])) { $status_cookie_selected = implode(',', $default_status_selected); setcookie($s_name, $status_cookie_selected, time() + (86400 * 30), "/"); } else { $status_cookie_selected = stripinput($_COOKIE[$s_name]); } } } /* * Sanitize Cookie Input - Select */ $usertable_column = array_flip(fieldgenerator(DB_USERS)); unset($usertable_column['user_password']); unset($usertable_column['user_admin_password']); unset($usertable_column['user_salt']); unset($usertable_column['user_algo']); unset($usertable_column['user_admin_algo']); unset($usertable_column['user_admin_salt']); unset($usertable_column['user_status']); $user_fields = array_map('trim', explode(',', $cookie_selected)); // Sanitize fields $selected_fields = []; if (!empty($user_fields)) { foreach ($user_fields as $field_name) { if (isset($usertable_column[$field_name])) { // there we have a verified one. $selected_fields[$field_name] = $field_name; } } } /* * Sanitize Cookie Input - Condition */ $user_status = array_map('trim', explode(',', $status_cookie_selected)); if (!empty($user_status)) { foreach ($user_status as $status) { if (isnum($status)) { $selected_status[$status] = $status; } } } $tLocale = [ 'user_hide_email' => self::$locale['ME_420'], 'user_joined' => self::$locale['ME_421'], 'user_lastvisit' => self::$locale['ME_422'], 'user_ip' => self::$locale['ME_423'], 'user_ip_type' => self::$locale['ME_424'], 'user_groups' => self::$locale['ME_425'], 'user_status' => self::$locale['ME_427'] ]; $field_checkboxes = [ 'user_hide_email' => form_checkbox('display[user_hide_email]', $tLocale['user_hide_email'], (isset($selected_fields['user_hide_email']) ? 1 : 0), ['reverse_label' => TRUE]), 'user_joined' => form_checkbox('display[user_joined]', $tLocale['user_joined'], (isset($selected_fields['user_joined']) ? 1 : 0), ['reverse_label' => TRUE]), 'user_lastvisit' => form_checkbox('display[user_lastvisit]', $tLocale['user_lastvisit'], (isset($selected_fields['user_lastvisit']) ? 1 : 0), ['reverse_label' => TRUE]), 'user_ip' => form_checkbox('display[user_ip]', $tLocale['user_ip'], (isset($selected_fields['user_ip']) ? 1 : 0), ['reverse_label' => TRUE]), 'user_ip_type' => form_checkbox('display[user_ip_type]', $tLocale['user_ip_type'], (isset($selected_fields['user_ip_type']) ? 1 : 0), ['reverse_label' => TRUE]), 'user_groups' => form_checkbox('display[user_groups]', $tLocale['user_groups'], (isset($selected_fields['user_groups']) ? 1 : 0), ['reverse_label' => TRUE]), ]; $extra_checkboxes = []; $result = dbquery("SELECT field_id, field_name, field_title FROM ".DB_USER_FIELDS." ORDER BY field_cat, field_order ASC"); if (dbrows($result) > 0) { $data = dbarray($result); $name = $data['field_name']; $title = (QuantumFields::is_serialized($data['field_title']) ? QuantumFields::parse_label($data['field_title']) : $data['field_title']); $tLocale[$name] = $title; $extra_checkboxes[$name] = form_checkbox("display[".$name."]", $title, (isset($selected_fields[$name]) ? 1 : 0), ['input_id' => 'custom_'.$data['field_id'], 'reverse_label' => TRUE]); } $field_status = []; for ($i = 0; $i < 9; $i++) { if ($i < 8 || self::$settings['enable_deactivation'] == 1) { $field_status[$i] = form_checkbox('user_status['.$i.']', getsuspension($i), (isset($selected_status[$i]) ? 1 : 0), ['input_id' => 'user_status_'.$i, 'reverse_label' => TRUE]); } } $search_bind = []; $search_cond = ''; $field_to_search = array_merge(array_values(['user_name', 'user_id', 'user_email']), array_keys($extra_checkboxes)); if (!empty($_POST['search_text'])) { $search_text = form_sanitizer($_POST['search_text'], '', 'search_text'); if (!empty($search_text)) { $search_cond = 'AND ('; $i = 0; foreach (array_values($field_to_search) as $key) { $search_cond .= "$key LIKE :text_$i".($i == count($field_to_search) - 1 ? '' : ' OR '); $search_bind[':text_'.$i] = '%'.$search_text.'%'; $i++; } $search_cond .= ')'; } } if (!empty($selected_status)) { $status_cond = " WHERE user_status IN (".implode(',', $selected_status).") "; $status_bind = []; foreach ($selected_status as $susp_i) { $statuses[$susp_i] = $susp_i;//''.getsuspension($susp_i).''; } } else { $status_cond = ' WHERE user_status=:status'; $status_bind = [ ':status' => 0, ]; $statuses = [0 => 0]; } $query_bind = array_merge($status_bind, $search_bind); $rowCount = dbcount('(user_id)', DB_USERS, ltrim($status_cond, 'WHERE ').$search_cond, $query_bind); $rowstart = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $rowCount ? intval($_GET['rowstart']) : 0; $limit = 16; $newrows = 0; $newrowsCount = 0; if (in_array(2, $selected_status)) { $newrowsCount = dbcount('(user_name)', DB_NEW_USERS, ''); $nquery = "SELECT * FROM ".DB_NEW_USERS; $nresult = dbquery($nquery); $i = 999999; while ($data = dbarray($nresult)) { $newrows++; $list[$data['user_name']] = [ 'user_id' => $i, 'checkbox' => '', 'user_name' => "