function table_filter($tables, $filter) { $filter = trim($filter); if ($filter) { foreach ($tables as $k => $table) { if (!str_has_any($table, $filter, $ignore_case = true)) { unset($tables[$k]); } } } return $tables; }
<?php if (GET("searchdb", "bool")) { // ---------------------------------------------------------------- // @searchdb PHP // ---------------------------------------------------------------- GET("types", "array"); GET("search", "string"); GET("md5", "bool"); GET("table_filter", "string"); $_GET['search'] = trim($_GET['search']); $tables = list_tables(); if ($_GET['table_filter']) { foreach ($tables as $k => $table) { if (!str_has_any($table, $_GET['table_filter'], $ignore_case = true)) { unset($tables[$k]); } } } $all_types = array(); $columns = array(); foreach ($tables as $table) { $types = table_columns($table); $columns[$table] = $types; $types = array_values($types); $all_types = array_merge($all_types, $types); } $all_types = array_unique($all_types); if ($_GET['search'] && $_GET['md5']) { $_GET['search'] = md5($_GET['search']);