File size: 3.71Kb
<?
include("modul/config.php"); include("modul/fun.php");
include("head.php");
switch($act) { case 'search':
$word=zamena($word);
if($time=="all"){ $new=time()-3600*24*800; } if($time=="month"){ $new=time()-3600*24*30; } if($time=="nedel"){ $new=time()-3600*24*7; }
$coun=mysql_query("SELECT COUNT(*) FROM `files` WHERE `name` LIKE '%$word%' and `time`>$new and `ext`='".$type."'"); $count=mysql_result($coun,0);
echo '<div class=list>Результаты поиска по '.$word.'</div>';
echo "<b>Найдено совпадений: $count</b><br>";
$pages=ceil($count/$nast['onpage']); if(!$pages) $pages=1; if($page>$pages or $page<=0) $page=1; if($start>$count or $start<=0) $start=0; if($page) $start =($page-1)*$nast['onpage']; else $start=0;
$query="SELECT * FROM `files` WHERE `name` LIKE '%$word%' and `time`>$new and `ext`='".$type."' LIMIT $start, ".$nast['onpage']."";
$quer=mysql_query($query);
if($count<1) { echo 'Извените, но по вашему запросу ничего не найдено<br>'; }
while($co=mysql_fetch_array($quer)) {
$co['name']=htmlspecialchars($co['name']); $co['opis']=htmlspecialchars($co['opis']);
$ext=pathinfo($co['name'],PATHINFO_EXTENSION);
echo "<div class=hre>";
if($ext=='jpg' or $ext=='gif' or $ext=='jpeg' or $ext=='png' or $ext=='bmp' or $ext=='tiff') { echo '<img src='.$co['infolder'].'/'.$co['name'].' height=60 width=50><br>'; }
if($ext=="nth") { echo '<img src=nth.php?id='.$co['id'].' width=50 height=60><br>'; } if($ext=="jar") { echo '<img src=jar.php?id='.$co['id'].' width=50 height=60><br>'; } if($ext=="thm") { echo '<img src=thm.php?id='.$co['id'].' width=50 height=60><br>'; }
if($co['time']>time()-3600*24*$nast['newfile']) { $new='<font color=red>NEW</font>'; } else { $new=""; }
echo ''.ext($ext).'<a href=view.php?id='.$co['id'].'>'.$co['name'].'</a> ('.size($co['size']).')|<a href=load.php?id='.$co['id'].'>Скачать</a> '.$new.'<br>'; if(mb_strlen($co['opis'],"UTF-8")>50) { $e="..."; } $opis=mb_substr($co['opis'],0,50,"UTF-8"); echo ''.htmlspecialchars($opis).''.$e.'';
echo '</div>';
}
if($count>$nast['onpage']){ echo '<br>'; $asd=$page-2; $asd2=$page+3; if($asd<$count && $asd>0 && $page>3) echo '<a href=search.php?act=search&word='.$word.'&time='.$time.'&type='.$type.'&page=1>1</a> ... '; for($i=$asd;$i<$asd2;$i++) { if($i<$count && $i>0) { if ($i>$pages) break; if($page==$i) echo '<strong>['.$i.']</strong>'; else echo '<a href=search.php?act=search&word='.$word.'&time='.$time.'&type='.$type.'&page='.$i.'>'.$i.'</a>'; } } if($i<=$pages) { if($asd2<$count) echo ' ... <a href=search.php?act=search&word='.$word.'&time='.$time.'&type='.$type.'&page='.$pages.'>'.$pages.'</a>'; } echo '<br>'; }
break; default:
echo "<hr>";
echo "<form action=search.php?act=search method=post>";
echo "Введите искомое слово: <br><input type=text name=word>";
echo 'Искать по: <br><select name=type><option value=jpeg>jpeg<option value=jpg>jpg<option value=jpe>jpe<option value=gif>gif<option value=png>png<option value=bmp>bmp<option value=3gp>3gp<option value=avi>avi<option value=mp4>mp4<option value=wmv>wmv<option value=mpg>mpg<option value=mp3>mp3<option value=wav>wav<option value=wma>wma<option value=amr>amr<option value=aac>aac<option value=asf>asf<option value=jar>jar<option value=sis>sis<option value=jad>jad<option value=sisx>sisx<option value=thm>thm<option value=nth>nth<option value=sdt>sdt<option value=zip>zip<option value=rar>rar<option value=7z>7z</select><br>';
echo 'Искать за: <select name=time><option value=all>все время<option value=month>за последний месяц<option value=nedel>за последнюю неделю</select><br>';
echo "<br><input type=submit value=Поиск><br>";
break;
}
include("foot.php");
?>