function ShowSearchPage() { global $LNG, $db; if ($_GET['delete'] == 'user') { DeleteSelectedUser((int) $_GET['user']); message($LNG['se_delete_succes_p'], '?page=search&search=users&minimize=on', 2); } elseif ($_GET['delete'] == 'planet') { DeleteSelectedPlanet((int) $_GET['planet']); message($LNG['se_delete_succes_p'], '?page=search&search=planet&minimize=on', 2); } $SearchFile = request_var('search', ''); $SearchFor = request_var('search_in', ''); $SearchMethod = request_var('fuki', ''); $SearchKey = request_var('key_user', ''); $Page = request_var('side', 0); $Order = request_var('key_order', ''); $OrderBY = request_var('key_acc', ''); $limit = request_var('limit', 25); $Selector = array('list' => array('users' => $LNG['se_users'], 'planet' => $LNG['se_planets'], 'moon' => $LNG['se_moons'], 'alliance' => $LNG['se_allys'], 'vacation' => $LNG['se_vacations'], 'banned' => $LNG['se_suspended'], 'admin' => $LNG['se_authlevels'], 'inactives' => $LNG['se_inactives'], 'online' => $LNG['online_users'], 'p_connect' => $LNG['se_planets_act']), 'search' => array('name' => $LNG['se_input_name'], 'id' => $LNG['input_id']), 'filter' => array('normal' => $LNG['se_type_all'], 'exacto' => $LNG['se_type_exact'], 'last' => $LNG['se_type_last'], 'first' => $LNG['se_type_first']), 'order' => array('ASC' => $LNG['se_input_asc'], 'DESC' => $LNG['se_input_desc']), 'limit' => array('1' => '1', '5' => '5', '10' => '10', '15' => '15', '20' => '20', '25' => '25', '50' => '50', '100' => '100', '200' => '200', '500' => '500')); $template = new template(); $template->page_header(); if (request_var('minimize', '') == 'on') { $Minimize = "&minimize=on"; $template->assign_vars(array('minimize' => 'checked = "checked"', 'diisplaay' => 'style="display:none;"')); } switch ($SearchMethod) { case 'exacto': $SpecifyWhere = "= '" . $db->sql_escape($SearchKey) . "'"; break; case 'last': $SpecifyWhere = "LIKE '" . $db->sql_escape($SearchKey, true) . "%'"; break; case 'first': $SpecifyWhere = "LIKE '%" . $db->sql_escape($SearchKey, true) . "'"; break; default: $SpecifyWhere = "LIKE '%" . $db->sql_escape($SearchKey, true) . "%'"; break; } if (!empty($SearchFile)) { $ArrayUsers = array("users", "vacation", "admin", "inactives", "online"); $ArrayPlanets = array("planet", "moon", "p_connect"); $ArrayBanned = array("banned"); $ArrayAlliance = array("alliance"); if (in_array($SearchFile, $ArrayUsers)) { $Table = "users"; $NameLang = $LNG['se_search_users']; $SpecifyItems = "id,username,email_2,onlinetime,register_time,user_lastip,authlevel,bana,urlaubs_modus"; $SName = $LNG['se_input_userss']; if ($SearchFile == "vacation") { $SpecialSpecify = "AND urlaubs_modus = '1'"; $SName = $LNG['se_input_vacatii']; } if ($SearchFile == "online") { $SpecialSpecify = "AND onlinetime >= '" . (TIMESTAMP - 15 * 60) . "'"; $SName = $LNG['se_input_connect']; } if ($SearchFile == "inactives") { $SpecialSpecify = "AND onlinetime < '" . (TIMESTAMP - 60 * 60 * 24 * 7) . "'"; $SName = $LNG['se_input_inact']; } if ($SearchFile == "admin") { $SpecialSpecify = "AND authlevel <= '" . $USER['authlevel'] . "' AND authlevel > '0'"; $SName = $LNG['se_input_admm']; } $SearchFor == "name" ? $WhereItem = "WHERE username" : ($WhereItem = "WHERE id"); $ArrayOSec = array("id", "username", "email_2", "onlinetime", "register_time", "user_lastip", "authlevel", "bana", "urlaubs_modus"); $Array0SecCount = count($ArrayOSec); for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) { $OrderBYParse[$ArrayOSec[$OrderNum]] = $LNG['se_search_users'][$OrderNum]; } } elseif (in_array($SearchFile, $ArrayPlanets)) { $Table = "planets"; $TableUsers = "2"; $NameLang = $LNG['se_search_planets']; $SpecifyItems = "id,name,id_owner,last_update,galaxy,system,planet,id_luna"; if ($SearchFile == "planet") { $SpecialSpecify = "AND planet_type = '1'"; $SName = $LNG['se_input_planett']; } if ($SearchFile == "moon") { $SpecialSpecify = "AND planet_type = '3'"; $SName = $LNG['se_input_moonn']; } if ($SearchFile == "p_connect") { $SpecialSpecify = "AND last_update >= '" . (TIMESTAMP - 60 * 60) . "'"; $SName = $LNG['se_input_act_pla']; } $SearchFor == "name" ? $WhereItem = "WHERE name" : ($WhereItem = "WHERE id"); $ArrayOSec = array("id", "name", "id_owner", "id_luna", "last_update", "galaxy", "system", "planet"); $Array0SecCount = count($ArrayOSec); for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) { $OrderBYParse[$ArrayOSec[$OrderNum]] = $LNG['se_search_planets'][$OrderNum]; } } elseif (in_array($SearchFile, $ArrayBanned)) { $Table = "banned"; $NameLang = $LNG['se_search_banned']; $SpecifyItems = "id,who,time,longer,theme,author"; $SName = $LNG['se_input_susss']; $SearchFor == "name" ? $WhereItem = "WHERE who" : ($WhereItem = "WHERE id"); $ArrayOSec = array("id", "who", "time", "longer", "theme", "author"); $Array0SecCount = count($ArrayOSec); for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) { $OrderBYParse[$ArrayOSec[$OrderNum]] = $LNG['se_search_banned'][$OrderNum]; } } elseif (in_array($SearchFile, $ArrayAlliance)) { $Table = "alliance"; $NameLang = $LNG['se_search_alliance']; $SpecifyItems = "id,ally_name,ally_tag,ally_owner,ally_register_time,ally_members"; $SName = $LNG['se_input_allyy']; $SearchFor == "name" ? $WhereItem = "WHERE ally_name" : ($WhereItem = "WHERE id"); $ArrayOSec = array("id", "ally_name", "ally_tag", "ally_owner", "ally_register_time", "ally_members"); $Array0SecCount = count($ArrayOSec); for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) { $OrderBYParse[$ArrayOSec[$OrderNum]] = $LNG['se_search_alliance'][$OrderNum]; } } $RESULT = MyCrazyLittleSearch($SpecifyItems, $WhereItem, $SpecifyWhere, $SpecialSpecify, $Order, $OrderBY, $limit, $Table, $Page, $NameLang, $ArrayOSec, $Minimize, $SName, $SearchFile); } $template->assign_vars(array('Selector' => $Selector, 'limit' => $limit, 'search' => $SearchKey, 'SearchFile' => $SearchFile, 'SearchFor' => $SearchFor, 'SearchMethod' => $SearchMethod, 'Order' => $Order, 'OrderBY' => $OrderBY, 'OrderBYParse' => $OrderBYParse, 'se_search' => $LNG['se_search'], 'se_limit' => $LNG['se_limit'], 'se_asc_desc' => $LNG['se_asc_desc'], 'se_filter_title' => $LNG['se_filter_title'], 'se_search_in' => $LNG['se_search_in'], 'se_type_typee' => $LNG['se_type_typee'], 'se_intro' => $LNG['se_intro'], 'se_search_title' => $LNG['se_search_title'], 'se_contrac' => $LNG['se_contrac'], 'se_search_order' => $LNG['se_search_order'], 'ac_minimize_maximize' => $LNG['ac_minimize_maximize'], 'LIST' => $RESULT['LIST'], 'PAGES' => $RESULT['PAGES'])); $template->show('adm/SearchPage.tpl'); }
} elseif (in_array($SearchFile, $ArrayBanned)) { $Table = "banned"; $NameLang = $lang['se_search_banned']; $SpecifyItems = "id,who,time,longer,theme,author"; $SName = $lang['se_input_susss']; $SearchFor == "name" ? $WhereItem = "WHERE who" : ($WhereItem = "WHERE id"); $ArrayOSec = array("id", "who", "time", "longer", "theme", "author"); $Array0SecCount = count($ArrayOSec); for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) { $OrderBYParse .= '<option value="' . $ArrayOSec[$OrderNum] . '"' . ($Order == $ArrayOSec[$OrderNum] ? " selected" : "") . '>' . $lang['se_search_banned'][$OrderNum] . '</option>'; } } elseif (in_array($SearchFile, $ArrayAlliance)) { $Table = "alliance"; $NameLang = $lang['se_search_alliance']; $SpecifyItems = "id,ally_name,ally_tag,ally_owner,ally_register_time,ally_members"; $SName = $lang['se_input_allyy']; $SearchFor == "name" ? $WhereItem = "WHERE ally_name" : ($WhereItem = "WHERE id"); $ArrayOSec = array("id", "ally_name", "ally_tag", "ally_owner", "ally_register_time", "ally_members"); $Array0SecCount = count($ArrayOSec); for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) { $OrderBYParse .= '<option value="' . $ArrayOSec[$OrderNum] . '"' . ($Order == $ArrayOSec[$OrderNum] ? " selected" : "") . '>' . $lang['se_search_alliance'][$OrderNum] . '</option>'; } } $parse['ORDER_BY_TITLE'] = "<th>\r\n\t\t\t" . $lang['se_search_order'] . "\r\n\t\t</th>"; $parse['ORDER_BY'] = "<th>\r\n\t\t\t\t<select name=\"key_order\">\r\n\t\t\t\t\t" . $OrderBYParse . "\r\n\t\t\t\t</select>\r\n\t\t\t</th>"; $parse['TPL_ROW'] = MyCrazyLittleSearch($SpecifyItems, $WhereItem, $SpecifyWhere, $SpecialSpecify, $Order, $OrderBY, $Limit, $Table, $Page, $NameLang, $ArrayOSec, $Minimize, $SName); } $Micro = explode(" ", microtime()); $Time_Two = $Micro[1] + $Micro[0] - $Time_One; $parse['TimeToCreatePage'] = $lang['se_time_of_page'] . $Time_Two . " " . $lang['time_seconds']; display(parsetemplate(gettemplate('adm/SearchInDBBody'), $parse), false, '', true, false);