Просмотр файла forum/files.php

Размер файла: 22.17Kb
<?php

$title='Файлы'; 
require"../system/config.php";
 require"../system/func.php";
 require"../system/head.php";
 require"../system/error.php";  
 echo'<div class="i" align="center">'.$title.'</div>';

if(isset($_GET['id_forum'])){$id_forum=cifry($_GET['id_forum']);}else{$id_forum=0;}
if(isset($_GET['id_them'])){$id_them=cifry($_GET['id_them']);}else{$id_them=0;}
 switch($_GET['act']){
default:
if($id_forum==0 and $id_them==0){ $all=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f`!=''"),0);    $cou8=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.mp3' OR `file_f` LIKE '%.wav' OR `file_f` LIKE '%.mid' OR `file_f` LIKE '%.wma' OR `file_f` LIKE '%.mmf' OR `file_f` LIKE '%.amr'"),0);
$cou1=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.exe'"),0); $cou2=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.sis'"),0);
$cou3=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.jar' OR `file_f` LIKE '%.jad'"),0); $cou4=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.txt'"),0); $cou6=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.3gp' OR `file_f` LIKE '%.mp4' OR `file_f` LIKE '%.avi'"),0); $cou5=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.zip' OR `file_f` LIKE '%.rar'"),0);
$cou7=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.gif' OR `file_f` LIKE '%.jpg' OR `file_f` LIKE '%.png' OR `file_f` LIKE '%.jpeg'"),0); echo'<div class="p"><img src="/images/forum/1.png" alt=""> <a href="/forum/files.php?act=view&amp;fid=1">Приложения EXE</a> ['.$cou1.']</div><div class="p"><img src="/images/forum/2.png" alt=""> <a href="/forum/files.php?act=view&amp;fid=2">Приложения SIS</a> ['.$cou2.']</div>
<div class="p"><img src="/images/forum/3.png" alt=""> <a href="/forum/files.php?act=view&amp;fid=3">Приложения JAVA</a> ['.$cou3.']</div><div class="p"><img src="/images/forum/4.png" alt=""> <a href="/forum/files.php?act=view&amp;fid=4">Текстовые файлы</a> ['.$cou4.']</div>
<div class="p"><img src="/images/forum/5.png" alt=""> <a href="/forum/files.php?act=view&amp;fid=5">Архивы</a> ['.$cou5.']</div><div class="p"><img src="/images/forum/6.png" alt=""> <a href="/forum/files.php?act=view&amp;fid=6">Видео</a> ['.$cou6.']</div><div class="p"><img src="/images/forum/7.png" alt=""> <a href="/forum/files.php?act=view&amp;fid=7">Картинки</a> ['.$cou7.']</div>
<div class="p"><img src="/images/forum/8.png" alt=""> <a href="/forum/files.php?act=view&amp;fid=8">Музыка</a> ['.$cou8.']</div>';  echo'<div class="p">Файлов: '.$all.'</div>';}
if($id_forum!=0 and $id_them==0){ $all=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f`!='' AND `id_kat`='$id_forum'"),0);    $cou8=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE (`file_f` LIKE '%.mp3' OR `file_f` LIKE '%.wav' OR `file_f` LIKE '%.mid' OR `file_f` LIKE '%.wma' OR `file_f` LIKE '%.mmf' OR `file_f` LIKE '%.amr') AND `id_kat`='$id_forum'"),0); $cou1=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.exe' AND `id_kat`='$id_forum'"),0); $cou2=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.sis' AND `id_kat`='$id_forum'"),0); $cou3=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE (`file_f` LIKE '%.jar' OR `file_f` LIKE '%.jad') AND `id_kat`='$id_forum'"),0); $cou4=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.txt' AND `id_kat`='$id_forum'"),0);  $cou6=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE (`file_f` LIKE '%.3gp' OR `file_f` LIKE '%.mp4' OR `file_f` LIKE '%.avi') AND `id_kat`='$id_forum'"),0);  $cou5=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE (`file_f` LIKE '%.zip' OR `file_f` LIKE '%.rar') AND `id_kat`='$id_forum'"),0);
$cou7=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE (`file_f` LIKE '%.gif' OR `file_f` LIKE '%.jpg' OR `file_f` LIKE '%.png' OR `file_f` LIKE '%.jpeg') AND `id_kat`='$id_forum'"),0); echo'<div class="p"><img src="/images/forum/1.png" alt=""> <a href="/forum/files.php?act=view&amp;id_forum='.$id_forum.'&amp;fid=1">Приложения EXE</a> ['.$cou1.']</div><div class="p"><img src="/images/forum/2.png" alt=""> <a href="/forum/files.php?act=view&amp;id_forum='.$id_forum.'&amp;fid=2">Приложения SIS</a> ['.$cou2.']</div><div class="p"><img src="/images/forum/3.png" alt=""> <a href="/forum/files.php?act=view&amp;id_forum='.$id_forum.'&amp;fid=3">Приложения JAVA</a> ['.$cou3.']</div><div class="p"><img src="/images/forum/4.png" alt=""> <a href="/forum/files.php?act=view&amp;id_forum='.$id_forum.'&amp;fid=4">Текстовые файлы</a> ['.$cou4.']</div><div class="p"><img src="/images/forum/5.png" alt=""> <a href="/forum/files.php?act=view&amp;id_forum='.$id_forum.'&amp;fid=5">Архивы</a> ['.$cou5.']</div>
<div class="p"><img src="/images/forum/6.png" alt=""> <a href="/forum/files.php?act=view&amp;id_forum='.$id_forum.'&amp;fid=6">Видео</a> ['.$cou6.']</div><div class="p"><img src="/images/forum/7.png" alt=""> <a href="/forum/files.php?act=view&amp;id_forum='.$id_forum.'&amp;fid=7">Картинки</a> ['.$cou7.']</div><div class="p"><img src="/images/forum/8.png" alt=""> <a href="/forum/files.php?act=view&amp;id_forum='.$id_forum.'&amp;fid=8">Музыка</a> ['.$cou8.']</div>';
echo'<div class="p">Файлов: '.$all.'</div>';}
if($id_forum==0 and $id_them!=0){ $all=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f`!='' AND `id_them`='$id_them'"),0);    $cou8=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE (`file_f` LIKE '%.mp3' OR `file_f` LIKE '%.wav' OR `file_f` LIKE '%.mid' OR `file_f` LIKE '%.wma' OR `file_f` LIKE '%.mmf' OR `file_f` LIKE '%.amr') AND `id_them`='$id_them'"),0); $cou1=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.exe' AND `id_them`='$id_them'"),0); $cou2=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.sis' AND `id_them`='$id_them'"),0); $cou3=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE (`file_f` LIKE '%.jar' OR `file_f` LIKE '%.jad') AND `id_them`='$id_them'"),0); $cou4=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.txt' AND `id_them`='$id_them'"),0);  $cou6=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE (`file_f` LIKE '%.3gp' OR `file_f` LIKE '%.mp4' OR `file_f` LIKE '%.avi') AND `id_them`='$id_them'"),0);  $cou5=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE (`file_f` LIKE '%.zip' OR `file_f` LIKE '%.rar') AND `id_them`='$id_them'"),0);
$cou7=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE (`file_f` LIKE '%.gif' OR `file_f` LIKE '%.jpg' OR `file_f` LIKE '%.png' OR `file_f` LIKE '%.jpeg') AND `id_them`='$id_them'"),0); echo'<div class="p"><img src="/images/forum/1.png" alt=""> <a href="/forum/files.php?act=view&amp;id_them='.$id_them.'&amp;fid=1">Приложения EXE</a> ['.$cou1.']</div><div class="p"><img src="/images/forum/2.png" alt=""> <a href="/forum/files.php?act=view&amp;id_them='.$id_them.'&amp;fid=2">Приложения SIS</a> ['.$cou2.']</div><div class="p"><img src="/images/forum/3.png" alt=""> <a href="/forum/files.php?act=view&amp;id_them='.$id_them.'&amp;fid=3">Приложения JAVA</a> ['.$cou3.']</div><div class="p"><img src="/images/forum/4.png" alt=""> <a href="/forum/files.php?act=view&amp;id_them='.$id_them.'&amp;fid=4">Текстовые файлы</a> ['.$cou4.']</div><div class="p"><img src="/images/forum/5.png" alt=""> <a href="/forum/files.php?act=view&amp;id_them='.$id_them.'&amp;fid=5">Архивы</a> ['.$cou5.']</div><div class="p"><img src="/images/forum/6.png" alt=""> <a href="/forum/files.php?act=view&amp;id_them='.$id_them.'&amp;fid=6">Видео</a> ['.$cou6.']</div><div class="p"><img src="/images/forum/7.png" alt=""> <a href="/forum/files.php?act=view&amp;id_them='.$id_them.'&amp;fid=7">Картинки</a> ['.$cou7.']</div><div class="p"><img src="/images/forum/8.png" alt=""> <a href="/forum/files.php?act=view&amp;id_them='.$id_them.'&amp;fid=8">Музыка</a> ['.$cou8.']</div>';  echo'<div class="p">Файлов: '.$all.'</div>';} break;
case'view':
$id_forum=(int)$_GET['id_forum'];
$id_them=(int)$_GET['id_them'];
$fid=(int)$_GET['fid'];
if($id_forum==0 and $id_them==0){
if($fid==1){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.exe'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.exe' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==2){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.sis'"),0); $page = abs((int)$_GET['page']);



if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.sis' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==3){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.jar' OR `file_f` LIKE '%.jad'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.jar' OR `file_f` LIKE '%.jad' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==4){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.txt'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.txt' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==5){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.zip' OR `file_f` LIKE '%.rar'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.zip' OR `file_f` LIKE '%.rar' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==6){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.mp4' OR `file_f` LIKE '%.3gp' OR `file_f` LIKE '%.avi'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.mp4' OR `file_f` LIKE '%.3gp' OR `file_f` LIKE '%.avi' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==7){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.png' OR `file_f` LIKE '%.jpg' OR `file_f` LIKE '%.gif' OR `file_f` LIKE '%.jpeg'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.png' OR `file_f` LIKE '%.jpg' OR `file_f` LIKE '%.jpeg' OR `file_f` LIKE '%.png' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==8){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.mmf' OR `file_f` LIKE '%.mp3' OR `file_f` LIKE '%.wav' OR `file_f` LIKE '%.amr' OR `file_f` LIKE '%.wma' OR `file_f` LIKE '%.mid'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;
if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.mmf' OR `file_f` LIKE '%.mp3' OR `file_f` LIKE '%.wav' OR `file_f` LIKE '%.amr' OR `file_f` LIKE '%.wma' OR `file_f` LIKE '%.mid' ORDER BY `id_mes` DESC LIMIT $page,10");}
if($total!=0){
while($data=mysql_fetch_array($query)){ $q=mysql_fetch_assoc(mysql_query("SELECT `ftname` FROM `forum_themes` WHERE `id_them`='".$data['id_them']."' LIMIT 1"));
echo'<div class="p">&#187; <a href="load.php?id_mess='.$data['id_mes'].'">'.str_replace('files/','',$data['file_f']).'</a> ['.$data['file_c'].']<br/>Тема: <a href="/forum/theme/'.$data['id_kat'].'/'.$data['id_them'].'/">'.$q['ftname'].'</a><br>'.vizual($data['fmtext']).'<br>Хто: '.nik_tri($data['id_user']).'<br>Когда: '.date_fixed($data['timer']).'</div>';}
strpage($page, 10, $total, 'files.php','act=view&amp;fid='.$fid); }else{echo'Пусто';}
}

if($id_forum!=0 and $id_them==0){
if($fid==1){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.exe' AND `id_forum`='$id_forum'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.exe' AND `id_forum`='$id_forum' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==2){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.sis' AND `id_forum`='$id_forum'"),0); $page = abs((int)$_GET['page']);



if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.sis' AND `id_forum`='$id_forum' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==3){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.jar' OR `file_f` LIKE '%.jad' AND `id_forum`='$id_forum'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;
if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.jar' OR `file_f` LIKE '%.jad' AND `id_forum`='$id_forum' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==4){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.txt' AND `id_forum`='$id_forum'"),0);
$page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.txt' AND `id_forum`='$id_forum' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==5){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.zip' OR `file_f` LIKE '%.rar' AND `id_forum`='$id_forum'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.zip' OR `file_f` LIKE '%.rar' AND `id_forum`='$id_forum' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==6){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.mp4' OR `file_f` LIKE '%.3gp' OR `file_f` LIKE '%.avi' AND `id_forum`='$id_forum'"),0);
$page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.mp4' OR `file_f` LIKE '%.3gp' OR `file_f` LIKE '%.avi' AND `id_forum`='$id_forum' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==7){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.png' OR `file_f` LIKE '%.jpg' OR `file_f` LIKE '%.gif' OR `file_f` LIKE '%.jpeg' AND `id_forum`='$id_forum'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.png' OR `file_f` LIKE '%.jpg' OR `file_f` LIKE '%.jpeg' OR `file_f` LIKE '%.png' AND `id_forum`='$id_forum' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==8){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.mmf' OR `file_f` LIKE '%.mp3' OR `file_f` LIKE '%.wav' OR `file_f` LIKE '%.amr' OR `file_f` LIKE '%.wma' OR `file_f` LIKE '%.mid' AND `id_forum`='$id_forum'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;
if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.mmf' OR `file_f` LIKE '%.mp3' OR `file_f` LIKE '%.wav' OR `file_f` LIKE '%.amr' OR `file_f` LIKE '%.wma' OR `file_f` LIKE '%.mid' AND `id_forum`='$id_forum' ORDER BY `id_mes` DESC LIMIT $page,10");}
if($total!=0){
while($data=mysql_fetch_array($query)){ $q=mysql_fetch_assoc(mysql_query("SELECT `ftname` FROM `forum_themes` WHERE `id_them`='".$data['id_them']."' LIMIT 1"));
echo'<div class="p">&#187; <a href="load.php?id_mess='.$data['id_mes'].'">'.str_replace('files/','',$data['file_f']).'</a> ['.$data['file_c'].']<br/>Тема:
<a href="/forum/theme/'.$data['id_kat'].'/'.$data['id_them'].'/">'.$q['ftname'].'</a><br>'.vizual($data['fmtext']).'<br>Хто: '.nik_tri($data['id_user']).'<br>Когда: '.date_fixed($data['timer']).'</div>';}
strpage($page, 10, $total, 'files.php','act=view&amp;id_forum='.$id_forum.'&amp;fid='.$fid); }else{echo'Пусто';}
}



if($id_forum==0 and $id_them!=0){
if($fid==1){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.exe' AND `id_them`='$id_them'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.exe' AND `id_them`='$id_them' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==2){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.sis' AND `id_them`='$id_them'"),0); $page = abs((int)$_GET['page']);



if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.sis' AND `id_them`='$id_them' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==3){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.jar' OR `file_f` LIKE '%.jad' AND `id_them`='$id_them'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;
if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.jar' OR `file_f` LIKE '%.jad' AND `id_them`='$id_them' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==4){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.txt' AND `id_them`='$id_them'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.txt' AND `id_them`='$id_them' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==5){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.zip' OR `file_f` LIKE '%.rar' AND `id_them`='$id_them'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.zip' OR `file_f` LIKE '%.rar' AND `id_them`='$id_them' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==6){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.mp4' OR `file_f` LIKE '%.3gp' OR `file_f` LIKE '%.avi' AND `id_them`='$id_them'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.mp4' OR `file_f` LIKE '%.3gp' OR `file_f` LIKE '%.avi' AND `id_them`='$id_them' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==7){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.png' OR `file_f` LIKE '%.jpg' OR `file_f` LIKE '%.gif' OR `file_f` LIKE '%.jpeg' AND `id_them`='$id_them'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;

if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.png' OR `file_f` LIKE '%.jpg' OR `file_f` LIKE '%.jpeg' OR `file_f` LIKE '%.png' AND `id_them`='$id_them' ORDER BY `id_mes` DESC LIMIT $page,10");}

if($fid==8){
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `file_f` LIKE '%.mmf' OR `file_f` LIKE '%.mp3' OR `file_f` LIKE '%.wav' OR `file_f` LIKE '%.amr' OR `file_f` LIKE '%.wma' OR `file_f` LIKE '%.mid' AND `id_them`='$id_them'"),0); $page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;
if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$query=mysql_query("SELECT * FROM `forum_messages` WHERE `file_f` LIKE '%.mmf' OR `file_f` LIKE '%.mp3' OR `file_f` LIKE '%.wav' OR `file_f` LIKE '%.amr' OR `file_f` LIKE '%.wma' OR `file_f` LIKE '%.mid' AND `id_them`='$id_them' ORDER BY `id_mes` DESC LIMIT $page,10");}
if($total!=0){
while($data=mysql_fetch_array($query)){ $q=mysql_fetch_assoc(mysql_query("SELECT `ftname` FROM `forum_themes` WHERE `id_them`='".$data['id_them']."' LIMIT 1"));
echo'<div class="p">&#187; <a href="load.php?id_mess='.$data['id_mes'].'">'.str_replace('files/','',$data['file_f']).'</a> ['.$data['file_c'].']<br/>Тема: <a href="/forum/theme/'.$data['id_kat'].'/'.$data['id_them'].'/">'.$q['ftname'].'</a><br>'.vizual($data['fmtext']).'<br>Хто: '.nik_tri($data['id_user']).'<br>Когда: '.date_fixed($data['timer']).'</div>';}
strpage($page, 10, $total, 'files.php','act=view&amp;id_them='.$id_them.'&amp;fid='.$fid); }else{echo'Пусто';}
}




break;
}
require"../system/foot.php"; ?>