Файл: user/shared_zona/search.php
Строк: 38
<?
/*
# by gold_spaces
*/
include '../../connect.php';
include 'func.php';
include '../../head.php';
echo '<div class="title">Поиск файлов</div>';
echo '<div class="main"><form action="?" method="POST">Введите полное название или часть:<br/><input type="text" name="text"><br/>
<input type="submit" name="search"></div>';
if(isset($_POST['search'])){
$s = check($_POST['text']);
if(empty($s)){
msg('пустое поле');
} else {
$kol = mysql_result(mysql_query("SELECT count(id) FROM `down` WHERE `name` LIKE '%$s%'"),0);
if($kol ==0){msg('Ничего не найдено');}
$total = intval(($all - 1) / 15) + 1;
$page = num($_GET['page']);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * 15 - 15;
$search = mysql_query("SELECT * FROM `down` WHERE `name` LIKE '%$s%' ORDER BY `time` DESC LIMIT $start,15");
while($a = mysql_fetch_assoc($search)){
$size = filesize($a['file']);
$ext = strtolower(strrchr($a['file'], '.'));
if ($ext == '.zip') $format = '<img src="img/zip.png" alt="*"/> ';
elseif ($ext == '.3gp' || $ext == '.mp4' || $ext == '.avi' || $ext == '.flv')
$format = '<img src="img/3gp.png" alt="*"/> ';
elseif ($ext == '.rar') $format = '<img src="img/rar.png" alt="*"/> ';
elseif ($ext == '.png') $format = '<img src="img/png.png" alt="*"/> ';
elseif ($ext == '.jpg')
$format = '<img src="img/jpg.png" alt="*"/> ';
elseif ($ext == '.gif')
$format = '<img src="img/jpg.png" alt="*"/> ';
elseif ($ext == '.mp3')
$format = '<img src="img/mp3.png" alt="*"/> ';
elseif ($ext == '.jar')
$format = '<img src="img/jar.png" alt="*"/> ';
else $format = '<img src="img/unknown.gif" alt="*"/> ';
echo '<a class="touch" href="info.php?id='.$a['id'].'">'.$format.' '.$a['name'].' ('.size($size).') ('.vremya($a['time']).')</a>';
}
}
}
navigation($page, $total,'?&');
include '../../foot.php';
?>