Файл: soc-set/moduls/loads/search.php
Строк: 22
<?php
require_once('../../core/start.php');
require_once('func.php');
check_auth();
head('Поиск файлов');
echo DIV_TITLE . 'Поиск файлов' . CLOSE_DIV;
echo DIV_AUT;
echo '<form action="'.HOME.'/loads/search/" enctype="multipart/form-data" method="POST">';
echo '<b>Поиск:</b> <input type="text" name="q" />';
echo '<input type="submit" name="search" value="Найти" /></form>';
echo CLOSE_DIV;
if (!empty($_POST['search'])) {
$q = html($_POST['q']);
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_FILE." WHERE `name` LIKE '%".$q."%' || `info` LIKE '%".$q."%'");
echo DIV_LI . 'Найдено совпадений: <b>' . $all . '</b>' . CLOSE_DIV;
$n = new Navigator($all,5,'');
$sql = DB::$dbs->query("SELECT * FROM ".LOADS_FILE." WHERE `name` LIKE '%".$q."%' || `info` LIKE '%".$q."%' LIMIT {$n->start()}, 5");
while($file = $sql -> fetch()) {
echo DIV_LI . '<a href="'.HOME.'/loads/'.$file['folder_id'].'/'.$file['folderc_id'].'/'.$file['id'].'/">'.$file['name'].'</a>' . CLOSE_DIV;
}
echo $n->navi();
}
echo DIV_GO . '<a href="'.HOME.'/">Главная</a> / <a href="'.HOME.'/loads/">Загрузки</a> / <b>Поиск файлов</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
?>