View file download/search.php

File size: 2.2Kb
<?php
/*
=============================================
Движок: SHCMS Engine
=============================================
Название файла: Поиск по обменнику
=============================================
Official website: http://shcms.ru
=============================================
*/
define('SHCMS', true);
include_once'../system/inc/basic_settings.php';
$shcmsengine['title'] = 'Поиск в обменнике по запросу ('.$_POST['search'].')';
include_once'../template/head.php';
if($_POST['submit'])
{
$submit = $_POST['submit'];
}

if(isset($submit))
{
if($_POST['search'])
{$search = $_POST['search'];}
$search = htmlspecialchars($search);
$search = stripslashes($search);
if(empty($search))
{
echo '<div class="errors">Вы ничего не ввели</div>';
header('Refresh: 1; url=?' . $conservation . '&' );
include_once'../template/foot.php';
exit();
}

if(strlen($search)< 3 || strlen($search) >50)
{
echo '<div class="errors">Название должно быть больше 3 и меньше 50символов</div>';
header('Refresh: 1; url=?' . $conservation . '&' );
include_once'../template/foot.php';
exit();
}

$sea = mysql_query("SELECT id,name FROM download_file WHERE MATCH(name) AGAINST('$search')");

$search_count = mysql_result(mysql_query("SELECT COUNT(*) FROM download_file WHERE MATCH(name) AGAINST('$search')"),0);

echo '<div class="mysql_yes">Найдено <b>'.$search_count.'</b> файлов</div>';

if(mysql_num_rows($sea) > 0)
{
$sear = mysql_fetch_array($sea);
do
{
echo '<div class="posts"><a href="files.php?id='.$sear['id'].'">'.$sear['name'].'</a></div>';
}
while($sear = mysql_fetch_array($sea));
}
else
{
echo '<div class="errors">По вашему запросу ('.$search.') ничего не найдено</div>';
header('Refresh: 1; url=?' . $conservation . '&' );
include_once'../template/foot.php';
exit();
}


}


echo '<hr/><form action="search.php" method="post">';
echo 'Название файла:<br/><input type="text" name="search">';
echo '<input type="submit" name="submit" value="Найти"></form>';






include_once'../template/foot.php';


?>