Просмотр файла downs/search.php

Размер файла: 3.97Kb
  1. <?php
  2.  
  3. $title='Поиск файлов';
  4. require"../system/config.php";
  5. require"../system/func";
  6. require"../system/head.php";
  7. require"../system/error.php";
  8.  
  9. echo'<div class="i">'.$title.'<br></div>';
  10. switch($_GET['act']){
  11. case 'go':
  12. echo'<form action="search.php?" method="get">Введите,что исчите:<br />
  13. <input name="see" type="text" size="18" class="form" value=""/><br />Искать:<br><select name="g" class="form"><option value="1">В описание</option><option value="2">В название</option></select><br>
  14. <input type="submit" value="Искать" class="but"></form>';
  15. break;
  16. default:
  17. $g=check((int)$_GET['g']);
  18.  
  19. $see=check($_GET['see']);
  20. if($g==0 or $g=="" or $see==""){echo'Произошла ошибка'; require"../system/foot.php"; exit;}
  21.  
  22. if($g==1 or $g==2){}else{echo'Произошла ошибка'; require"../system/foot.php"; exit;}
  23.  
  24.  
  25. if(isset($_GET['st'])){$st=cifry($_GET['st']);}else{$st=0;}
  26.  
  27. if(isset($_POST['str'])){$str=cifry($_POST['str']);}else{$str=0;}
  28.  
  29.  
  30. if(!empty($str)){$st=$str*10-10;}
  31. if(empty($st) or $st<0){$st=0;}
  32. $num=10;
  33. if($g==1){
  34. $ptt='file';
  35. $adata=mysql_query("SELECT * FROM `down_files` WHERE `opis` LIKE '%".$see."%' AND `typer`='$ptt'");
  36. $sdata=mysql_query("SELECT * FROM `down_files` WHERE `opis` LIKE '%".$see."%' AND `typer`='$ptt' ORDER BY `id_file` DESC LIMIT $st,$num");}
  37. if($g==2){
  38.  
  39. $ptt='file';
  40. $adata=mysql_query("SELECT * FROM `down_files` WHERE `name` LIKE '%".$see."%' AND `typer`='$ptt'");
  41. $sdata=mysql_query("SELECT * FROM `down_files` WHERE `name` LIKE '%".$see."%' AND `typer`='$ptt' ORDER BY `id_file` DESC LIMIT $st,$num");}
  42. $kol=mysql_num_rows($adata);
  43.  
  44. if($st>$kol){echo'Не верный номер страници'; require"../system/foot.php"; exit;}
  45. if($kol==0){
  46. echo'<div class="p">
  47. По вашему запросу, ничего не найдено..<br>
  48. </div>';
  49. }else{ echo'<div class="i">Результатов '.$kol.'<br></div>';
  50. while($ofile=mysql_fetch_array($sdata)){
  51.  
  52. $newcolor=mysql_num_rows(mysql_query("SELECT * FROM `down_files` WHERE `dobav`>'".(time()-86400*3)."' AND `typer`!='dir' AND `id_file`='".$ofile['id_file']."'"));
  53. $dokuda='../down/'.$ofile['put'].'/'.$ofile['nastna'].'.'.$ofile['format']; #Путь до файла
  54. $vesma=round(filesize($dokuda)/1024); #Вес файла
  55. if($vesma==0){$vesma='Менее 1';}
  56. echo'<div class="p">';
  57. if(empty($ofile['name'])){
  58. $ofile['name']=$ofile['nastna'].'.'.$ofile['format'];
  59. }
  60.  
  61. echo'<b>Имя:</b> <a href="'.$ofile['id_file'].'.info">'; if($newcolor==1){echo'<font color="red">';}
  62. echo $ofile['name'];
  63. if($newcolor==1){echo'</font>';}
  64. echo'</a><br><b>Описание: </b>'; if($ofile['opis']==""){echo'нет';}else{echo mb_substr($ofile['opis'],0,300,'UTF-8');} echo'<br>
  65. <small>Скачали: '.$ofile['loads'].' раз<br></small>
  66. <a href="load.php?id_load='.$ofile['id_file'].'&amp;'.$s.'">Скачать</a> ['.strtoupper($ofile['format']).'] ['.$vesma.'Кб]<br>
  67. ';
  68. $koments=mysql_num_rows(mysql_query("select * from koments where type='downs' and id_kogo='".$ofile['id_file']."'"));
  69.  
  70. $koments=mysql_num_rows(mysql_query("select * from koments where type='downs' and id_kogo='".$ofile['id_file']."'"));
  71. echo'<a href="../pages/koments.php?id_wm='.$ofile['id_file'].'&amp;type=downs&amp;'.$s.'">Комментарии</a> ['.$koments.']<br>
  72. </div>';
  73.  
  74.  
  75. }}
  76.  
  77.  
  78. if($st!=0){
  79. echo'<div class="p"><img src="../design/default/act.gif" alt="-"> <a href="search.php?st='.($st-$num).'&amp;day='.$day.'&amp;'.$s.'">Назад</a><br></div>';
  80. }
  81. if($kol>$st+$num){
  82. echo'<div class="p"><img src="../design/default/act.gif" alt="-"> <a href="searh.php?st='.($st+$num).'&amp;day='.$day.'&amp;'.$s.'">Вперед</a><br></div>';}
  83.  
  84. if($kol>10){
  85. echo'<div class="p">
  86. <form action="searh.php?day='.$day.'&amp;'.$s.'" method="post">
  87. На страницу (1-'.ceil(($kol/10)).'):<br>
  88. <input type="text" name="str" maxlength="4" class="form" size="3" value="'.ceil(($kol/10)).'">
  89. <input type="submit" value="ОК" class="but"><br>
  90. </form></div>';}
  91.  
  92. break;
  93. } require"../system/foot.php";
  94. ?>