Размер файла: 1.93Kb
- <?
- /*
- =============================================
- Движок: SHCMS Engine
- =============================================
- Название файла: Поиск Новостей
- =============================================
- Official website: http://shcms.ru
- =============================================
- */
- define('SHCMS', true);
- include_once'../system/inc/basic_settings.php';
- $shcmsengine['title'] = 'Поиск новостей';
- include_once'../template/head.php';
- if($_POST['submit'])
- {$submit = $_POST['submit'];}
- if(isset($submit))
- {
- if($_POST['search'])
- {$search = $_POST['search'];}
- $search= stripslashes($search);
- $search = htmlspecialchars($search);
- $search = trim($search);
-
- if(empty($search))
- {
- echo 'Вы не ввели текст для поиска';
- include_once'../template/foot.php';
- exit();
- }
- if(strlen($search) < 0 or strlen($search) > 50)
- {
- echo 'Чтобы найти новость вы должны вводить текст не больше 50символов';
- include_once'../template/foot.php';
- exit();
- }
- $shgu = mysql_query("SELECT id,title,text FROM uncos WHERE MATCH(text) AGAINST('$search')");
- $shok = mysql_fetch_array($shgu);
-
- if($shok['text'] == null)
- {
- echo '<div class="errors">По запросу ('.$search.') не найдено новостей.</div>';
- echo '<div class="uncom"><a href="search.php">Назад</a></div>';
- include_once'../template/foot.php';
- exit();
- }
-
- do
- {
- echo '<div class="uncom"><a href="comments.php?id='.$shok['id'].'">'.$shok['title'].'</a><br/>';
- echo ''.$shok['text']."</div>";
- }
- while($shok = mysql_fetch_array($shgu));
- }
-
-
-
-
- echo '<form action="?'.$conservation.'" method="post">';
- echo 'Введите текст для поиска<br/><input type="text" name="search"><br/>';
- echo '<input type="submit" name="submit" value="Найти новость"><br/>';
- include_once'../template/foot.php';
- ?>