phpMyBitTorrent Project Forums
phpMyBitTorrent project discussion forums

Home » Discussion Forums » M0dZ & HaCkZ » Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload
Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #565] Thu, 04 January 2007 16:25 Go to next message
lodp is currently offline  lodp
Messages: 336
Registered: June 2006
Releaser
i always found that the e-mail notification checkboxes (notify about new comments, new seeds) as well as the "check for similar torrents" checkbox shouldn't be checked by default in the torrent upload form. the email notification will annoy many people (even though you can turn it off easily), and the checking for duplicates just doesn't work so well.

what you have to do to change defaults for checkboxes is the following:

find the line that generates the checkbox in the php file (here: /upload/torrent.php). for the "check for similar torrents" checkbox, that's

echo "<tr><td><p>"._btverduplicate."</p></td><td><p><input type=\"checkbox\" name=\"jump_check\" value=\"1\" [B]checked[/B] /> "._btduplicatinfo."</p>\n</td></tr>\n";


now just remove the word "checked", and you're set: the default is now unchecked.

NOTE: you can identify the line you need by the language variables it uses (in the example that's "_btverduplicate", which is looked up in /languages/english.php and generates the line "Check for similar torrents"). also, some of the tables are labeled with a plain language comment in the file (preceeded by the character #, to be ignored when processing the code), which makes things even easier.

you can also make the checkbox+text disappear altogether by placing "#" in front of the line that generates it. i did that for the nfo-file upload and exeem link box.

i'm attaching a version of the upload form (/upload/torrent.php), that removes NFO-file, eXeem link upload, and "Check for similar torrents", and changes defaults for the email-notifications to OFF, (and also changes the style of the separators, which is purely optical).
  • Attachment: torrent.php
    (Size: 7.41KB, Downloaded 566 times)
Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #566 is a reply to message #565] Thu, 04 January 2007 17:53 Go to previous messageGo to next message
joeroberts is currently offline  joeroberts
Messages: 2174
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
Thanks man this well help alot!!
I get alot of people that ask about the exeem wanting to know what it is.


\"http://a.imageshack.us/img831/5562/mybikes.png\"
Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #567 is a reply to message #565] Thu, 04 January 2007 17:56 Go to previous messageGo to next message
joeroberts is currently offline  joeroberts
Messages: 2174
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
Thanks man this well help alot!!
I get alot of people that ask about the exeem wanting to know what it is.


\"http://a.imageshack.us/img831/5562/mybikes.png\"
Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #568 is a reply to message #565] Thu, 04 January 2007 19:44 Go to previous messageGo to next message
lodp is currently offline  lodp
Messages: 336
Registered: June 2006
Releaser
yeah, exeem sure is a dead end. and nfo-files upload is a thing of the past as well, i think.
Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #6241 is a reply to message #568] Thu, 20 December 2012 09:00 Go to previous messageGo to next message
psyfer9983 is currently offline  psyfer9983
Messages: 5
Registered: December 2012
Location: USA
Leecher
Hate to resurrect an old post, but this is on the same topic of my question.

I'm trying to disable the required .nfo file for a torrent upload. Here is the original php code from my setup.

<?php
/*
*----------------------------phpMyBitTorrent V 2.0-----------------------------*
*--- The Ultimate BitTorrent Tracker and BMS (Bittorrent Management System) ---*
*--------------   Created By Antonio Anzivino (aka DJ Echelon)   --------------*
*-------------               http://www.p2pmania.it               -------------*
*------------ Based on the Bit Torrent Protocol made by Bram Cohen ------------*
*-------------              http://www.bittorrent.com             -------------*
*------------------------------------------------------------------------------*
*------------------------------------------------------------------------------*
*--   This program is free software; you can redistribute it and/or modify   --*
*--   it under the terms of the GNU General Public License as published by   --*
*--   the Free Software Foundation; either version 2 of the License, or      --*
*--   (at your option) any later version.                                    --*
*--                                                                          --*
*--   This program is distributed in the hope that it will be useful,        --*
*--   but WITHOUT ANY WARRANTY; without even the implied warranty of         --*
*--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          --*
*--   GNU General Public License for more details.                           --*
*--                                                                          --*
*--   You should have received a copy of the GNU General Public License      --*
*--   along with this program; if not, write to the Free Software            --*
*-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA --*
*--                                                                          --*
*------------------------------------------------------------------------------*
*------              ©2005 phpMyBitTorrent Development Team              ------*
*-----------               http://phpmybittorrent.com               -----------*
*------------------------------------------------------------------------------*
*-----------------   Sunday, September 14, 2008 9:05 PM   ---------------------*
*/

if (!defined('IN_PMBT')) die ("You can't access this file directly");

echo"<script type=\"text/javascript\" src=\"bbcode.js\"></script>";


OpenTable(_btupload);

if (!$stealthmode) echo "<p>" . _btofficialurl." <b>".$announce_url."</b></p>\n";
include'include/textarea.php';
echo "<p>"._btseeded."</p>";
echo "<form enctype=\"multipart/form-data\" action=\"upload.php?op=taketorrent\" method=\"post\" id=\"data\" name=\"formdata\">\n\n";
echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"".$max_torrent_size."\" />\n";
echo "<table border=\"0\" cellspacing=\"5\" cellpadding=\"5\">\n";
echo "<tr><td><p>"._btupfile."</p></td><td><p><input type=\"file\" name=\"filex\" size=\"60\" /></p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
echo "<tr><td><p>"._btupnfo."</p></td><td><p><input type=\"file\" name=\"nfox\" size=\"60\" /></p>\n</td></tr>\n";
echo "<tr><td><hr /></td><td></td></tr>\n";
echo "<tr><td><p>"._bttorrentname."</p></td><td><p><input type=\"text\" name=\"namex\" size=\"80\" /><br />("._btfromtorrent. "<b>"._btdescname."</b>)</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
echo "<tr><td><p>IMDB LINK</p></td><td><p><input type=\"text\" name=\"imdb_info\" size=\"80\" /><br />(Add IMDB to details page By providing a imdb link or IMDB NUMBER)</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
echo "<tr><td><p>"._btdescription."</p></td>";
echo '<td>';
echo $textarea->quick_bbcode('formdata','descr');
echo $textarea->input('descr');
echo "</table><br />\n";
echo <<<EOF
<script type="text/javascript">
<!--
function vB_Attachment(listobjid, editorid)
{
	this.attachments = new Array();
	this.menu_contents = new Array();
	this.windows = new Array();

	this.listobjid = listobjid;

	if (editorid == '')
	{
		for (var editorid in vB_Editor)
		{
			if (typeof vB_Editor[editorid] != 'function')
			{
				this.editorid = editorid;
				break;
			}
		}
	}
	else
	{
		this.editorid = (editorid ? editorid : null);
	}
};

// =============================================================================
// vB_Attachment methods

/**
* Does the editor popup exist in a built state?
*
* @return	boolean
*/
vB_Attachment.prototype.popup_exists = function()
{
	if (
		this.editorid &&
		((typeof vB_Editor[this.editorid].popups['attach'] != 'undefined' && vB_Editor[this.editorid].popups['attach'] != null)
		||
		(!vB_Editor[this.editorid].popupmode && typeof vB_Editor[this.editorid].buttons['attach'] != 'undefined' && vB_Editor[this.editorid].buttons['attach'] != null))
	)
	{
		return true;
	}
	else
	{
		return false;
	}
};

/**
* Add a new attachment
*
* @param	integer	Attachment ID
* @param	string	File name
* @param	string	File size
* @param	string	Path to item's image (images/attach/jpg.gif etc.)
*/
vB_Attachment.prototype.add = function(id, filename, filesize, imgpath)
{
	this.attachments[id] = new Array();
	this.attachments[id] = {
		'filename' : filename,
		'filesize' : filesize,
		'imgpath'  : imgpath
	};

	this.update_list();
};

/**
* Remove an attachment
*
* @param	integer	Attachment ID
*/
vB_Attachment.prototype.remove = function(id)
{
	if (typeof this.attachments[id] != 'undefined')
	{
		this.attachments[id] = null;

		this.update_list();
	}
};

/**
* Do we have any attachments?
*
* @return	boolean
*/
vB_Attachment.prototype.has_attachments = function()
{
	for (var id in this.attachments)
	{
		if (this.attachments[id] != null)
		{
			return true;
		}
	}
	return false;
};

/**
* Reset the attachments array
*/
vB_Attachment.prototype.reset = function()
{
	this.attachments = new Array();

	this.update_list();
};

/**
* Build Attachments List
*
* @param	string	ID of the HTML element to contain the list of attachments
*/
vB_Attachment.prototype.build_list = function(listobjid)
{
	var listobj = fetch_object(listobjid);

	if (listobjid != null)
	{

		for (var id in this.attachments)
		{
			var div = document.getElementById("descr");
			// try to use the template if it's been submitted to Javascript
				div.innerHTML =div.value +' [img]$siteurl/UserFiles/$user->name/'+ this.attachments[id]['filename'] + '[/img]';
			listobj.appendChild(div);
		}
	}
};

/**
* Update the places we show a list of attachments
*/
vB_Attachment.prototype.update_list = function()
{
	this.build_list(this.listobjid);

	if (this.popup_exists())
	{
		vB_Editor[this.editorid].build_attachments_popup(
			vB_Editor[this.editorid].popupmode ? vB_Editor[this.editorid].popups['attach'] : vB_Editor[this.editorid].buttons['attach'],
			vB_Editor[this.editorid].buttons['attach']
		);
	}
};

/**
* Opens the attachment manager window
*
* @param	string	URL
* @param	integer	Width
* @param	integer	Height
* @param	string	Hash
*
* @return	window
*/
vB_Attachment.prototype.open_window = function(url, width, height, hash)
{
	if (typeof(this.windows[hash]) != 'undefined' && this.windows[hash].closed == false)
	{
		this.windows[hash].focus();
	}
	else
	{
		this.windows[hash] = openWindow(url, width, height, 'Attach' + hash);
	}

	return this.windows[hash];
};
//-->
</script>
<script type="text/javascript" src="./java/tl.js"><!-- overLIB (c) Erik Bosrup --></script>

<fieldset class="fieldset">
	<legend>Attach Files</legend>

	<div style="padding:3px">
		<div style="margin-bottom:3px">
			<div>Your Image Bucket</div>
			<div>Valid file extensions: bmp gif jpe jpeg jpg png</div>
		</div>
		<div style="margin-bottom:3px" id="attachlist">
			
		</div>
		<div>
			<input type="button" id="manage_attachments_button" class="button" tabindex="1" style="font-weight:normal" value="Manage Attachments" title="Click here to add or edit files attached to this message" onclick="vB_Attachments.open_window('bitbucket-upload.php', 800, 600, '')" />

			<script type="text/javascript">vB_Attachments = new vB_Attachment('descr', '');</script>
			<noscript>
			<a rel="nofollow" href="newattachment.php?f=23&amp;poststarttime=1230080445&amp;posthash=68db1fa686788e92c0ebd0f96cefb1a9" target="manageattach" title="Click here to add or edit files attached to this message" tabindex="1"><strong>Manage Attachments</strong></a>
			</noscript>
		</div>
	</div>
</fieldset>
EOF;
echo"</td></tr>\n";
$s = "<select name=\"torrent_category\"><option value=\"0\">("._btchooseone.")</option>\n";
$cats = catlist();
foreach ($cats as $row)
        $s .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n";
$s .= "</select>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";

echo "<tr><td><p>"._bttype."</p></td><td><p>". $s ."</p></td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";

echo "<tr><td><p>"._btverduplicate."</p></td><td><p><input type=\"checkbox\" name=\"jump_check\" value=\"1\"  /> "._btduplicatinfo."</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
if ($user->premium){
                echo "<tr><td><p>Ratio Builder<p></td><td><p><input type=radio name=build value=yes>Yes<input type=radio name=build checked value=no>No</p>\n</td></tr>\n";
                echo "<tr><td><hr size=\"1\" noshade></td><td></td></tr>";
}
if($shout_config['shout_new_torrent'] == "yes"){
#shout new torrent
echo "<tr><td><p>"._btnewtsh."</p></td><td><p><input type=\"checkbox\" name=\"shout\" value=\"1\"  /> "._btnewshex."</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
}

#Evidence. Moderators Only
if ($user->moderator) {
        echo "<tr><td><p>"._btupevidence."</p></td><td><p><input type=\"checkbox\" name=\"evidence\" value=\"1\" /> "._btupevidencinfo."</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
}

#Owner Preferences. Not for Anonymous Users
if ($user->user) {
        echo "<tr><td><p>"._btowner."</p></td><td><p><select name=\"ownertype\">\n<option value=\"0\">"._btowner1."</option><option value=\"1\">"._btowner2."</option><option value=\"2\">"._btowner3."</option></select> "._btownerinfo."</p>\n</td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
}

#Torrent Password
echo "<tr><td><p>"._btpassword."</p></td><td><p><input type=\"text\" name=\"password\" value=\"\" /><br />"._bttorrentpasswordexplain."</p>\n</td>\n</tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";


#Advanced Options
echo "<tr><td><p>"._btupadvopts."</p></td><td><p><input type=\"checkbox\" name=\"adv_opts\" value=\"1\" onClick=\"javascript:expand();\" id=\"adv_check\" /><br />"._btadvoptsexplain."</p></td></tr>\n";
##DHT Support
echo "<tr id=\"advanced_options_1\" class=\"hide\"><td><p>"._btdhtsupport."</p></td><td><p><input type=\"radio\" name=\"dht_support\" value=\"0\" checked />"._btleaveintact."<br /><input type=\"radio\" name=\"dht_support\" value=\"1\" onClick=\"javascript:document.formdata.private_torrent[2].checked = true;\" />"._btendht."<br /><input type=\"radio\" name=\"dht_support\" value=\"2\" />"._btdisdht."<br />"._btdhtsupportexplain."</p></td></tr>\n";
##Private Torrent
echo "<tr id=\"advanced_options_2\" class=\"hide\"><td><p>"._btprivatetorrent."</p></td><td><p><input type=\"radio\" name=\"private_torrent\" value=\"0\" checked />"._btleaveintact."<br /><input type=\"radio\" name=\"private_torrent\" value=\"1\" onClick=\"javascript:document.formdata.dht_support[2].checked = true;\" />"._btenpvt."<br /><input type=\"radio\" name=\"private_torrent\" value=\"2\">"._btdispvt."<br />"._btprivatetorrentexplain."</p></td></tr>\n";


echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
#Notify. Only for Registered Users
if ($user->user) {
        echo "<tr><td><p>"._btupnotify."</p></td><td><p><input type=\"checkbox\" name=\"commnotify\" value=\"ok\" > "._btupnotifynfo."<br /><input type=\"checkbox\" name=\"seednotify\" value=\"ok\" > "._btupnotifyseed."</p></td></tr>\n";
echo "<tr><td><HR SIZE=1 NOSHADE></td><td></td></tr>\n";
}

echo "</table><hr /><input type=\"submit\" value=\""._btfsend."\"></form>\n";
CloseTable();
?>


I have looked all over and came to this post and even tried modding the code but keep getting the same error as before. The error is "Form has NOT been Submitted due to the following Errors: Fatal Error in Uploaded File. File Empty" which is due to the .nfo file not present in the upload. I only want the checking of the .nfo file removed so its optional for uploading cause it still has use for me and others if this all works out. Everything else is ok so far. Thanks.

PS. I have tried the attached "torrent.php" file and it didn't work. I get only the torrent upload, description box and shout or sticky check box showing with out a submit button. I even tried compering the two files to see if I could figure out what code to mod to remove the check.
Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #6247 is a reply to message #6241] Fri, 21 December 2012 04:17 Go to previous messageGo to next message
joeroberts is currently offline  joeroberts
Messages: 2174
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
the attached File in this post is for PMBT V1 that is why it dont work.
can you please post your upload/taketorrent.php be cause the upload nfo should be optional.


\"http://a.imageshack.us/img831/5562/mybikes.png\"
Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #6251 is a reply to message #565] Fri, 21 December 2012 09:32 Go to previous messageGo to next message
psyfer9983 is currently offline  psyfer9983
Messages: 5
Registered: December 2012
Location: USA
Leecher
Ok, thanks for getting back with me. Here is the "taketorrent.php" code.

<?php
/*
*----------------------------phpMyBitTorrent V 2.0-beta3-----------------------*
*--- The Ultimate BitTorrent Tracker and BMS (Bittorrent Management System) ---*
*--------------   Created By Antonio Anzivino (aka DJ Echelon)   --------------*
*-------------               http://www.p2pmania.it               -------------*
*------------ Based on the Bit Torrent Protocol made by Bram Cohen ------------*
*-------------              http://www.bittorrent.com             -------------*
*------------------------------------------------------------------------------*
*------------------------------------------------------------------------------*
*--   This program is free software; you can redistribute it and/or modify   --*
*--   it under the terms of the GNU General Public License as published by   --*
*--   the Free Software Foundation; either version 2 of the License, or      --*
*--   (at your option) any later version.                                    --*
*--                                                                          --*
*--   This program is distributed in the hope that it will be useful,        --*
*--   but WITHOUT ANY WARRANTY; without even the implied warranty of         --*
*--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          --*
*--   GNU General Public License for more details.                           --*
*--                                                                          --*
*--   You should have received a copy of the GNU General Public License      --*
*--   along with this program; if not, write to the Free Software            --*
*-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA --*
*--                                                                          --*
*------------------------------------------------------------------------------*
*------              ©2005 phpMyBitTorrent Development Team              ------*
*-----------               http://phpmybittorrent.com               -----------*
*------------------------------------------------------------------------------*
*-----------------   Sunday, September 14, 2008 9:05 PM   ---------------------*
*/

if (!defined('IN_PMBT')) die ("You can't access this file directly");

@ini_set("upload_max_filesize",$max_torrent_size);
@set_time_limit(60);
@ini_set("memory_limit","64M");


require_once("include/bdecoder.php");
require_once("include/bencoder.php");

function hex_to_base32($hex) {
  $b32_alpha_to_rfc3548_chars = array(
    '0' => 'A',
    '1' => 'B',
    '2' => 'C',
    '3' => 'D',
    '4' => 'E',
    '5' => 'F',
    '6' => 'G',
    '7' => 'H',
    '8' => 'I',
    '9' => 'J',
    'a' => 'K',
    'b' => 'L',
    'c' => 'M',
    'd' => 'N',
    'e' => 'O',
    'f' => 'P',
    'g' => 'Q',
    'h' => 'R',
    'i' => 'S',
    'j' => 'T',
    'k' => 'U',
    'l' => 'V',
    'm' => 'W',
    'n' => 'X',
    'o' => 'Y',
    'p' => 'Z',
    'q' => '2',
    'r' => '3',
    's' => '4',
    't' => '5',
    'u' => '6',
    'v' => '7'
  );
  $b32_alpha = "";
  for ($pos = 0; $pos < strlen($hex); $pos += 10) {
    $hs = substr($hex,$pos,10);
    $b32_alpha_part = base_convert($hs,16,32);
    $expected_b32_len = strlen($hs) * 0.8;
    $actual_b32_len = strlen($b32_alpha_part);
    $b32_padding_needed = $expected_b32_len - $actual_b32_len;
    for ($i = $b32_padding_needed; $i > 0; $i--) {
      $b32_alpha_part = '0' . $b32_alpha_part;
    }
    $b32_alpha .= $b32_alpha_part;
  }
  $b32_rfc3548 = "";
  for ($i = 0; $i < strlen($b32_alpha); $i++) {
    $b32_rfc3548 .= $b32_alpha_to_rfc3548_chars[$b32_alpha[$i]];
  }
  return $b32_rfc3548;
}

$torrent_edited = false;

$errmsg = Array();

if (!isset($_FILES["filex"]))
        $errmsg[] = _btmissingdata;


$category = intval($torrent_category);
if ($category < 1) bterror(_btnoselected,_btuploaderror);

$cats = catlist();
$in_cat = false;
while ($cat = each($cats) AND !$in_cat) {
        if ($category == $cat[1]["id"]) $in_cat = true;
}

if (!$in_cat) $errmsg[] = _btillegalcat;
if(strlen($imdb_info) > 1)$imdb = $imdb_info;
else
$imdb = '';

$f = $_FILES["filex"];
$fname = unesc($f["name"]);

if (empty($fname))
        $errmsg[] = _btemptyfname;
if (!is_filename($fname))
        $errmsg[] = _btinvalidfname;
if (!preg_match('/^(.+)\.torrent$/si', $fname, $matches))
        $errmsg[] = _btfnamenotorrent;

$nf = $_FILES["nfox"];
$nfname = unesc($nf["name"]);
if ($nfname != "") {
        if (!is_filename($nfname))
                $errmsg[] = _btinvalidnfofname;
        if (!preg_match('/^(.+)\.nfo$/si', $nfname))
                $errmsg[] = _btfnamenonfo;
        if (!is_uploaded_file($nf["tmp_name"]))
                $errmsg[] = _bterrnonfoupload;
        if ($nf["size"] <= 0)
                $errmsg[] = _btemptyfile;
}

#Return Error
if (count($errmsg) > 0)
        bterror($errmsg,_btupload);

$shortfname = $torrentname = $matches[1];
if (!empty($namex))
        $torrentname = unesc($namex);

$tmpname = $f["tmp_name"];

if (!is_uploaded_file($tmpname))
        $errmsg[] = _bterrnofileupload;
if (!filesize($tmpname))
        $errmsg[] = _btemptyfile;

#Return Error
if (count($errmsg) > 0)
        bterror($errmsg,_btuploaderror);


$uploader_host = gethostbyaddr($_SERVER["REMOTE_ADDR"]); //uploader's hostname

#File read
$pagetorrent = "";
$fp = @fopen($tmpname,"rb");
while (!@feof($fp)) {
        $pagetorrent .= @fread($fp,1000);
}
@fclose($fp);
//Decode
$torrent = Bdecode($pagetorrent);
unset($pagetorrent);
if (!entry_exists($torrent,"info(Dictionary)")) bterror("test1".$torrent."",_btuploaderror,false);
if (!entry_exists($torrent,"announce(String)")) bterror("test2".$torrent."",_btuploaderror);
$info = entry_get($torrent,"info");
$announce = entry_read($torrent,"announce(String)");


#Checking against DHT
$dht = "no";
if (entry_exists($torrent,"azureus_properties/dht_backup_enable(Integer)")) {
        if (entry_read($torrent,"azureus_properties/dht_backup_enable(Integer)") != 0) $dht = "yes";
}

$info_intact = true;

if (isset($adv_opts) AND $adv_opts == 1 OR $addprivate) {
        if (!isset($dht_support)) $dht_support = 0;
        if (!isset($private_torrent)) $private_torrent = 0;

        //If DHT Support is forced we must disable Private Flag
        $root = $torrent->first_child();
        if ($dht_support == 1) {

                $private_torrent = 2;
                if ($dht == "no") {
                        if (entry_exists($torrent,"azureus_properties")) {
                                $az_props = entry_get($torrent,"azureus_properties");
                        } else {
                                $az_props = $torrent->create_element("azureus_properties");
                                $az_props->set_attribute("type","Dictionary");
                        }
                        if (entry_exists($torrent,"dht_backup_enable")) {
                                $dht_back = $torrent->create_element("dht_backup_enable");
                                $az_props->remove_child($dht_back);
                        }
                        $dht_back = $torrent->create_element("dht_backup_enable");
                        $dht_back->set_attributes("type","Integer");
                        $enable = $torrent->create_text_node("1");
                        $dht_back->append_child($enable);
                        $az_props->append_child($dht_back);
                        foreach ($root->child_nodes() as $child) {
                                if ($child->node_name() > "azureus_properties") break;
                        }
                        $root->insert_before($az_props,$child);
                }
        } elseif ($dht_support == 2) {
                if ($dht == "yes") {
                        $aznode = entry_get($torrent,"azureus_properties");
                        $dhtnode = entry_get($torrent,"azureus_properties/dht_backup_enable");
                        $aznode->remove_child($dhtnode);
                        if (!$aznode->has_child_nodes()) $root->remove_child($aznode);

                }
        }
        unset($root);

        $priv_exists = entry_exists($torrent,"info/private(Integer)");
        $priv_enabled = ($priv_exists AND entry_read($torrent,"info/private(Integer)") == 1);

        if ($private_torrent == 1 OR $addprivate) {
		if($announce == $announce_url){
                //Force enabling Private Torrent
                if (!$priv_enabled ) {
                        $info_intact = false;
                        if ($priv_exists) {
                                $private = entry_get($torrent,"info/private");
                                $info->remove_child($private);
                        }
                        $private = $torrent->create_element("private");
                        $private->set_attribute("type","Integer");
                        $enable = $torrent->create_text_node("1");
                        $private->append_child($enable);
                        foreach ($info->child_nodes() as $child) {
                                if ($child->node_name() > "private") break;
                        }
                        $info->append_child($private);
                }
			}
        } elseif ($private_torrent == 2) {
                if ($priv_exists) {
                        $info_intact = false;
                        $private = entry_get($torrent,"info/private");
                        $info->remove_child($private);
                }
        }
}


#Name, piece length and pieces

if (!entry_exists($torrent,"info/piece length(Integer)")) bterror("test3",_btuploaderror);
if (!entry_exists($torrent,"info/pieces(String)")) bterror("test4",_btuploaderror);
$dname = (entry_exists($torrent,"info/name(String)")) ? $dname = entry_read($torrent,"info/name(String)") : "";
$plen = entry_read($torrent,"info/piece length(Integer)");
$pieces = entry_read($torrent,"info/pieces(String)");

if (strlen($pieces) % 20 != 0)
        bterror(_btinvpieces,_btuploaderror);
unset($pieces);

$tcomment = (entry_exists($torrent,"comment(String)")) ? entry_read($torrent,"comment(String)") : "";

#Parsing Torrent Description
if ($tcomment == "" AND (!isset($descr) OR empty($descr))) bterror(_btdescrrequired,_btuploaderror);
if (get_magic_quotes_gpc()) $descr = stripslashes($descr);
if ($descr == "") $descr = parsedescr($tcomment);
if ($allow_html) {
        if (preg_match("/<[^>]* (on[a-z]*[.]*)=[^>]*>/i", $descr)) //HTML contains Javascript EVENTS. Must refuse
                bterror(_btinvalidhtml,_btuploaderror);
        if (preg_match('/<a[^>]* href="[^"]*(javascript|vbscript):[^>]*>/i', $descr)) //HTML contains Javascript or VBScript calls. Must refuse
                bterror(_btinvalidhtml,_btuploaderror);
}
parse_html($descr);
$forum_des = $descr;
$descr = addslashes($descr);


#Parsing Announce
$annregexp_http = "/(http[s]?+):\/\/[-\/.:_\\w]*\/announce[^\/\\s]*/i";
$annregexp_dht = "/^dht:\/\/[0-9a-f]*.dht\/announce$/i";
$annregexp_udp = "/udp:\/\/[-\/.:_\\w]*\/announce[^\/\\s]*/i";
if ($announce == $announce_url) {
        if ($stealthmode) bterror(str_replace("**name**",$sitename,_bttrackerdisabled),_btuploaderror);
        $announce = "";
} elseif (preg_match($annregexp_http, $announce)) {
        $sql = "SELECT id FROM ".$db_prefix."_trackers WHERE url = '".addslashes($announce)."' AND status = 'blacklisted' LIMIT 1;";
        $res = $db->sql_query($sql);
        if ($db->sql_numrows($res) > 0) bterror(str_replace("**trk**",$announce,_bttrackerblacklisted),_btuploaderror);
        $db->sql_freeresult($res);
} elseif (preg_match($annregexp_dht,$announce)) {
        $dht = "yes";
} else {
        bterror(_btinvannounce."<b>".$announce."</b>",_btuploaderror);
}
//UDP trackers or trackers inside the TOR/I2P networks are not supported *yet*



#Parsing Multiple Announce
$trackers = "NULL";
$backup_tracker = "false";
if (entry_exists($torrent,"announce-list(List)")) {
if (!$allow_multy_tracker)bterror('backup trackers not allowed',_btuploaderror);
        $trackers = Array();
        $to_check = Array();
        $announce_list = entry_read($torrent,"announce-list(List)");
        foreach ($announce_list as $group) {
                $trackers_in_group = Array();
                foreach ($group->child_nodes() as $tracker_node) {
                        $tracker = $tracker_node->get_content();
                        if (!preg_match($annregexp_http,$tracker) AND !preg_match($annregexp_udp,$tracker)) bterror(_btinvannounce."<b>".$tracker."</b>",_btuploaderror);
                        //If the main tracker is NOT this one, but this one APPEARS within the Announce list then we're running backup tracker
                        if ($tracker["value"] == $announce_url AND $announce != "") $backup_tracker = "true";
                        array_push($trackers_in_group,$tracker);
                        array_push($to_check,"'".$tracker."'");
                        unset($tracker, $tracker_node);
                }
                array_push($trackers,$trackers_in_group);
                unset($trackers_in_group, $group);

        }
        $sql = "SELECT url FROM ".$db_prefix."_trackers WHERE url IN (".implode(", ",$to_check).") AND status = 'blacklisted';";
        $res = $db->sql_query($sql) or btsqlerror($sql);
        if ($db->sql_numrows($res) > 0) {
                $blacklisted_trackers = $db->sql_fetchrowset($res);
                $blacklisted_trackers = implode(",",$blacklisted_trackers);
                bterror(str_replace("**trk**",$blacklisted_trackers,_bttrackerblacklisted),_btuploaderror);
        }
        $db->sql_freeresult($res);
        unset($sql, $to_check,$announce_list, $res);
        for ($i = 0; $i < count($trackers); $i++) $trackers[$i] = implode("\n",$trackers[$i]);
        $trackers = "'".addslashes(implode("\n\n",$trackers))."'";
}


#Parsing password
$torrentpass = $password; //Keep for URL Redirect
if ($password != "" AND $announce == "") {
        if (!get_magic_quotes_gpc()) $password = addslashes($password);
        $password = "'".$password."'";
} else $password = "NULL";


#Parsing files
$filelist = Array();
if (entry_exists($torrent,"info/length(Integer)")) {
        //Single file
        $totallen = entry_read($torrent,"info/length(Integer)");

        if (entry_exists($torrent,"info/sha1(String)")) {
                $sha1code = entry_read($torrent, "info/sha1(String)");
                $magnet_link = "magnet:?xt=urn:sha1:".addslashes(hex_to_base32($sha1code))."&dn=".urlencode($dname);
        } else {
                $magnet_link = "";
        }
        if (entry_exists($torrent,"info/ed2k(String)")) {
                $ed2k = entry_read($torrent, "info/ed2k(String)");
                $ed2k_link = "ed2k://|file|".urlencode($dname)."|".$totallen."|".strtoupper(str_pad($ed2k,32,"0"))."|/";
        } else {
                $ed2k_link = "";
        }
        $filelist[] = Array($dname, $totallen, $magnet_link, $ed2k_link);
        $type = "single";
} else {
        //Multiple files
        $flist = entry_read($torrent, "info/files(List)");
        if (!isset($flist))
                bterror(_btmissinglength,_btuploaderror);
        if (!count($flist))
                bterror(_btnofilesintorrent,_btuplaoderror);
        #$totallen = 0;
        foreach ($flist as $fn) {
                $ffe = "";
                $magnet_link = "";
                $ed2k_link = "";
                $children = $fn->child_nodes();
                $file = Array();
                foreach ($children as $child) {
                        $file[$child->tagname] = $child;
                }

                if (!array_key_exists("length",$file) OR !array_key_exists("path",$file)) bterror("test5",_btuploaderror);

                $ll = $file["length"]->get_content();

                $path = Array();
                foreach ($file["path"]->child_nodes() as $p) array_push($path,$p->get_content());
                $ffe = implode("/",$path);
                if (empty($ffe)) bterror(_btfilenamerror,_btuploaderror);

                if (array_key_exists("sha1",$file)) {
                        $magnet_link = "magnet:?xt=urn:sha1:".addslashes(hex_to_base32($file["sha1"]->get_content()))."&dn=".urlencode($path[count($path)-1]);
                }
                if (array_key_exists("ed2k",$file)) {
                        $ed2k_link = "ed2k://|file|".urlencode($path[count($path)-1])."|".$ll."|".strtoupper(str_pad($file["ed2k"]->get_content(),32,0))."|/";
                }
                unset($p, $path);

                $filelist[] = Array($ffe, $ll, $magnet_link, $ed2k_link);
                $totallen += $ll;
        }
        $type = "multi";
}

#Info Hash. The most important value
$infohash_hex = sha1(Benc($info));
$infohash = pack("H*", $infohash_hex);
unset($info);

#eXeem Alternate Link
if (isset($exeem) AND $exeem != "" AND $info_intact) {
        if (!eregi("^exeem://[\\d]{1,2}/".$infohash_hex."/", $exeem)) bterror(_btinvalidexeem,_btuploaderror);
} else {
        $exeem = "";
}

#Torrent Owner
$owner = $user->id;
$ownertype = ($owner == 0) ? 0 : intval($ownertype);
if ($ownertype == 2) $owner = 0;
if (isset($evidence) AND $user->moderator) $evidence = 1;
else $evidence = 0;

#Checking against the SAME Torrent
if (isset($jump_check) AND $jump_check == 1) {
$sql = "SELECT id FROM ".$db_prefix."_torrents WHERE info_hash = '".addslashes($infohash)."';";
$res = $db->sql_query($sql) or btsqlerror($sql);
if ($db->sql_numrows($res) > 0) {
        list ($id) = $db->sql_fetchrow($res);
        bterror(str_replace("#id#",$id,_bttorrentpresent),_btuploaderror);
}
$db->sql_freeresult($res);
}

if (!is_premium($btuser)) {
        $sql = "SELECT count(id) as num, sum(size) as tot_size FROM ".$db_prefix."_torrents where added > sysdate() - 1000000 AND owner = '".$user->id."'";
        $res = $db->sql_query($sql) or btsqlerror($sql);
        list ($torrents, $uploaded_size) = $db->sql_fetchrow($res);
        $db->sql_freeresult($res);

        #Checking against minimumupload size
        if ($totallen < $minupload_size_file)
                bterror(_bttorrenttoosmall1.mksize($minupload_size_file)._bttorrenttoosmall2.mksize($totallen)."</b>.",_btuploaderror);

        #Checking against Max num upload on 24h time
        if ($maxupload_day_num > 0 AND $maxupload_day_num <= $torrents)
                bterror(str_replace("**maxupload**",$maxupload_day_num,_btmaxuploadexceeded),_btuploaderror);

        #Max size share upload on 24h
        if ($maxupload_day_share > 0 AND $maxupload_day_share < $uploaded_size+$totallen) {
                $search = Array("**maxupload**","**rownum**","**totsize**");
                $replace = Array($maxupload_day_share,$torrents,mksize($uploaded_size));
                bterror(str_replace($search,$replace,_btnumfileexceeded),_btuploaderror);
        }
}

#Filename must be at least 4 chars
$materia = trim($fname);
$pos = strrpos($materia, '.');
if (!$pos===false)
        $materia = substr($materia, 0, $pos);
$search = array ("'[^\w]'",                 // Remove not letter
        "'([\r\n])[\s]+'"                 // Remove Blank space
);
$replace = array (
        " ",
        "\\1"
);
$materia = preg_replace ($search, $replace, $materia);
$materia = explode(" ", $materia);

$sql_filter = "";
foreach($materia as $x) {
        $x = trim($x);
        if(strlen($x) > 2){
                $sql_filter .= " OR keyword LIKE '".$x."'";
        }
}
$errmsg = "";
$sql_filter = "SELECT * FROM ".$db_prefix."_filter WHERE 1=0 ".$sql_filter.";";
$res = $db->sql_query($sql_filter) or btsqlerror($sql_filter);
if ($db->sql_numrows($res) > 0) {
                $errmsg = "<p align=\"center\">"._btillegalword."</p></br>";
              
                while ($row = $db->sql_fetchrow($res)){
                        $errmsg.= "<p align=\"center\">".htmlspecialchars($row["reason"])."</p></br>";
                }
              
                $errmsg.= "<p align=\"center\">"._btillegalwordinfo."</p>";
                bterror($errmsg,_btuploaderror);
}
$db->sql_freeresult($res);

#Checking against SIMILAR files
if (isset($jump_check) AND $jump_check == 1) {
        $materia=trim($fname);
        $pos = strrpos($materia, '.');
        if (!$pos===false)
                $materia = substr($materia, 0, $pos);
        $search = array (
                 "'[^a-zA-Z]'",                 // Remove not lecter
                 "'([\r\n])[\s]+'"                 // Remove Blank space
        );
        $replace = array (
                 " ",
                 "\\1"
        );

        $materia = preg_replace ($search, $replace, $materia);
        $materia = explode(" ", $materia);

        $sql = "";
        $sql_filter = "";
        foreach($materia as $x){
                $x = trim($x);
                if(strlen($x)>=5){
                        $sql .= " OR filename LIKE '".str_replace("\'","\\\'",$x)."'";
                }
        }
        foreach ($filelist as $file) {
                $sql .= " OR size = '".$file[1]."'";
        }


        $sql = "SELECT torrent, filename, size FROM ".$db_prefix."_files WHERE 1=0 ".$sql;
        $res = $db->sql_query($sql) or bterror($sql);

        $errmsg = "";
        if ($db->sql_numrows($res) > 0){
                $errmsg = _btsearchdupl;
                $errmsg .= "<ul>\n";
                while ($row = $db->sql_fetchrow($res)){
                        $errmsg.= "<li><p><a href='details.php?id=".$row["torrent"]."&hit=1'>".$row["filename"]."</a> (".mksize($row["size"]).")</p></li>\n";
                }
                $errmsg .= "</ul>\n";
                $errmsg .= _btduplinfo;
                bterror($errmsg,_btuploaderror);
        }
}


#$searchtext = "".$shortfname." ". $dname." ". $descr." ".implode(" ",$filelist);

$searchtext = "".$shortfname." ". $dname." ". $descr." ";
foreach($filelist as $subarray) {
$searchtext.=implode(" ",$subarray);
}

#Parsing external tracker sources
global $force_upload; //Used to force upload even if Torrent has 0 peers or the tracker does not respond
$seeders = $leechers = $tot_peer = 0;
if($autoscrape AND $announce != "") {
if(!$allow_external)bterror("external torrents not allowed",_btuploaderror);
        $tmp_tracker = str_replace("announce", "scrape", $announce).((strpos($scrape_url,"?")) ? "&" : "?")."info_hash=".urlencode($infohash);
        #echo $tmp_tracker;
        if ($fp = @fopen($tmp_tracker, "rb")) {
                stream_set_timeout($fp, 10);
                $page = "";
                while (!feof($fp)) {
                        $page .= @fread($fp,1000000);
                }
                @fclose($fp);
				#echo $page;
				
                $scrape = Bdecode($page,"Scrape");
                unset($page);
                #Debug 2
                //echo str_replace(Array(" ","\n"),Array("&nbsp;","<br />\n"),htmlspecialchars($scrape->dump_mem(true,"UTF-8")));
                #Check data
                if (!entry_exists($scrape,"files(dictionary)","Scrape")) {
                        bterror(_bttrackerdata,_btscrapeerror);
                } elseif (!entry_exists($scrape,"files/a".$infohash_hex."(Dictionary)","Scrape")) {
                        bterror(_bttorrentnotregistered,_btscrapeerror,false);
                } else {
                        #Check seeder
                        $seeders = entry_read($scrape,"files/a".$infohash_hex."/complete(Integer)","Scrape");
						if ($seeders <= 0 AND $force_upload) bterror(_btnoseedersontracker,_btnoseedersontracker,false);
                        if ($seeders <= 0 AND !$force_upload) bterror(_btnoseedersontracker,_btscrapeerror);
                        $leechers = entry_read($scrape,"files/a".$infohash_hex."/incomplete(Integer)","Scrape");
                        $completed = entry_read($scrape,"files/a".$infohash_hex."/downloaded(Integer)","Scrape");
                }
                unset($scrape);
                $visible = ($tot_peer > 0) ? "yes" : "no";				
        } elseif (!$force_upload) {
                bterror(_bttrackernotresponding.$announce,_btscrapeerror);
        }
} else {
                $completed = 0;
                $visible = ($announce != "") ? "yes" : "no";
}
if(!isset($build)) $build = "no";

#Preparing SQL
$torrentfields = Array();
$torrentvalues = Array();

$torrentfields[] = "info_hash";
$torrentvalues[] = "'".addslashes($infohash)."'";

$torrentfields[] = "name";
$torrentvalues[] = "'".addslashes($torrentname)."'";

$torrentfields[] = "filename";
$torrentvalues[] = "'".addslashes($dname)."'";

$torrentfields[] = "save_as";
$torrentvalues[] = "'".addslashes($shortfname)."'";

$torrentfields[] = "md5sum";
$torrentvalues[] = "'".md5_file($tmpname)."'";

$torrentfields[] = "search_text";
$torrentvalues[] = "'".addslashes($searchtext)."'";

$torrentfields[] = "descr";
$torrentvalues[] = "'".$descr."'";

$torrentfields[] = "size";
$torrentvalues[] = "'".$totallen."'";

$torrentfields[] = "ratiobuild";
$torrentvalues[] = "'".$build."'";

$torrentfields[] = "plen";
$torrentvalues[] = "'".$plen."'";

$torrentfields[] = "category";
$torrentvalues[] = "'".intval($category)."'";

$torrentfields[] = "type";
$torrentvalues[] = "'".$type."'";

$torrentfields[] = "numfiles";
$torrentvalues[] = "'".count($filelist)."'";

$torrentfields[] = "added";
$torrentvalues[] = "NOW()";

$torrentfields[] = "exeem";
if (isset($exeem) AND $exeem != "") $torrentvalues[] = "'".$exeem."'";
else $torrentvalues[] = "NULL";

$torrentfields[] = "dht";
$torrentvalues[] = "'".$dht."'";

$torrentfields[] = "backup_tracker";
$torrentvalues[] = "'".$backup_tracker."'";

$torrentfields[] = "views";
$torrentvalues[] = "'0'";

$torrentfields[] = "downloaded";
$torrentvalues[] = "'0'";

$torrentfields[] = "completed";
$torrentvalues[] = "'".$completed."'";

$torrentfields[] = "banned";
$torrentvalues[] = "'no'";

$torrentfields[] = "password";
$torrentvalues[] = $password;

$torrentfields[] = "visible";
$torrentvalues[] = "'".$visible."'";

$torrentfields[] = "evidence";
$torrentvalues[] = "'".intval($evidence)."'";

$torrentfields[] = "owner";
$torrentvalues[] = "'".intval($owner)."'";

$torrentfields[] = "ownertype";
$torrentvalues[] = "'".intval($ownertype)."'";

$torrentfields[] = "uploader_host";
$torrentvalues[] = "'".$uploader_host."'";

$torrentfields[] = "numratings";
$torrentvalues[] = "'0'";

$torrentfields[] = "ratingsum";
$torrentvalues[] = "'0'";

$torrentfields[] = "seeders";
$torrentvalues[] = "'".intval($seeders)."'";

$torrentfields[] = "leechers";
$torrentvalues[] = "'".intval($leechers)."'";

$torrentfields[] = "tot_peer";
$torrentvalues[] = "'".intval($seeders+$leechers)."'";

$torrentfields[] = "speed";
$torrentvalues[] = "'0'";

$torrentfields[] = "comments";
$torrentvalues[] = "'0'";

$torrentfields[] = "complaints";
$torrentvalues[] = "'0,0'";

$torrentfields[] = "tracker";
if ($announce == "") $torrentvalues[] = "NULL";
else $torrentvalues[] = "'".$announce."'";

$torrentfields[] = "tracker_list";
$torrentvalues[] = $trackers;

$torrentfields[] = "tracker_update";
$torrentvalues[] = "NOW()";

$torrentfields[] = "last_action";
$torrentvalues[] = "NOW()";

if(strlen($imdb) > 1){
$torrentfields[] = "imdb";
$torrentvalues[] = "'".$imdb."'";
}


$torrentsql = "INSERT INTO ".$db_prefix."_torrents (".implode(", ",$torrentfields).") VALUES (".implode(", ",$torrentvalues).");";

$db->sql_query($torrentsql) or btsqlerror($torrentsql);
$id = $db->sql_nextid();
if ($id == 0) bterror("Torrent ID Error",_btuploaderror);

if ($announce != ""){ 
$db->sql_query("INSERT INTO ".$db_prefix."_trackers (url, updated) VALUES ('".addslashes($announce)."', NOW());");
}
$db->sql_query("DELETE FROM ".$db_prefix."_files WHERE torrent = '".$id."'") or btsqlerror("DELETE FROM ".$db_prefix."_files WHERE torrent = '$id'");
foreach ($filelist as $file) {
        list ($fname, $fsize, $magnet, $ed2k) = $file;
        $fields = "(torrent, filename, size";
        $values = "('".$id."', '".str_replace("'","\'",$fname)."', '".$fsize."'";
        if ($magnet != "") {
                $fields.= ", magnet";
                $values.= ", '".addslashes($magnet)."'";
        }
        if ($ed2k != "") {
                $fields.= ", ed2k";
                $values.= ", '".addslashes($ed2k)."'";
        }
        $fields.= ")";
        $values.= ")";
        $filesql = "INSERT INTO ".$db_prefix."_files ".$fields." VALUES ".$values.";";
        if (!$db->sql_query($filesql)) { //Rollback
                $db->sql_query("DELETE FROM ".$db_prefix."_torrents WHERE id = '".$id."' LIMIT 1;");
                $db->sql_query("DELETE FROM ".$db_prefix."_files WHERE torrent = '".$id."';");
                btsqlerror($filesql);
        }
}

$torrentpath = $torrent_dir."/".$id.".torrent";
if (file_exists($torrentpath)) unlink($torrentpath);

$fp = fopen($torrentpath,"wb");
fwrite($fp,Bencode($torrent));
fclose($fp);
@unlink($tmpname);

$nfopath = "$torrent_dir/".$id.".nfo";
if (file_exists($nfopath)) unlink($nfopath);
if (!empty($nfname)) move_uploaded_file($nf["tmp_name"],$nfopath);
$url = "details.php?id=".$id."&upcomplete=1";
if ($password != "NULL") { //Password is included in SQL Statement
        $url .= "&password=".$torrentpass;
}
if (!$info_intact) { //If Info Hash changed the user MUST re-download the Torrent to use it
        $url .= "&upload_notice=1";
}
echo "<meta http-equiv=\"refresh\" content=\"6;url=".$url."\">";

OpenTable(_btupload);
                        $bon = "SELECT active, upload FROM ".$db_prefix."_bonus_points ;";
                        $bonset = $db->sql_query($bon);
                        list ($active, $upload_point) = $db->sql_fetchrow($bonset);
                        $db->sql_freeresult($bonset);
if($active=='true')
{
$do="UPDATE ".$db_prefix."_users SET seedbonus = seedbonus + '".$upload_point."' WHERE id= ".$user->id."" ;
$db->sql_query($do) or btsqlerror($do);
}
global $allow_posting;//Are we allowed to post new topics
if($allow_posting){
$pmbtuser = $user;
define('IN_PORTAL',TRUE);
define('FORUM_ADD',TRUE);
define('IN_PHPBB', true);
define('PHPBB_ROOT_PATH','./'.$forumbase.'/');
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include_once($phpbb_root_path . 'common.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
$user->session_begin(true);
$auth->acl($user->data);
$template->assign_var('S_NEW_MESSAGE', true);
$message_parser = new parse_message();
$message_parser->bbcode_uid;
$forum_des = $forum_des.'
[url='.$siteurl.'/details.php?id='.$id.']See More Here[/url]
[url='.$siteurl.'/download.php?id='.$id.']DownLoad Here[/url]';
$message_parser->message = utf8_normalize_nfc($forum_des);
$topic_title = convert_charset(str_replace(array("-","_",".","torrent"),array(" "," "," ",""),$dname));
$message_md5 = md5($message_parser->message);
$current_time = time();
$message_parser->parse(true, true, true);
if($poster == "0") $postername = 'ANONYMOUS';
else
$postername = $user->name;
if($poster == "0") $poster = "1";
else
$poster = $user->data['user_id'];
//die($topic_title);
$poll = array();
			$data = array(
				'topic_title'			=> $topic_title,
				'topic_first_post_id'	=> 0,
				'topic_last_post_id'	=> 0,
				'topic_time_limit'		=> (int) 0,
				'topic_attachment'		=> 0,
				'post_id'				=> (int) 0,
				'topic_id'				=> (int) 0,
				'forum_id'				=> (int) $auto_post,//set forum ID
				'icon_id'				=> (int) 0,
				'poster_id'				=> (int) $poster,//user id
				'enable_sig'			=> (bool) true,
				'enable_bbcode'			=> (bool) true,
				'enable_smilies'		=> (bool) true,
				'enable_urls'			=> (bool) true,
				'enable_indexing'		=> (bool) true,
				'message_md5'			=> (string) $message_md5,
				'post_time'				=> $current_time,
				'post_checksum'			=>  '',
				'post_edit_reason'		=> '',
				'post_edit_user'		=> 0,
				'forum_parents'			=> '',
				'forum_name'			=> '',
				'notify'				=> false,
				'notify_set'			=> '',
				'poster_ip'				=> $user->ip,
				'post_edit_locked'		=> (int) 0,
				'bbcode_bitfield'		=> $message_parser->bbcode_bitfield,
				'bbcode_uid'			=> $message_parser->bbcode_uid,
				'message'				=> $message_parser->message,
				'attachment_data'		=> false,
				'filename_data'			=> false,

				'topic_approved'		=> true,
				'post_approved'			=> true,
			);
submit_post('post', $topic_title, $postername, 0, $poll, $data, false ,false);
unset($user);
$user = @new User($_COOKIE["btuser"]);
}
$search = Array("**id**","**name**");
$replace = Array($id,$torrentname);
echo "<p>".str_replace("**url**",$url,_btuploadcomplete)."</p>\n";
$mesg = str_replace($search,$replace,_btuplshout);
if(isset($shout) AND $shout_config['shout_new_torrent'] == "yes"){
$sql = "INSERT INTO ".$db_prefix."_shouts (user, text, posted) VALUES ('".$user->id."', '".$mesg."', NOW());";
                        $db->sql_query($sql);
}
if ($seeders <= 0 AND $force_upload){
	echo  "<p>"._btdeadtorrent."</p>\n";
}


if (isset($commnotify)){
        $sql = "INSERT INTO ".$db_prefix."_comments_notify (torrent, user) VALUES ('".$id."', ".$user->id.")";
        $db->sql_query($sql) or btsqlerror($sql);
        echo "<p>&nbsp;</p>";
        echo  "<p>"._btaddnotifycomment."</p>\n";
}
if (isset($seednotify) AND $announce == "") {
        $sql = "INSERT INTO ".$db_prefix."_seeder_notify (torrent, user) VALUES ('".$id."', ".$user->id.")";
        $db->sql_query($sql) or btsqlerror($sql);
        echo "<p>&nbsp;</p>";
        echo "<p>"._btaddnotifyseeder."</p>\n";
}
CloseTable();
?>


Like I said in my last post, I just want to make the .nfo file optional. Everything else is still working great. I thought that maybe it was how I was hosting the tracker. I'm hosting the tracker and BB3 on a Synology NAS with DSM 4.1. Right now I have it running a SFTP server, HTTPS server, Local Network Share, Local Media Server (works really good), Download Station (with auto loading of torrents from a dir or RSS), Subsonic stream server and now with the tracker plus BB3 server (there's a built in SQL server on the NAS as well).
Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #6255 is a reply to message #6251] Mon, 24 December 2012 20:35 Go to previous messageGo to next message
joeroberts is currently offline  joeroberts
Messages: 2174
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
the thing is the NFO is not a mandatory upload.
Never has been.
there are 2 places where the error is called from so I would need you to run a couple tests for me

Find
_btemptyfile

In taketorrent.php
you should find it 2 times in the first one make it
_btemptyfile . ' 1' 

and the second one make it
_btemptyfile . ' 2' 

so this way I know which one is throwing the error.


\"http://a.imageshack.us/img831/5562/mybikes.png\"
Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #6256 is a reply to message #6255] Wed, 26 December 2012 22:01 Go to previous messageGo to next message
psyfer9983 is currently offline  psyfer9983
Messages: 5
Registered: December 2012
Location: USA
Leecher
Sorry for not getting back sooner, haven't had the time to test it due to family. Anyway, I got "Fatal Error in Uploaded File. File Empty 2". I would assume that it is the second _btemptyfile check causing problems? Thanks.

[Updated on: Wed, 26 December 2012 22:02]

Report message to a moderator

Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #6257 is a reply to message #6256] Wed, 26 December 2012 23:25 Go to previous messageGo to next message
joeroberts is currently offline  joeroberts
Messages: 2174
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
that error is from the torrent not the nfo file.
If you upload a NFO file dose the torrent upload?


\"http://a.imageshack.us/img831/5562/mybikes.png\"
Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #6258 is a reply to message #565] Thu, 27 December 2012 18:43 Go to previous messageGo to next message
psyfer9983 is currently offline  psyfer9983
Messages: 5
Registered: December 2012
Location: USA
Leecher
It works now. My server had a php error that finally got logged. I fixed that by reinstalling the whole server again since the log didn't help me on finding the real problem. This was on the hosting NAS I have.

I now have another question/problem. I have uploaded a test torrent. I have set the server to use passkeys. Thing is, server isn't giving them out on the announce url. Is the admin account allowed to download with passkey enabled or just standard users?. I also thought that server would change the tracker url(s) to match the server on download so there is no errors in the tracker announce url. I know the server (BNBT for windows, no passkey support at that time) I had setup a long time ago did this when you uploaded a torrent. It added the tracker of the server to the top of the list while still keeping the original list if you setup the server to do that.
Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #6259 is a reply to message #6258] Fri, 28 December 2012 00:21 Go to previous messageGo to next message
joeroberts is currently offline  joeroberts
Messages: 2174
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
as for your passkey go to edit your account and click on save.
if you change your tracker to force passkey after you set it up the first time you always want to make sure you set your
passkey your self.
it well only set it to new users not exesting users.
Changing announce url on a torrent changes the info hash in PMBT .70 - 2.04 so it renders the torrent useless to any other traker
in the list.


\"http://a.imageshack.us/img831/5562/mybikes.png\"
Re: Torrent upload form: Change defaults for checkboxes, remove eXeem and NFO upload [message #6260 is a reply to message #565] Sat, 29 December 2012 18:23 Go to previous message
psyfer9983 is currently offline  psyfer9983
Messages: 5
Registered: December 2012
Location: USA
Leecher
I selected the reset box on the passkey and it gave me one. It all working now. THANKS!

Now to find some themes, maybe something that is dummy proof for my friends.
Previous Topic: youtube
Next Topic: Candidates pmbt core
Goto Forum:
  


Current Time: Mon Apr 23 13:33:41 CEST 2018

Total time taken to generate the page: 0.10123 seconds