Файл: download.php
Строк: 10
<?php
require('core/start.php');
$id = abs((int)$_GET['id']);
$query = "SELECT * FROM files WHERE id = '".$id."'";
$result = mysqli_query($db, $query);
$data = mysqli_fetch_array($result);
if (empty($data)) {
Redirect(HOME);
}
$query = "UPDATE files SET downloads = '".($data['downloads'] + 1)."', download_last_time = '".time()."' WHERE id = '".$id."'";
mysqli_query($db, $query);
require 'core/MP3Tool.class.php';
$mp3 = new MP3Tool();
$info = $mp3->GetMp3Info(ROOT ."/files/" . $data['path']);
$cover = ROOT . '/img/trance.jpg';
$mp3->Write(ROOT ."/files/" . $data['path'], array(), $cover);
header("Location: ". HOME ."files/" . $data['path']);
exit;