Файл: fo/index.php
Строк: 195
<?
##########################################
## Автор: -=ШАХТЕР=- # ## Сайт: http://masteram.us # ## ICQ : 46-92-90 # ## Версия 4.0 Лицензионная #
## Данная версия скрипта является ПЛАТНОЙ, #
## вы НЕ ИМЕЕТЕ ПРАВА распрострянять данный #
## скрипт или какие-либо части его кода... #
#########################################
require'../config.php';
$align='left';
$title='Обменник';
aut();
head();
who_add(0,'enter');
$k_user=$db->sql_fetchfield($db->sql_query("select COUNT(*) from `fo_files` WHERE user_id = '".$user['id']."';"),0);
if ($k_user!=$user['fo_files'])$db->sql_query('UPDATE `users` SET `fo_files` = "'.$k_user.'" WHERE `id` = "'.$user['id'].'"');
$fid = check(intval($_GET['fid']));
$fid2 = check(intval($_GET['fid2']));
if (empty($_GET['fid'])&&empty($_GET['fid2'])){
echo '<img src="/fo/ext/search.png" alt="*"/> <a href="search">Поиск файлов</a><br />
<img src="/fo/ext/top.gif" alt="*"/> ТОП '.$set['top_num'].' <a href="top">файлов</a>| <a href="users">пользователей</a><br />';
$new_all_files = mysql_fetch_row($db->sql_query('SELECT COUNT(*) FROM `fo_files` WHERE `timeupload` > '.($time-(86400*$set['fo_day_new'])).''));
if($new_all_files[0]!=0) echo '<img src="/fo/ext/new.gif" alt="*"/> <a href="new">Новинки (+'.$new_all_files[0].')</a><br />';
echo '<dl><dt></dt></dl>';
echo '<br />';
$q = @$db->sql_query("select * from `fo_cat` order by pos" );
while ($cat = @$db->sql_fetchrow($q))
{
$f = $cat['id'];
$f_name = $cat['name'];
$allinfolder = $db->sql_fetchfield($db->sql_query('SELECT COUNT(*) FROM `fo_files` WHERE `infolder` LIKE "'.$cat['path'].'%";'),0);
$stime=$time-(3600*24*$set['fo_day_new']);
if($set['fo_day_new']!=0) $new_all = $db->sql_fetchfield($db->sql_query('SELECT COUNT(*) FROM `fo_files` WHERE `timeupload` > "'.$stime.'" AND `infolder` LIKE "'.$cat['path'].'%";'),0);
if($new_all and $set['fo_day_new']!=0) $new_all = '<font color="red">+'.$new_all.'</font>'; else $new_all="";
echo links;
if ($user['level']>=8) {
echo '<a href="admin_editcat_'.$f.'"><img src="/fo/ext/p.png" alt="*"/></a> <b><a href="'.$f.'">'.$f_name.'</a></b> ('.$allinfolder.''.$new_all.')';
} else{
echo '<img src="/fo/ext/p.png" alt="*"/> <b><a href="'.$f.'">'.$f_name.'</a></b> ('.$allinfolder[0].''.$new_all.')';
}
echo div;
}
if ($user['level']>=8) {echo '<br /><br /><dl><dt></dt></dl>';echo '<a href="admin_addcat"><b>Создать</b></a><br/>';
echo '<dl><dt></dt></dl>';
}
}else if (isset($_GET['fid'])&&empty($_GET['fid2'])){
$cat = @$db->sql_fetchrow($db->sql_query("select * from `fo_cat` where id = '".$fid."'" ));
echo menu.'<a href="/fo">Oбменник</a>|<b>'.$cat['name'].'</b>'.div;
if(!is_dir($cat['path'])){
$db->sql_query("DELETE FROM `fo_cat` where id = '".$fid."'");
header ('Location: /fo?'.SID); exit;
}
echo '<br />';
$q = @$db->sql_query("select * from `fo_cat2` where fid = '$fid' order by pos" );
while ($cat = @$db->sql_fetchrow($q))
{
$f = $cat['id'];
$f_name = $cat['name'];
$allinfolder = $db->sql_fetchfield($db->sql_query('SELECT COUNT(*) FROM `fo_files` WHERE `infolder` LIKE "'.$cat['path'].'%";'),0);
$stime=$time-(3600*24*$set['fo_day_new']);
if($set['fo_day_new']!=0) $new_all = $db->sql_fetchfield($db->sql_query('SELECT COUNT(*) FROM `fo_files` WHERE `timeupload` > "'.$stime.'" AND `infolder` LIKE "'.$cat['path'].'%";'),0);
if($new_all and $set['fo_day_new']!=0) $new_all = '<font color="red">+'.$new_all.'</font>'; else $new_all="";
echo links;
if ($user['level']>=8) {
echo '<a href="admin_editcat2_'.$f.'"><img src="/fo/ext/p.png" alt="*"/></a> <b><a href="'.$fid.'/'.$f.'">'.$f_name.'</a></b> ('.$allinfolder[0].''.$new_all.')';
} else{
echo '<img src="/fo/ext/p.png" alt="*"/> <b><a href="'.$fid.'/'.$f.'">'.$f_name.'</a></b> ('.$allinfolder[0].''.$new_all.')';
}
echo div;
}
if ($user['level']>=8) echo '<br /><br /><dl><dt></dt></dl><a href="admin_addcat2_'.$fid.'"><b>Создать</b></a><dl><dt></dt></dl>';
}else if (isset($_GET['fid'])&&isset($_GET['fid2'])){
$cat = @$db->sql_fetchrow($db->sql_query("select * from `fo_cat` where id = '".$fid."'" ));
$cat2 = @$db->sql_fetchrow($db->sql_query("select * from `fo_cat2` where id = '".$fid2."'" ));
echo menu.'<a href="/fo">Oбменник</a>|<a href="/fo/'.$cat['id'].'">'.$cat['name'].'</a>|<b>'.$cat2['name'].'</b>'.div;
if(!is_dir($cat2['path'])){
$db->sql_query("DELETE FROM `fo_cat2` where id = '".$fid2."'");
header ('Location: /fo/'.$fid.'?'.SID); exit;
}
if(!empty($_SESSION["onpage"]) AND !empty($_GET['onpage'])){
$_SESSION["onpage"]=$_GET['onpage'];
}elseif(empty($_SESSION["onpage"]) AND !empty($_GET['onpage'])){
$onpage=$_GET['onpaget'];
session_register ("onpage") ;}
if(!empty($_SESSION["prew"]) AND !empty($_GET['prew']))
$_SESSION["prew"]=$_GET['prew'];
elseif(empty($_SESSION["prew"]) AND !empty($_GET['prew'])){
$prew=$_GET['prew'];
session_register ("prew") ;}
if(!empty($_SESSION["sort"]) AND !empty($_GET['sort']))
$_SESSION["sort"]=$_GET['sort'];
elseif(empty($_SESSION["sort"]) AND !empty($_GET['sort'])){
$sort=$_GET['sort'];
session_register ("sort") ;}
function get2ses($name)
{
global $db, $_GET, $_SESSION, $setup;
$d = $name;
if(!isset($_SESSION[$name])) {$_SESSION[$name] = $setup[$name];}
if(isset($_GET[$name])) {$_SESSION[$name] = $_GET[$name];}
return $$name = $_SESSION[$d];
}
$prew = check(intval($_SESSION["prew"]));
$sort = get2ses('sort');
if($sort == 'name') $sortlink = '<a href="?sort=data">дата</a>|<a href="?sort=size">размер</a>|<a href="?sort=load">популярность</a>|<a href="?sort=eval">рейтинг</a>';
elseif($sort == 'size') $sortlink = '<a href="?sort=data">дата</a>|<a href="?sort=name">имя|<a href="?sort=load">популярность</a></a>|<a href="?sort=eval">рейтинг</a>';
elseif($sort == 'load') $sortlink = '<a href="?sort=data">дата</a>|<a href="?sort=name">имя|<a href="?sort=size">размер</a>|<a href="?sort=eval">рейтинг</a>';
elseif($sort == 'eval') $sortlink = '<a href="?sort=data">дата</a>|<a href="?sort=name">имя|<a href="?sort=size">размер</a>|<a href="?sort=load">популярность</a>';
else $sortlink = '<a href="?sort=name">имя</a>|<a href="?sort=size">размер</a>|<a href="?sort=load">популярность</a>|<a href="?sort=eval">рейтинг</a>';
echo ' Cортировать по:<br />  '.$sortlink.'<br />';
echo '<br /><img src="/img/load.png" alt=""/> <a href="/fo/upload/'.$fid.'/'.$fid2.'"><b>Загрузить</b></a><br /><br />';
$valid_sort = array('timeupload' => '','name' => '','data' => '','load' => '','size' => '','eval' =>'');
if(!isset($valid_sort[$sort])){
$sort='timeupload';
}
$MODE = '`timeupload` DESC';
if($sort == 'name') $MODE = '`name` DESC';
elseif($sort == 'size') $MODE = '`size` ASC';
elseif($sort == 'load') $MODE = '`loads` DESC';
elseif($sort == 'eval') $MODE = '`yes` DESC ,`no` ASC';
if (empty($user['max'])) $user['max']=10;
$max = $user['max'];
$k_post=$db->sql_fetchfield($db->sql_query("select COUNT(*) from `fo_files` WHERE infolder = '".$cat2['path']."';"),0);
$k_page=k_page($k_post,$max);
$page=page($k_page);
$start=$max*$page-$max;
if ($k_post==0)echo 'Здесь файлов пока нет :)<br />';
$q = $db->sql_query( "SELECT * from `fo_files` WHERE infolder = '".$cat2['path']."' ORDER BY ".$MODE." limit $start,$max;" );
while ($file = @$db->sql_fetchrow(@$q))
{
if(is_file($file['path'])){
$ex = pathinfo($file['path']);
$ext = strtolower($ex['extension']);
//Предосмотр
$pre = '';
if ($ext == 'bmp') $pre = 'Предосмотр невозможен...<br>';
if ($ext == 'gif' or $ext == 'jpeg' or $ext == 'jpg' or $ext == 'png' or $ext == 'JPG' or $ext == 'GIF' or $ext == 'PNG'or $ext == 'JPEG') $pre = '<img style="margin: 1px;" src="/fo/img.php?bab=1&file='.$file['id'].'" alt=""/><br />';
//Новизна файла
$new_info='';
$filtime2 = $file['timeupload']+(3600*24*$set['fo_day_new']);
if($filtime2>=$time and $set['fo_day_new']!=0) $new_info = ' <img src="/fo/ext/new.gif" alt=""/>';
//Красивый размер
if($file['size'] < 1024) $file['size'] = '('.$file['size'].' б)';
if($file['size'] < 1048576 and $file['size'] >= 1024) $file['size'] = '('.round($file['size']/1024, 2).' Кб)';
if($file['size'] > 1048576) $file['size'] = '('.round($file['size']/1024/1024, 2).' Мб)';
//Иконка к файлу
if(!file_exists('ext/'.$ext.'.png') ) $ico = '<img src="/fo/ext/stand.png" alt=""/>';
/*elseif ($ext =='jar') $ico = ' <img src="/fo/ic.php?lf='.$file['path'].'&file='.$file[id].'" alt="" width="16" height="16"/>';*/
else $ico = '<img src="/fo/ext/'.$ext.'.png" alt=""/>';
//Показ расиширения
$extension = "$ext|";
$file['size']=str_replace(')','',$file['size']);
$file['size']=str_replace('(','',$file['size']);
echo links.''.$ico.' <a href="/fo/down/'.$file[id].'"><strong>'.$file['name'].'</strong></a>  ['.$extension.$file['size'].']'.$new_info.div.'';
echo ' <img src="/fo/ext/load.gif" alt=""/> <a href="/fo/'.$file['id'].'">Скачать</a>';
if($ext =='txt')echo '|<a href="/fo/read/'.$file['id'].'">Читать</a>';
echo '<br />';
$bolt=0;
if(($ext == 'avi' || $ext == '3gp' || $ext == 'mp4') && extension_loaded('ffmpeg')){
$pre = '<img style="margin: 1px;" src="/fo/ffmpeg.php?file='.$file['id'].'" alt=""/><br />';
$bolt=1;
}
/*else if($ext == 'thm' || $ext == 'nth'){
$pre = '<img style="margin: 1px;" src="/fo/theme.php?file='.$file['id'].'" alt="prev"/><br />';
$bolt=1;
}*/
if(($ext == 'avi' || $ext == 'flv' || $ext =='swf' || $ext =='mp4') AND (
!$h_ua ||
strpos($h_ua, 'windows') !== false ||
strpos($h_ua, 'linux') !== false ||
strpos($h_ua, 'bsd') !== false ||
strpos($h_ua, 'x11') !== false ||
strpos($h_ua, 'unix') !== false ||
strpos($h_ua, 'macintosh') !== false ||
strpos($h_ua, 'macos') !== false))
{
$pre ='<object type="application/x-shockwave-flash" data="uflvplayer_500x375.swf" height="99" width="125">
<param name="bgcolor" value="#DFE6EF" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="uflvplayer_500x375.swf" />
<param name="FlashVars" value="way=/fo/'.$file['path'].'&swf=uflvplayer_500x375.swf&w=400&h=300&pic=/fo/ffmpeg.php?file='.$file['id'].'&autoplay=0&tools=1&skin=white&volume=70&q=&comment=" /></object><br />';
}
if($ext == 'mp3' or $ext == 'wav'){
if (
!$h_ua ||
strpos($h_ua, 'windows') !== false ||
strpos($h_ua, 'linux') !== false ||
strpos($h_ua, 'bsd') !== false ||
strpos($h_ua, 'x11') !== false ||
strpos($h_ua, 'unix') !== false ||
strpos($h_ua, 'macintosh') !== false ||
strpos($h_ua, 'macos') !== false)
{
echo'Прослушка: <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 " width="96" height="20" id="own_flashplayer" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<embed src="/fo/own_flashplayer_plc.swf?file=/fo/'.$file['path']. '&sta rtplay=false" quality="high" bgcolor="#0B91C4" width="96" height="20" name="own_flashplayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object><br />';
}}
echo $pre;
$opis=$file['about'];
$opis=substr($opis,0,100);
$opis = htmlentities($opis, ENT_QUOTES, 'UTF-8');
echo ''.$opis.'...<br />';
/*echo'<a href="komm.php?file='.$id2.'">Ком.: ['.$all_komments.']</a>|Рейтинг:<font color="black">'.$file['yes'].'</font>/<font color="red">'.$file['no'].'</font><font color="blue">|Скач.:</font>['.$file['loads'].']<br/>';*/
}else {
$db->sql_query("DELETE FROM `fo_files` where id = '".$file['id']."'");
}
echo '<dl></dl>';
}
if ($k_page>1){
echo '<br/><dl><dt></dt></dl>';
str("?",$k_page,$page); // Вывод страниц
echo '<br/><dl><dt></dt></dl>';
}
echo '<br /><img src="/img/load.png" alt=""/> <a href="/fo/upload/'.$fid.'/'.$fid2.'"><b>Загрузить</b></a><br /><br />';
}
echo "<br/>";
echo gb.'<a href="/fo">Обменник</a>'.div;
echo gb.'<a href="/enter">Прихожая</a>'.div;
foot();
?>