Размер файла: 2.27Kb
- <?
- /*
- =============================================
- Движок: 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 * FROM `uncos` WHERE MATCH(`title`,`text`) AGAINST('$search' IN BOOLEAN MODE)");
- $shok = mysql_fetch_array($shgu);
-
- if($shok['text'] == null)
- {
- echo '<div class="errors">По вашему запросу не найдено новостей</div>';
- echo '<div class="posts"><a href="search.php">Назад</a></div>';
- include_once'../template/foot.php';
- exit();
- }
- do
- {
- $uncos_comments = mysql_result(mysql_query("SELECT COUNT(*) FROM `uncos_comment` WHERE `id_uncos` = '$shok[id]'"),0);
- echo '<div class="posts">
-
- <strong><a href="comments.php?id='.$shok['id'].'">'.$shok['title'].'</a></strong> ('.$uncos_comments.')
- <br/>';
- echo ''.$shok['text']."</div>";
- }
- while($shok = mysql_fetch_array($shgu));
- }
-
-
-
-
- echo '<form action="?" method="post">';
- echo 'Текст поиска:<br/><input type="text" name="search"><br/>';
- echo '<input type="submit" name="submit" value="Найти новость"><br/>';
-
-
- include_once'../template/foot.php';
-
- ?>