",, "<" $new1 = array("%"); #Меняем на полезное">", , "<" $text = str_replace($old1, $new1, $text); #Собсно сама замена =) return $text; } $_GET['id'] = ekr($_GET['id']); //print_r($_POST); $array = \DBmysql::getAll( "SELECT `id`, `title`, `cena`, `json` FROM `tovar` WHERE `status`=1 AND ( `title` LIKE '%" . $_GET['id'] . "%' OR `json` LIKE '%" . $_GET['id'] . "%' )");//LIMIT 24 $smarty->assign('title', "Поиск по сайту - " . $_GET['id']); $c = count($array); for ($i = 0; $i < $c; $i++) { $m = \core::j($array[$i]['json']); $array[$i]['img'] = $m['images'][0]; $array[$i]['artikul'] = ($m['artikul']) ? $m['artikul'] : $m['code']; } $massiv2 = \core::array_unique_key($array, 'id'); $smarty->assign('list', $massiv2); //уникализируем массив и выводим в шаблон $user=($_SESSION['user_id'])?$_SESSION['user_id']:session_id(); /* История персонального поиска */ $id = \DBmysql::getValue("SELECT `id` FROM `find_history` WHERE `txt`=? AND `token`=? LIMIT 1", [$_SESSION['find'], $user]); if (!$id) \DBmysql::add("INSERT INTO `find_history` (`txt`, `token`, `t`) VALUES (?, ?, ?)", [$_SESSION['find'], $user, time()]); $findh = \DBmysql::getAll("SELECT `txt` FROM `find_history` WHERE `token`=? ORDER BY `id` DESC LIMIT 500", $user); $smarty->assign('findh', $findh); $smarty->assign('count', \DBmysql::getValue("SELECT COUNT(*) FROM `tovar` WHERE `status`=1 AND (`title` LIKE '%" . $_GET['id'] . "%' OR `json` LIKE '%" . $_GET['id'] . "%' ) LIMIT 24")); ?>