DimonVideo , вот остальная часть кода
----------------------------------------------------------------- Принимаем данные, выводим форму поиска ----------------------------------------------------------------- */ $search_post = isset($_POST['search']) ? trim($_POST['search']) : false; $search_get = isset($_GET['search']) ? rawurldecode(trim($_GET['search'])) : false; $search = $search_post ? $search_post : $search_get; //$search = preg_replace("/[^\w\x7F-\xFF\s]/", " ", $search); $search_n = isset($_REQUEST['n']); echo '
' . $lng_stars['stars'] . ' | ' . $lng_stars['search_stars'] . ' ' . // '' . $lng_stars['search_info'] . ' ' . ' ' . '' . // ' ' . // ' ' . $lng_stars['search_name'] . ' '; /* ----------------------------------------------------------------- Проверям на ошибки ----------------------------------------------------------------- */ $error = false; if ($search && (mb_strlen($search) 64)) $error = $lng['error_search_length']; if ($search && !$error) { /* ----------------------------------------------------------------- Выводим результаты запроса ----------------------------------------------------------------- */ $array = explode(' ', $search); $count = count($array); $query = mysql_real_escape_string($search); $total = mysql_result(mysql_query(" SELECT COUNT(*) FROM `stars` WHERE MATCH (" . ($search_n ? '`name`' : '`films`') . ") AGAINST ('$query' IN BOOLEAN MODE) AND `type` = '1' "), 0); echo '
' . $lng['search_results'] . ' '; if ($total > $kmess) echo '' . functions::display_pagination('films.php?' . ($search_n ? 'n=1&' : '') . 'search=' . urlencode($search) . '&', $start, $total, $kmess) . ' '; if ($total) { $req = mysql_query(" SELECT * FROM `stars` WHERE MATCH (" . ($search_n ? '`name`' : '`films`') . ") AGAINST ('$query' IN BOOLEAN MODE) AND `type` = '1' LIMIT $start, $kmess "); $i = 0; $razm = $agent_web == 'web' ? '64' : '32'; while (($res = mysql_fetch_assoc($req)) !== false) { echo $i % 2 ? '
' : '
'; echo ''; if (!$search_n) { // Поиск только в фильмах $req_t = mysql_query("SELECT * FROM `stars` WHERE `id` = '" . $res['id'] . "'"); $res_t = mysql_fetch_assoc($req_t); if(file_exists('photo/' . $res['id'] . '.jpg')) echo ' '; elseif(file_exists('photo/' . $res['id'] . '.jpeg')) echo ' '; elseif(file_exists('photo/' . $res['id'] . '.bmp')) echo ' '; elseif(file_exists('photo/' . $res['id'] . '.png')) echo ' '; elseif(file_exists('photo/' . $res['id'] . '.gif')) echo ' '; echo ($agent_web == 'web' ? '' : '') . '' . $res_t['name'] . ' '; } else { // Поиск в именах $req_p = mysql_query("SELECT * FROM `stars` WHERE `id` = '" . $res['id'] . "'"); $res_p = mysql_fetch_assoc($req_p); foreach($array as $val){ $res['name'] = ReplaceKeywords($val, $res['name']); } if(file_exists('photo/' . $res_p['id'] . '.jpg')) echo ' '; elseif(file_exists('photo/' . $res_p['id'] . '.jpeg')) echo ' '; elseif(file_exists('photo/' . $res_p['id'] . '.bmp')) echo ' '; elseif(file_exists('photo/' . $res_p['id'] . '.png')) echo ' '; elseif(file_exists('photo/' . $res_p['id'] . '.gif')) echo ' '; echo ($agent_web == 'web' ? '' : '') . '' . $res_p['name'] . ' '; } $text = null; if($search_n) { $films = explode(';', $res_p['films']); foreach($films as $key) { $key = trim($key); $text .= '' . $key . ', '; } } else { $films = explode(';', $res['films']); foreach($films as $key) { $key = trim($key); $text .= '' . $key . ', '; } } //$text = $search_n ? $res_p['films'] : $res['name']; foreach ($array as $srch) if (($pos = mb_strpos(strtolower($res['name']), strtolower(str_replace('*', '', $srch)))) !== false) break; if(!isset($pos) || $pos < 100) $pos = 100; //$text = preg_replace('#\[c\](.*?)\[/c\]#si', '
\1 ', $text); //$text = functions::checkout(mb_substr($text, ($pos - 100), 400), 1); if (!$search_t) { foreach($array as $val){ $text = ReplaceKeywords($val, $text); } } if(!empty($res['films'])) { $text2 = explode(',', $text); unset($text2[end($text2)]); unset($text2[count($text2)-1]); $texts = array(); //$text2 = implode(',', $text2); foreach($text2 as $keys) { if($keys != end($text2)) $pref = ','; else $pref = ''; $texts[] = $keys.$pref; } echo $lng_stars['films'] . ': ' . implode('', $texts) . ' '; } echo ' '; ++$i; } } else { echo ' ' . $lng['search_results_empty'] . ' '; } echo '
' . $lng['total'] . ': ' . $total . ' '; if ($total > $kmess) { echo '' . functions::display_pagination('films.php?' . ($search_t ? 't=1&' : '') . 'search=' . urlencode($search) . '&', $start, $total, $kmess) . ' ' . ' ' . '' . '' . ' '; } } else { if ($error) echo functions::display_error($error); echo '
' . $lng_stars['search_help'] . ' '; } echo ' ' . ($search ? '' . $lng['search_new'] . ' ' : '') . '' . $lng_stars['stars'] . ' ';