require('header.php');
?>
Admin Panel - FTD
if(isset($_POST['go']) && $_POST['go'] == 'Upload')
{
$torrent_binary = file_get_contents($_FILES['torrent']['tmp_name']);
if($torrent_binary)
{
$bencode = new BEncodeLib();
$torrent = $bencode->bdecode($torrent_binary);
$size = 0;
$infohash = sha1($bencode->bencode($torrent["info"]));
if(isset($torrent['info']['files']) && count($torrent['info']['files']))
{
foreach($torrent['info']['files'] as $file)
{
$size += $file['length'];
}
}
else
{
$size = $torrent['info']['length'];
}
$name = htmlspecialchars(stripslashes($_POST['name']));
$cat = intval($_POST['category']);
if(!is_writable('data'))
{
echo 'Fix the data directory permissions';
}
else
{
if(file_exists('data/' . $infohash . '.torrent'))
{
echo 'Torrent already added
';
}
else
{
$handle = fopen('data/meta.txt', 'a');
fwrite($handle, $infohash . '`' . $cat . '`' . $size . '`' . $name . '`' . "\n");
fclose($handle);
move_uploaded_file($_FILES['torrent']['tmp_name'], 'data/' . $infohash . '.torrent');
echo 'Uploaded: ' . $name . '(' . $infohash . ')
';
}
}
}
}
?>
Upload Torrent
Back To Yoursite - BT