Размер файла: 8.5Kb
<?
include('../core/core.php');
include(BASEDIR.INC.'func.php');
include(BASEDIR.INC.'session.php');
include(BASEDIR.INC.'session_user.php');
$mode = htmlspecialchars($_GET['mode']);
include(BASEDIR.INC.'head.php');
show_title('Зона обмена');
include(BASEDIR.MODUL.'obmen/obmen.php');
switch ($mode):
case 'index':
$id = abs( htmlspecialchars($_GET['id']));
$file = mysql_query('SELECT * FROM files WHERE id = "'.$id.'"');
$file = mysql_fetch_assoc($file);
$type = $file['type'];
if($file['id'] == !NULL){
echo '<div class="razdel">'.$file['name'].'</div>';
echo'<div class="menu">';
$rat = $file['plus'] - $file['minus'];
if($type == 'jpg' || $type == 'jpeg' || $type == 'gif' || $type == 'png') {
$files = '../obmen/files/'.$file['name'].'';
$imgsize = getimagesize($files);
if($imgsize[0] >= 150){$x = 150; } else { $x = $imgsize[0]; }
if($imgsize[1] >= 100){$y = 100; } else { $y = $imgsize[1]; }
echo'<img src="'.$files.'" width="'.$x.'" height="'.$y.'"><br />';
}
$new_scrin = '../obmen/files_img/'.$file['name'].'.png';
if (file_exists($new_scrin)) {
$imgsize = getimagesize($files);
if($imgsize[0] >= 150){$x = 150; } else { $x = $imgsize[0]; }
if($imgsize[1] >= 100){$y = 100; } else { $y = $imgsize[1]; }
echo'<img src="'.$new_scrin.'" width="'.$x.'" height="'.$y.'"><br />';
}
echo'
Вес: '.$file['kb'].' кб<br />
Загружен: '.$file['data'].'<br />
Загрузил: <a href="/users/profile.php?user='.$file['login'].'">'.$file['login'].'</a><br />
Описание:<br />
'.$file['opi'].'<hr>
<img src="'.BASEDIR.''.IMG.'zone/comment_4811.png"> <a href="com.php?mode=index&id='.$file['id'].'">Комментарии</a> ['.index_to('files_com','file',$file['name']).']<br />
Рейтинг <strong>'.$rat.' </strong> (+'.$file['plus'].' / -'.$file['minus'].') [<a href="?mode=rat&cm=p&id='.$id.'">Плюс</a> / <a href="?mode=rat&cm=m&id='.$id.'">Минус</a>]<br />
Скачиваний: <strong>'.$file['count'].'</strong>';
echo'</div>';
if($type == 'mp3' || $type == 'wma' || $type == 'flac' || $type == 'aac' || $type == 'mmf' || $type == 'amr' || $type == 'm4a' || $type == 'm4r' || $type == 'ogg' || $type == 'mp2' || $type == 'wav' || $type == 'mpeg'){
echo'<div class="menu">';
echo'<object type="application/x-shockwave-flash" data="http://'.SITE.''.IMG.'ump3player_500x70.swf" height="43" width="292"><param name="wmode" value="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="http://'.SITE.''.IMG.'ump3player_500x70.swf" /><param name="FlashVars" value="way=/obmen/files/'.$file['name'].'&swf=http://'.SITE.''.IMG.'ump3player_500x70.swf&w=292&h=43&time_seconds=0&autoplay=0&q=&skin=black&volume=100&comment=" /></object><br />';
if($file['kb'] >= 0){
$path = '../obmen/files/'.$file['name'].'';
$movie = new ffmpeg_movie($path);
if($movie->getAudioChannels() == 1){$a = 'Mоно'; } else { $a = 'Cтерео'; }
$bit = round($movie->getBitRate() / 1000);
$hit = round($movie->getAudioSampleRate() / 1000);
echo'<span style="font-size: 9px;"><div align="right">Битрейт: '.$bit.' kbps<br />
Частота: '.$hit.' KHz<br />
Время: '.formattime($movie->getDuration()).'<br />
Канал: '.$a.'</div></span>';
echo'</div>';
}
}
echo'<div class="menu">';
if($download == 'user'){
if($_COOKIE['login'] == !NULL && $_COOKIE['pass'] == !NULL){
echo'<img src="'.BASEDIR.''.IMG.'zone/dwn.png"> <a href="?mode=d&id='.$id.'">Cкачать</a>';
} else { echo'Cкачивать файлы могуть полька пользователи!'; }
} else {
if($_COOKIE['login'] == !NULL && $_COOKIE['pass'] == !NULL){
echo'<img src="'.BASEDIR.''.IMG.'zone/dwn.png"> <a href="?mode=d&id='.$id.'">Cкачать</a>';
} else {
echo'<form action="?mode=d&id='.$id.'" method="post">
<img src="/inc/capatcha.php"/><br>
Bвeдитe Koд:<br>
<input type="text" name="code" size="7" maxlength="6">
<input type="submit" value="Скачать">
</form>';
}
}
echo'</div>';
echo'<div class="menu">';
echo'<img src="'.BASEDIR.''.IMG.'zone/for.png"> <a href="spam.php?mode=index&id='.$file['id'].'">Пожаловаться на файл</a>';
echo'</div>';
} else {echo'<div class="menu">Файла не существует!</div>'; }
break;
case 'd':
$id = abs(htmlspecialchars($_GET['id']));
$file = mysql_query('SELECT * FROM files WHERE id = "'.$id.'"');
$file = mysql_fetch_assoc($file);
echo '<div class="razdel">'.$file['name'].'</div>';
if($file['id'] == !NULL){
if($download == 'user'){
if(is_user()){
$data = date("d.m.Y / H:i");
$time = time() + (86400 * 90);
mysql_query("UPDATE `files` SET `last`='$data', `count`=`count` + 1, `time`='$time' WHERE id = '".$id."'");
$it = '../obmen/files/'.$file['name'].'';
$name = explode("/",$it);
$name = $name[count($name)-1];
header('Content-type: text/plain');
header("Content-disposition: attachment; filename=$name");
header('Content-Description: File Transfer');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($it));
ob_clean();
flush();
readfile($it);
} else { echo'<div class="menu">Cкачивать файлы могуть полька пользователи!</div>'; }
} else {
if($_COOKIE['login'] == !NULL && $_COOKIE['pass'] == !NULL){
$data = date("d.m.Y / H:i");
$time = time() + (86400 * 90);
mysql_query("UPDATE `files` SET `last`='$data', `count`=`count` + 1, `time`='$time' WHERE id = '".$id."'");
$it = '../obmen/files/'.$file['name'].'';
$name = explode("/",$it);
$name = $name[count($name)-1];
header('Content-type: text/plain');
header("Content-disposition: attachment; filename=$name");
header('Content-Description: File Transfer');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($it));
ob_clean();
flush();
readfile($it);
} else {
$code = htmlspecialchars($_POST['code']);
if ($code == $_SESSION['getkode']) {
$data = date("d.m.Y / H:i");
$time = time() + (86400 * 90);
mysql_query("UPDATE `files` SET `last`='$data', `count`=`count` + 1, `time`='$time' WHERE id = '".$id."'");
$it = '../obmen/files/'.$file['name'].'';
$name = explode("/",$it);
$name = $name[count($name)-1];
header('Content-type: text/plain');
header("Content-disposition: attachment; filename=$name");
header('Content-Description: File Transfer');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($it));
ob_clean();
flush();
readfile($it);
unset($_SESSION['getkode']);
} else { echo'<div class="menu">Ошибка! Проверочное число не совпало с данными на картинке!</div>';}
}
}
} else {echo'<div class="menu">Файла не существует!</div>'; }
break;
case 'rat':
echo '<div class="razdel">Голосование за файл.</div>';
if(is_user()){
$id = abs(htmlspecialchars($_GET['id']));
$file = mysql_query('SELECT * FROM files WHERE id = "'.$id.'"');
$file = mysql_fetch_assoc($file);
$r = mysql_query('SELECT * FROM files_rat WHERE file = "'.$file['name'].'" AND `login` = "'.$_COOKIE['login'].'"');
$r = mysql_fetch_assoc($r);
if($file['id'] == !NULL){
if($r['login'] == NULL){
$cm = htmlspecialchars($_GET['cm']);
if($cm == 'p'){
mysql_query('INSERT INTO `files_rat`(`file`, `login`) VALUES ("'.$file['name'].'","'.$_COOKIE['login'].'")');
mysql_query("UPDATE `files` SET `plus`=`plus` + 1 WHERE id = '".$id."'");
header ('location: ?mode=index&id='.$id.'');
}
if($cm == 'm'){
mysql_query('INSERT INTO `files_rat`(`file`, `login`) VALUES ("'.$file['name'].'","'.$_COOKIE['login'].'")');
mysql_query("UPDATE `files` SET `minus`=`minus` + 1 WHERE id = '".$id."'");
header ('location: ?mode=index&'.$id.'');
}
} else {echo'<div class="menu">Вы уже голосовали за этот файл</div>'; }
} else {echo'<div class="menu">Файла не существует!</div>'; }
} else {echo'<div class="menu">Ошибка голосовать могут только пользователи сайта!</div>'; }
break;
default:
header ('location: ?mode=index');
endswitch;
echo'<div class="menu"><a href="/">На главную</a></div>';
include(BASEDIR.INC.'foot.php');
?>