Просмотр файла dl/audio_shred.php

Размер файла: 6.1Kb
<?php
#********************************** AgS MOD DOWNLOAD CENTR SEA *************************************#
#***************************************************************************************************#
#  /||||||||||||||| *********************  /||||||||||||||| *********************  /||||||||||||||| #
# | ||||||||||||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# | |||||/////||||| ********************* | |||||/////////  ********************* | |||||/////////  #
# | |||||   | ||||| ****** E-MAIL ******* | |||||           ****** WAP/WEB ****** | |||||           #
# | |||||   | ||||| *** [email protected] *** | |||||           * http://ags.h2m.ru * | ||||||||||||||| #
# | |||||   | ||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# | |||||   | ||||| ********************* | |||||/////||||| ********************* |///////////||||| #
# | ||||||||||||||| ****** SKYPE ******** | |||||   | ||||| ***** MOD AUTHOR ****           | ||||| #
# | |||||////|||||| ***** agrizz15 ****** | |||||   | ||||| ***** Agris Cišs ****  /||||||||||||||| #
# | |||||   | ||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# |/////    |/////  ********************* |///////////////  ********************* |///////////////  #
#***************************************************************************************************#
#********************************* MOD by AgS in 2010 @ LATVIA *************************************#


require_once"system/start.php";
require_once"system/config.php";
require_once"system/db.php";
require_once"system/head.php";
require_once"lng/$setup[lng]/lng.php";
require_once"system/functions.php";
require_once"system/cookies.php";
require_once"system/counter.php";
include_once"thm/$setup[thm]/index.php";
include_once"system/msg.php";

require_once"system/lib.id.php";


/* Ja MP3 griezšana ir ieslēgta */
if($setup['cut_change']){


/* Datu pārbaude */
	$id = intval($_GET['id']);
	$s = intval($_POST['s']);
	$p = intval($_POST['p']);


/* Priekš īpašiem cilvēkiem */
if($_POST['way']!='size' and $_POST['way']!='time' and isset($_POST['way'])){die($mudaki);}


/* Faila info */
$file_info = mysql_fetch_array(mysql_query('SELECT * FROM `'.$MY_pre.'faili` WHERE `id` = '.$id));
if(!is_file ($file_info['path'])) exit (mp_001.'');

/* Iegūstam vārdu un mapi */
$filename = pathinfo($file_info['path']);
$ext = $filename['extension'];
$dir = $filename[dirname].'/';
$filename = $filename[basename];

/* Atpakaļ adrese */
$back = mysql_fetch_array(mysql_query("SELECT * FROM `".$MY_pre."faili` WHERE `path` = '".$dir."'"));

/* Datu ievade */
if(!$_POST['a']){

/* Iegūstam mp3 datus */
$id3 = new MP3_Id();
$result = $id3->read($file_info['path']);
$result = $id3->study();

/* Forma datu ievadei */
	echo sys_shreder.'<br><br>';
	echo sys_weighta.': '.izmers($id3->getTag('filesize')).'<br>';
	echo mp_004.': '.$id3->getTag('lengths').' '.sys_sec.'<br>';

	echo '<form action="audio_shred.php?id='.$id.'" method="post"><br>'.mp_006.':<br>';
	echo '<select name="way">';
	echo '<option value="size">'.mp_007.'</option>';
	echo '<option value="time">'.mp_008.'</option>';
	echo '</select><br>';
	echo mp_009.':<br>';
	echo '<input maxlength="5" type="text" name="s"/><br>';
	echo mp_010.':<br>';
	echo '<input maxlength="5" type="text" name="p"/><br>';
	echo '<input type="submit" name="a" value="'.sys_go.'"/>';
	echo '</form>';

}else{

/* Darbojamies ar failu */
	$list = glob($setup['dir_audio'].'/*');
	$all = sizeof($list);
foreach($list as $key=>$string){
	$filesize = round(filesize($string)/1024/1024, 1);
	$allsize = $allsize + $filesize;
if($allsize > $setup['limit']){
	$dire = opendir ($setup['dir_audio'].'/');
while($file = readdir($dire)){
if(($file != '.') && ($file != '..')) unlink ($setup['dir_audio'].'/'.$file);}
break;
}}
	$randname = basename($file_info['name']).'_'.mt_rand(100000,99999999).'.mp3';
	$randintval = rawurldecode($setup['dir_audio'].'/'.$randname);
if(copy($file_info['path'],$randintval)){
	$fp = fopen($randintval, 'rb');
	$raz = filesize($randintval);

if($_POST['way']=='size'){
	$s = $s*1024;
	$p = $p*1024;
if($s>$raz||$s<0){$s = 0;}
if($p>$raz||$p<$s){$p = $raz;}
}else{
	$id3 = new MP3_Id();
	$result = $id3->read($randintval);
	$result = $id3->study();
	$byterate = $id3->getTag('bitrate')/8;
	$secbit = $raz/1024/$byterate;
if($s>$secbit||$s<0){$s = 0;}
if($p>$secbit||$p<$s){$p = $secbit;}
	$s = $s*$byterate*1024;
	$p = $p*$byterate*1024;}
	$p = $p-$s;
fseek($fp, $s);
	$filefp = fread($fp, $p);
fclose($fp);
unlink($randintval);
	$fp = fopen($randintval, 'xb');
if(!fwrite($fp, $filefp) === false){
	$fp = fopen($randintval, 'rb');
	$ras= izmers(filesize($randintval));;
fclose($fp);
	$all++;


/* Ievadam jauninājumus DB */
mysql_query('UPDATE `'.$MY_pre.'faili` SET `loads`=`loads`+1, `timeload`="'.$time.'" WHERE `id`='.$id);


/* Adrese ar failu */
	echo mp_012.'<br>';
	echo '<a href="'.$randintval.'"><b>'.sys_ieladet.' ('.$ras.')</b></a><br>';
	echo '<input type="text" name="link" value="http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/'.$randintval.'"/><br>';
}else{
	echo mp_014.'<br>';}}else{
	echo mp_015.'<br>';}}


/* Beigas */
	echo '<img src="pic/main/dot.gif" alt=""> <a href="about.php?id='.$id.'&amp;'.SID.'">'.sys_abouts.'</a><br>';
	echo '<img src="pic/main/dot.gif" alt=""> <a href="index.php?id='.$back['id'].'&amp;'.SID.'">'.sys_category.'</a><br>';
	echo '<img src="pic/main/dot.gif" alt=""> <a href="index.php?'.SID.'">'.sys_dl.'</a><br>';
	echo '<img src="pic/main/home.gif" alt=""> <a href="'.$setup['home'].'/?'.SID.'">'.sys_home.'</a><br>';


/* Izdzēšam pēc dienam */
	$d = @opendir($setup['dir_audio']);
while($f = @readdir($d)) {
	if($f != '.' && $f != '..') {
	if(time() - filectime($setup['dir_audio'].'/'.$f) > $setup['del_autozip']*86400) {//PĒC LAIKA!
unlink($setup['dir_audio'].'/'.$f); }
}} @closedir($f);

} else { header ("Location: index.php?sayer=404&".SID); exit;}

include_once"thm/$setup[thm]/foot.php";
?>